summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2016-05-30 22:13:36 (GMT)
committerAleix Pol <aleixpol@kde.org>2016-05-30 22:13:36 (GMT)
commit32b62e919a6493cca9d5d2b272872b53f9b5e41d (patch)
treec0ddf41e8fb424db166a4ec34a14e763249e87b5
parent18b4cababc796ba0c8bde4fc6f6f977678510956 (diff)
Remove most KDELibs4Support linking
Ports away from KFileDialog. Stops linking to KDELibs4Support from objects that don't need it. REVIEW: 127021
-rw-r--r--autotests/CMakeLists.txt21
-rw-r--r--core/document.cpp2
-rw-r--r--generators/mobipocket/CMakeLists.txt2
-rw-r--r--shell/CMakeLists.txt2
-rw-r--r--shell/shell.cpp33
5 files changed, 29 insertions, 31 deletions
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index 4530c33..39ec648 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -1,4 +1,3 @@
-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
diff --git a/core/document.cpp b/core/document.cpp
index 0bb8775..0c785f2 100644
--- a/core/document.cpp
+++ b/core/document.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;
diff --git a/generators/mobipocket/CMakeLists.txt b/generators/mobipocket/CMakeLists.txt
index 87995e3..61fbea4 100644
--- a/generators/mobipocket/CMakeLists.txt
+++ b/generators/mobipocket/CMakeLists.txt
@@ -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 ###############
diff --git a/shell/CMakeLists.txt b/shell/CMakeLists.txt
index 7a6af74..84cbf2d 100644
--- a/shell/CMakeLists.txt
+++ b/shell/CMakeLists.txt
@@ -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})
diff --git a/shell/shell.cpp b/shell/shell.cpp
index 60b22ea..62a6a33 100644
--- a/shell/shell.cpp
+++ b/shell/shell.cpp
@@ -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 );
}