Commit 32b62e91 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Remove most KDELibs4Support linking

Ports away from KFileDialog.
Stops linking to KDELibs4Support from objects that don't need it.

REVIEW: 127021
parent 18b4caba
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
add_definitions( -DKDESRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/" )
include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
......@@ -10,52 +9,52 @@ ecm_add_test(shelltest.cpp ../shell/shellutils.cpp
ecm_add_test(parttest.cpp
TEST_NAME "parttest"
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore okularpart KF5::KDELibs4Support
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore okularpart
)
ecm_add_test(documenttest.cpp
TEST_NAME "documenttest"
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore KF5::KDELibs4Support KF5::ThreadWeaver
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore KF5::ThreadWeaver
)
ecm_add_test(searchtest.cpp
TEST_NAME "searchtest"
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore KF5::KDELibs4Support
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore
)
ecm_add_test(annotationstest.cpp
TEST_NAME "annotationstest"
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore KF5::KDELibs4Support
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore
)
ecm_add_test(urldetecttest.cpp
TEST_NAME "urldetecttest"
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml KF5::CoreAddons KF5::KDELibs4Support
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml KF5::CoreAddons
)
ecm_add_test(editannotationcontentstest.cpp testingutils.cpp
TEST_NAME "editannotationcontentstest"
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore KF5::KDELibs4Support
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore
)
ecm_add_test(addremoveannotationtest.cpp testingutils.cpp
TEST_NAME "addremoveannotationtest"
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore KF5::KDELibs4Support
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore
)
ecm_add_test(translateannotationtest.cpp testingutils.cpp
TEST_NAME "translateannotationtest"
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore KF5::KDELibs4Support
LINK_LIBRARIES Qt5::Widgets Qt5::Test Qt5::Xml okularcore
)
ecm_add_test(modifyannotationpropertiestest.cpp testingutils.cpp
TEST_NAME "modifyannotationpropertiestest"
LINK_LIBRARIES Qt5::Widgets Qt5::Test okularcore KF5::KDELibs4Support
LINK_LIBRARIES Qt5::Widgets Qt5::Test okularcore
)
ecm_add_test(editformstest.cpp
TEST_NAME "editformstest"
LINK_LIBRARIES Qt5::Widgets Qt5::Test okularcore KF5::KDELibs4Support
LINK_LIBRARIES Qt5::Widgets Qt5::Test okularcore
)
ecm_add_test(mainshelltest.cpp ../shell/okular_main.cpp ../shell/shellutils.cpp ../shell/shell.cpp
......
......@@ -4279,9 +4279,9 @@ QStringList Document::supportedMimeTypes() const
const QVector<KPluginMetaData> available = DocumentPrivate::availableGenerators();
for (const KPluginMetaData& md : available)
{
// TODO should be uniquify this list?
result << md.mimeTypes();
}
result.removeDuplicates();
d->m_supportedMimeTypes = result;
}
return result;
......
......@@ -10,7 +10,7 @@ set(okularGenerator_mobi_PART_SRCS
okular_add_generator(okularGenerator_mobi ${okularGenerator_mobi_PART_SRCS})
target_link_libraries(okularGenerator_mobi okularcore KF5::KDELibs4Support Qt5::Gui ${QMOBIPOCKET_LIBRARIES})
target_link_libraries(okularGenerator_mobi okularcore Qt5::Gui ${QMOBIPOCKET_LIBRARIES})
########### install files ###############
......
......@@ -24,7 +24,7 @@ ecm_add_app_icon(okular_SRCS ICONS ${ICONS_SRCS})
add_executable(okular ${okular_SRCS})
target_link_libraries(okular KF5::Parts KF5::WindowSystem KF5::KDELibs4Support KF5::Activities)
target_link_libraries(okular KF5::Parts KF5::WindowSystem KF5::Activities)
install(TARGETS okular ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
......
......@@ -25,7 +25,7 @@
#include <QDBusConnection>
#include <QMenuBar>
#include <QApplication>
#include <KFileDialog>
#include <QFileDialog>
#include <KPluginLoader>
#include <KMessageBox>
#include <QMimeType>
......@@ -45,6 +45,7 @@
#include <KUrlMimeData>
#include <KLocalizedString>
#include <KSharedConfig>
#include <KIO/Global>
#include <KActivities/ResourceInstance>
// local includes
......@@ -391,9 +392,9 @@ QStringList Shell::fileFormats() const
{
KService::Ptr service = *it;
QStringList mimeTypes = service->serviceTypes();
foreach ( const QString& mimeType, mimeTypes )
if ( mimeType != basePartService )
supportedPatterns.append( mimeType );
mimeTypes.removeAll(basePartService);
supportedPatterns += mimeTypes;
}
return supportedPatterns;
......@@ -420,24 +421,22 @@ void Shell::fileOpen()
QUrl startDir;
const KParts::ReadWritePart* const curPart = m_tabs[activeTab].part;
if ( curPart->url().isLocalFile() )
startDir = curPart->url();
KFileDialog dlg( startDir, QString(), this );
dlg.setOperationMode( KFileDialog::Opening );
startDir = KIO::upUrl(curPart->url());
// A directory may be a document. E.g. comicbook generator.
if ( m_fileformats.contains( QStringLiteral("inode/directory") ) )
dlg.setMode( dlg.mode() | KFile::Directory );
QPointer<QFileDialog> dlg( new QFileDialog( this ));
dlg->setDirectoryUrl( startDir );
dlg->setAcceptMode( QFileDialog::AcceptOpen );
if ( m_fileformatsscanned && m_fileformats.isEmpty() )
dlg.setFilter( i18n( "*|All Files" ) );
dlg->setNameFilter( { i18n( "All Files (*)" ) } );
else
dlg.setMimeFilter( m_fileformats );
dlg.setWindowTitle( i18n( "Open Document" ) );
if ( !dlg.exec() )
dlg->setMimeTypeFilters( m_fileformats );
dlg->setWindowTitle( i18n( "Open Document" ) );
if ( !dlg->exec() || !dlg)
return;
QUrl url = dlg.selectedUrl();
if ( !url.isEmpty() )
foreach(const QUrl& url, dlg->selectedUrls())
{
openUrl( url );
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment