summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CHURLAUD <olivier@churlaud.com>2016-07-17 00:28:57 (GMT)
committerOlivier CHURLAUD <olivier@churlaud.com>2016-07-17 00:28:57 (GMT)
commit630269a400bd2fd1f5a49388d2d37b44f70b8d3b (patch)
treed64f246f799cc3e21e9a9fd065a3e0af25823dc8
parent3d7bea0f806770f2a5bab5dd414a9328148f7299 (diff)
More ports out of KDialog
-rw-r--r--CMakeLists.txt1
-rw-r--r--conf/dlgperformancebase.ui10
-rw-r--r--ui/bookmarklist.cpp6
-rw-r--r--ui/fileprinterpreview.cpp35
-rw-r--r--ui/fileprinterpreview.h4
-rw-r--r--ui/pageview.cpp72
-rw-r--r--ui/presentationwidget.cpp7
7 files changed, 36 insertions, 99 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7734ed9..dc109d6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -314,6 +314,7 @@ target_link_libraries(okularpart okularcore
KF5::Archive
KF5::Bookmarks
KF5::IconThemes
+ KF5::ItemViews
KF5::KDELibs4Support
KF5::Parts
KF5::Solid
diff --git a/conf/dlgperformancebase.ui b/conf/dlgperformancebase.ui
index 2e5c1cc..75b7530 100644
--- a/conf/dlgperformancebase.ui
+++ b/conf/dlgperformancebase.ui
@@ -141,7 +141,7 @@
</widget>
</item>
<item>
- <widget class="KButtonGroup" name="groupbox">
+ <widget class="QGroupBox" name="groupbox">
<property name="title">
<string>Memory Usage</string>
</property>
@@ -344,14 +344,6 @@
</item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>KButtonGroup</class>
- <extends>QGroupBox</extends>
- <header>kbuttongroup.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
<includes>
<include location="global">kiconloader.h</include>
</includes>
diff --git a/ui/bookmarklist.cpp b/ui/bookmarklist.cpp
index e1acdbb..1450323 100644
--- a/ui/bookmarklist.cpp
+++ b/ui/bookmarklist.cpp
@@ -16,12 +16,12 @@
#include <qlayout.h>
#include <qtoolbar.h>
#include <qtreewidget.h>
-
+#include <QMenu>
#include <QtCore/QDebug>
#include <QIcon>
+
#include <KLocalizedString>
-#include <qmenu.h>
-#include <ktreewidgetsearchline.h>
+#include <KTreeWidgetSearchLine>
#include "pageitemdelegate.h"
#include "core/action.h"
diff --git a/ui/fileprinterpreview.cpp b/ui/fileprinterpreview.cpp
index bfbbc15..59d0059 100644
--- a/ui/fileprinterpreview.cpp
+++ b/ui/fileprinterpreview.cpp
@@ -14,11 +14,13 @@
#include <QFile>
#include <QSize>
-#include <QtCore/QFile>
-#include <QtWidgets/QLabel>
-#include <QtWidgets/QPushButton>
-#include <QtGui/QShowEvent>
+#include <QDialogButtonBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QShowEvent>
+#include <QVBoxLayout>
+#include <KWindowConfig>
#include <klocalizedstring.h>
#include <kmimetypetrader.h>
#include <kparts/readonlypart.h>
@@ -44,6 +46,9 @@ public:
, config(KSharedConfig::openConfig(QStringLiteral("okularrc")))
{
+ mainlayout = new QVBoxLayout(q);
+ buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, q);
+ mainlayout->addWidget(buttonBox);
filename = _filename;
}
@@ -55,6 +60,10 @@ public:
QWidget *mainWidget;
+ QDialogButtonBox *buttonBox;
+
+ QVBoxLayout *mainlayout;
+
QString filename;
KParts::ReadOnlyPart *previewPart;
@@ -111,7 +120,7 @@ bool FilePrinterPreviewPrivate::doPreview()
fail();
return false;
} else {
- q->setMainWidget(previewPart->widget());
+ mainlayout->insertWidget(0, previewPart->widget());
return previewPart->openUrl(QUrl::fromLocalFile(filename));
}
}
@@ -121,30 +130,30 @@ void FilePrinterPreviewPrivate::fail()
if (!failMessage) {
failMessage = new QLabel(i18n("Could not load print preview part"), q);
}
- q->setMainWidget(failMessage);
+ mainlayout->insertWidget(0, failMessage);
}
FilePrinterPreview::FilePrinterPreview( const QString &filename, QWidget *parent )
- : KDialog( parent )
+ : QDialog( parent )
, d( new FilePrinterPreviewPrivate( this, filename ) )
{
qCDebug(OkularUiDebug) << "kdeprint: creating preview dialog";
// Set up the dialog
- setCaption(i18n("Print Preview"));
- setButtons(KDialog::Close);
- button(KDialog::Close)->setAutoDefault(false);
+ setWindowTitle(i18n("Print Preview"));
+
+ connect(d->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
- restoreDialogSize(d->config->group("Print Preview"));
+ KWindowConfig::restoreWindowSize(windowHandle(), d->config->group("Print Preview"));
}
FilePrinterPreview::~FilePrinterPreview()
{
KConfigGroup group(d->config->group("Print Preview"));
- saveDialogSize(group);
+ KWindowConfig::saveWindowSize(windowHandle(), group);
delete d;
}
@@ -164,7 +173,7 @@ void FilePrinterPreview::showEvent(QShowEvent *event)
return;
}
}
- KDialog::showEvent(event);
+ QDialog::showEvent(event);
}
#include "moc_fileprinterpreview.cpp"
diff --git a/ui/fileprinterpreview.h b/ui/fileprinterpreview.h
index cca420d..c3f3260 100644
--- a/ui/fileprinterpreview.h
+++ b/ui/fileprinterpreview.h
@@ -13,7 +13,7 @@
#ifndef FILEPRINTERPREVIEW_H
#define FILEPRINTERPREVIEW_H
-#include <kdialog.h>
+#include <QDialog>
namespace Okular {
@@ -21,7 +21,7 @@ namespace Okular {
class FilePrinterPreviewPrivate;
-class FilePrinterPreview : public KDialog
+class FilePrinterPreview : public QDialog
{
Q_OBJECT
diff --git a/ui/pageview.cpp b/ui/pageview.cpp
index 52b975b..580db18 100644
--- a/ui/pageview.cpp
+++ b/ui/pageview.cpp
@@ -35,18 +35,16 @@
#include <QInputDialog>
#include <qdesktopwidget.h>
#include <QMimeDatabase>
+#include <QMimeData>
#include <qaction.h>
#include <kactionmenu.h>
#include <kstandardaction.h>
#include <kactioncollection.h>
#include <KLocalizedString>
-#include <kfiledialog.h>
-#include <kglobal.h>
#include <kselectaction.h>
#include <ktoggleaction.h>
#include <QtCore/QDebug>
-#include <kdeversion.h>
#include <kmessagebox.h>
#include <QIcon>
#include <kurifilter.h>
@@ -659,7 +657,7 @@ void PageView::setupActions( KActionCollection * ac )
ac->addAction( QStringLiteral("speak_document"), d->aSpeakDoc );
d->aSpeakDoc->setEnabled( false );
connect( d->aSpeakDoc, &QAction::triggered, this, &PageView::slotSpeakDocument );
-
+
d->aSpeakPage = new QAction( QIcon::fromTheme( QStringLiteral("text-speak") ), i18n( "Speak Current Page" ), this );
ac->addAction( QStringLiteral("speak_current_page"), d->aSpeakPage );
d->aSpeakPage->setEnabled( false );
@@ -2765,8 +2763,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
else if ( choice == imageToFile )
{
// [3] save pixmap to file
- QString fileName = KFileDialog::getSaveFileName( QUrl(), QStringLiteral("image/png image/jpeg"), this, QString(),
- KFileDialog::ConfirmOverwrite );
+ QString fileName = QFileDialog::getSaveFileName(this, i18n("Save file"), QString(), i18n("Images (*.png .jpeg"));
if ( fileName.isEmpty() )
d->messageWindow->display( i18n( "File not saved." ), QString(), PageViewMessage::Warning );
else
@@ -4206,58 +4203,7 @@ void PageView::updatePageStep() {
void PageView::addWebShortcutsMenu( QMenu * menu, const QString & text )
{
-#if KDE_IS_VERSION(4,5,70)
- if ( text.isEmpty() )
- {
- return;
- }
-
- QString searchText = text;
- searchText = searchText.replace( QLatin1Char('\n'), QLatin1Char(' ') ).replace(QLatin1Char( '\r'), QLatin1Char(' ') ).simplified();
-
- if ( searchText.isEmpty() )
- {
- return;
- }
-
- KUriFilterData filterData( searchText );
-
- filterData.setSearchFilteringOptions( KUriFilterData::RetrievePreferredSearchProvidersOnly );
-
- if ( KUriFilter::self()->filterSearchUri( filterData, KUriFilter::NormalTextFilter ) )
- {
- const QStringList searchProviders = filterData.preferredSearchProviders();
-
- if ( !searchProviders.isEmpty() )
- {
- QMenu *webShortcutsMenu = new QMenu( menu );
- webShortcutsMenu->setIcon( QIcon::fromTheme( QStringLiteral("preferences-web-browser-shortcuts") ) );
-
- const QString squeezedText = KStringHandler::rsqueeze( searchText, 21 );
- webShortcutsMenu->setTitle( i18n( "Search for '%1' with", squeezedText ) );
- QAction *action = 0;
-
- foreach( const QString &searchProvider, searchProviders )
- {
- action = new QAction( searchProvider, webShortcutsMenu );
- action->setIcon( QIcon::fromTheme( filterData.iconNameForPreferredSearchProvider( searchProvider ) ) );
- action->setData( filterData.queryForPreferredSearchProvider( searchProvider ) );
- connect( action, &QAction::triggered, this, &PageView::slotHandleWebShortcutAction );
- webShortcutsMenu->addAction( action );
- }
-
- webShortcutsMenu->addSeparator();
-
- action = new QAction( i18n( "Configure Web Shortcuts..." ), webShortcutsMenu );
- action->setIcon( QIcon::fromTheme( QStringLiteral("configure") ) );
- connect( action, &QAction::triggered, this, &PageView::slotConfigureWebShortcuts );
- webShortcutsMenu->addAction( action );
-
- menu->addMenu(webShortcutsMenu);
- }
- }
-#endif
}
//BEGIN private SLOTS
@@ -4752,19 +4698,7 @@ void PageView::slotShowSizeAllCursor()
void PageView::slotHandleWebShortcutAction()
{
-#if KDE_IS_VERSION(4,5,70)
- QAction *action = qobject_cast<QAction*>( sender() );
-
- if (action)
- {
- KUriFilterData filterData( action->data().toString() );
- if ( KUriFilter::self()->filterSearchUri( filterData, KUriFilter::WebShortcutFilter ) )
- {
- KToolInvocation::invokeBrowser( filterData.uri().url() );
- }
- }
-#endif
}
void PageView::slotConfigureWebShortcuts()
diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp
index b2a74a7..b95ca91 100644
--- a/ui/presentationwidget.cpp
+++ b/ui/presentationwidget.cpp
@@ -39,7 +39,7 @@
#include <kiconloader.h>
#include <kmessagebox.h>
#include <kselectaction.h>
-#include <kdialog.h>
+#include <QDialog>
#include <Solid/PowerManagement>
@@ -149,7 +149,8 @@ PresentationWidget::PresentationWidget( QWidget * parent, Okular::Document * doc
if ( caption.trimmed().isEmpty() )
caption = doc->currentDocument().fileName();
caption = i18nc( "[document title/filename] – Presentation", "%1 – Presentation", caption );
- setWindowTitle( KDialog::makeStandardCaption( caption ) );
+ setWindowTitle( caption );
+#pragma message("KF5: Here was a makeStandardCaption, lost in KF5 port")
m_width = -1;
m_screen = -2;
@@ -235,7 +236,7 @@ PresentationWidget::PresentationWidget( QWidget * parent, Okular::Document * doc
m_overlayHideTimer = new QTimer( this );
m_overlayHideTimer->setSingleShot( true );
connect(m_overlayHideTimer, &QTimer::timeout, this, &PresentationWidget::slotHideOverlay);
- m_nextPageTimer = new QTimer( this );
+ m_nextPageTimer = new QTimer( this );
m_nextPageTimer->setSingleShot( true );
connect(m_nextPageTimer, &QTimer::timeout, this, &PresentationWidget::slotNextPage);