summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CHURLAUD <olivier@churlaud.com>2016-07-21 19:53:54 (GMT)
committerOlivier CHURLAUD <olivier@churlaud.com>2016-07-21 19:53:54 (GMT)
commitef6f5ebc3b7063abdf8328777d17fd1d2482982d (patch)
tree64f5d17e34584df39a1dbc0bdd258e8d12d1d794
parent33122dd8252cb1a87f1708142332bc15b6c6f0d1 (diff)
Porting more files out of KDialog
-rw-r--r--CMakeLists.txt1
-rw-r--r--generators/mobipocket/CMakeLists.txt2
-rw-r--r--mobile/components/CMakeLists.txt4
-rw-r--r--mobile/components/okularplugin.cpp2
-rw-r--r--ui/guiutils.cpp15
-rw-r--r--ui/guiutils.h2
-rw-r--r--ui/propertiesdialog.cpp39
-rw-r--r--ui/thumbnaillist.cpp57
-rw-r--r--ui/thumbnaillist.h8
9 files changed, 67 insertions, 63 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dc109d6..d999cbe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -313,6 +313,7 @@ target_link_libraries(okularpart okularcore
Phonon::phonon4qt5
KF5::Archive
KF5::Bookmarks
+ KF5::I18n
KF5::IconThemes
KF5::ItemViews
KF5::KDELibs4Support
diff --git a/generators/mobipocket/CMakeLists.txt b/generators/mobipocket/CMakeLists.txt
index 8ef140b..141ba0d 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 ${QMOBIPOCKET_LIBRARIES} KF5::I18n Qt5::Gui KF5::KDELibs4Support)
+target_link_libraries(okularGenerator_mobi okularcore ${QMOBIPOCKET_LIBRARIES} KF5::I18n Qt5::Gui)
########### install files ###############
diff --git a/mobile/components/CMakeLists.txt b/mobile/components/CMakeLists.txt
index a345102..9da375f 100644
--- a/mobile/components/CMakeLists.txt
+++ b/mobile/components/CMakeLists.txt
@@ -4,7 +4,7 @@ add_definitions(${QT_DEFINITIONS})
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_BINARY_DIR}
-
+
${QIMAGEBLITZ_INCLUDES}
)
@@ -29,7 +29,7 @@ target_link_libraries(okularplugin
Qt5::Xml
Qt5::Svg
okularcore
- KF5::KDELibs4Support
+ okularpart
)
install(TARGETS okularplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/okular)
diff --git a/mobile/components/okularplugin.cpp b/mobile/components/okularplugin.cpp
index 93d491e..2204bea 100644
--- a/mobile/components/okularplugin.cpp
+++ b/mobile/components/okularplugin.cpp
@@ -23,7 +23,7 @@
#include "pageitem.h"
#include "thumbnailitem.h"
-#include <QtQml/QQmlEngine>
+#include <QQmlEngine>
#include <QPluginLoader>
void OkularPlugin::registerTypes(const char *uri)
diff --git a/ui/guiutils.cpp b/ui/guiutils.cpp
index 72986c4..14bb85c 100644
--- a/ui/guiutils.cpp
+++ b/ui/guiutils.cpp
@@ -10,12 +10,13 @@
#include "guiutils.h"
// qt/kde includes
-#include <qpainter.h>
-#include <qsvgrenderer.h>
-#include <qtextdocument.h>
-#include <qfiledialog.h>
-#include <kiconloader.h>
-#include <kmessagebox.h>
+#include <QPainter>
+#include <QSvgRenderer>
+#include <QTextDocument>
+#include <QFileDialog>
+#include <QStandardPaths>
+#include <KIconLoader>
+#include <KMessageBox>
#include <KLocalizedString>
// local includes
@@ -24,7 +25,7 @@
#include "core/document.h"
#include <memory>
-#include <QStandardPaths>
+
struct GuiUtilsHelper
{
diff --git a/ui/guiutils.h b/ui/guiutils.h
index fffe044..cbfcb04 100644
--- a/ui/guiutils.h
+++ b/ui/guiutils.h
@@ -10,7 +10,7 @@
#ifndef OKULAR_GUIUTILS_H
#define OKULAR_GUIUTILS_H
-#include <QtCore/QString>
+#include <QString>
class QColor;
class QImage;
diff --git a/ui/propertiesdialog.cpp b/ui/propertiesdialog.cpp
index d6b409f..c8a7798 100644
--- a/ui/propertiesdialog.cpp
+++ b/ui/propertiesdialog.cpp
@@ -10,25 +10,26 @@
#include "propertiesdialog.h"
// qt/kde includes
-#include <qapplication.h>
-#include <qdesktopwidget.h>
-#include <qfile.h>
-#include <qlayout.h>
-#include <qformlayout.h>
-#include <qlabel.h>
-#include <qheaderview.h>
-#include <qmenu.h>
-#include <qprogressbar.h>
-#include <qpushbutton.h>
-#include <qsortfilterproxymodel.h>
-#include <qtreeview.h>
-#include <qtimer.h>
-#include <kfiledialog.h>
+#include <QApplication>
+#include <QDesktopWidget>
+#include <QFormLayout>
+#include <QFile>
+#include <QFileDialog>
#include <QIcon>
-#include <kiconloader.h>
+#include <QLayout>
+#include <QLatin1Char>
+#include <QHeaderView>
+#include <QMenu>
+#include <QProgressBar>
+#include <QPushButton>
+#include <QSortFilterProxyModel>
+#include <QTreeView>
+#include <QTimer>
+
+#include <KIconLoader>
#include <KLocalizedString>
-#include <kmessagebox.h>
-#include <ksqueezedtextlabel.h>
+#include <KMessageBox>
+#include <KSqueezedTextLabel>
#include <QMimeDatabase>
// local includes
@@ -229,10 +230,10 @@ void PropertiesDialog::showFontsMenu(const QPoint &pos)
{
Okular::FontInfo fi = index.data(FontInfoRole).value<Okular::FontInfo>();
const QString caption = i18n( "Where do you want to save %1?", fi.name() );
- const QString path = KFileDialog::getSaveFileName( QUrl::fromLocalFile(fi.name()), QString(), this, caption, KFileDialog::ConfirmOverwrite );
+ const QString path = QFileDialog::getSaveFileName( this, caption, fi.name() );
if ( path.isEmpty() )
return;
-
+
QFile f( path );
if ( f.open( QIODevice::WriteOnly ) )
{
diff --git a/ui/thumbnaillist.cpp b/ui/thumbnaillist.cpp
index aaca697..bb72ef7 100644
--- a/ui/thumbnaillist.cpp
+++ b/ui/thumbnaillist.cpp
@@ -10,19 +10,20 @@
#include "thumbnaillist.h"
// qt/kde includes
-#include <qapplication.h>
-#include <qdesktopwidget.h>
-#include <qevent.h>
-#include <qtimer.h>
-#include <qpainter.h>
-#include <qscrollbar.h>
-#include <qsizepolicy.h>
-#include <KLocalizedString>
-#include <qaction.h>
-#include <kdialog.h>
-#include <kiconloader.h>
-#include <kactioncollection.h>
+#include <QAction>
+#include <QApplication>
+#include <QDesktopWidget>
#include <QIcon>
+#include <QPainter>
+#include <QResizeEvent>
+#include <QScrollBar>
+#include <QSizePolicy>
+#include <QStyle>
+#include <QTimer>
+
+#include <KLocalizedString>
+#include <KIconLoader>
+#include <KActionCollection>
// local includes
#include "pagepainter.h"
@@ -234,7 +235,7 @@ void ThumbnailList::notifySetup( const QVector< Okular::Page * > & pages, int se
if ( !( setupFlags & Okular::DocumentObserver::DocumentChanged ) && d->m_selected )
{
prevPage = d->m_selected->page()->number();
- } else
+ } else
prevPage = d->m_document->viewport().pageNumber;
// delete all the Thumbnails
@@ -280,7 +281,7 @@ void ThumbnailList::notifySetup( const QVector< Okular::Page * > & pages, int se
// restoring the previous selected page, if any
if ( (*pIt)->number() < prevPage )
{
- centerHeight = height + t->height() + KDialog::spacingHint()/2;
+ centerHeight = height + t->height() + this->style()->layoutSpacing(QSizePolicy::Frame, QSizePolicy::Frame, Qt::Vertical)/2;
}
if ( (*pIt)->number() == prevPage )
{
@@ -288,11 +289,11 @@ void ThumbnailList::notifySetup( const QVector< Okular::Page * > & pages, int se
d->m_selected->setSelected( true );
centerHeight = height + t->height() / 2;
}
- height += t->height() + KDialog::spacingHint();
+ height += t->height() + this->style()->layoutSpacing(QSizePolicy::Frame, QSizePolicy::Frame, Qt::Vertical);
}
// update scrollview's contents size (sets scrollbars limits)
- height -= KDialog::spacingHint();
+ height -= this->style()->layoutSpacing(QSizePolicy::Frame, QSizePolicy::Frame, Qt::Vertical);
widget()->resize( width, height );
// enable scrollbar when there's something to scroll
@@ -395,7 +396,7 @@ bool ThumbnailList::canUnloadPixmap( int pageNumber ) const
// if hidden permit unloading
return true;
}
-//END DocumentObserver inherited methods
+//END DocumentObserver inherited methods
void ThumbnailList::updateWidgets()
@@ -462,12 +463,12 @@ ThumbnailListPrivate::ChangePageDirection ThumbnailListPrivate::forwardTrack(con
Okular::DocumentViewport vp = m_document->viewport();
const double deltaX = (double)point.x() / r.width(),
deltaY = (double)point.y() / r.height();
- vp.rePos.normalizedX -= deltaX;
+ vp.rePos.normalizedX -= deltaX;
vp.rePos.normalizedY -= deltaY;
if ( vp.rePos.normalizedY > 1.0 )
return ThumbnailListPrivate::Down;
if ( vp.rePos.normalizedY < 0.0 )
- return ThumbnailListPrivate::Up;
+ return ThumbnailListPrivate::Up;
if ( vp.rePos.normalizedX > 1.0 )
return ThumbnailListPrivate::Right;
if ( vp.rePos.normalizedX < 0.0 )
@@ -494,7 +495,7 @@ void ThumbnailList::slotFilterBookmarks( bool filterOn )
}
-//BEGIN widget events
+//BEGIN widget events
void ThumbnailList::keyPressEvent( QKeyEvent * keyEvent )
{
if ( d->m_thumbnails.count() < 1 )
@@ -570,11 +571,11 @@ void ThumbnailListPrivate::viewportResizeEvent( QResizeEvent * e )
ThumbnailWidget *t = *tIt;
t->move(0, newHeight);
t->resizeFitWidth( newWidth );
- newHeight += t->height() + KDialog::spacingHint();
+ newHeight += t->height() + this->style()->layoutSpacing(QSizePolicy::Frame, QSizePolicy::Frame, Qt::Vertical);
}
// update scrollview's contents size (sets scrollbars limits)
- newHeight -= KDialog::spacingHint();
+ newHeight -= this->style()->layoutSpacing(QSizePolicy::Frame, QSizePolicy::Frame, Qt::Vertical);
const int oldHeight = q->widget()->height();
const int oldYCenter = q->verticalScrollBar()->value() + q->viewport()->height() / 2;
q->widget()->resize( newWidth, newHeight );
@@ -600,7 +601,7 @@ void ThumbnailListPrivate::viewportResizeEvent( QResizeEvent * e )
}
//END widget events
-//BEGIN internal SLOTS
+//BEGIN internal SLOTS
void ThumbnailListPrivate::slotRequestVisiblePixmaps( int /*newContentsY*/ )
{
// if an update is already scheduled or the widget is hidden, don't proceed
@@ -784,7 +785,7 @@ void ThumbnailListPrivate::mouseMoveEvent( QMouseEvent * e )
if ( !newThumb )
return;
int newPageOn = newThumb->pageNumber();
- if ( newPageOn == m_pageCurrentlyGrabbed || newPageOn < 0 ||
+ if ( newPageOn == m_pageCurrentlyGrabbed || newPageOn < 0 ||
newPageOn >= (int)m_document->pages() )
{
return;
@@ -798,8 +799,8 @@ void ThumbnailListPrivate::mouseMoveEvent( QMouseEvent * e )
if ( direction == ThumbnailListPrivate::Up )
{
vp.rePos.normalizedY = 1.0;
- if ( Okular::Settings::viewMode() ==
- Okular::Settings::EnumViewMode::FacingFirstCentered
+ if ( Okular::Settings::viewMode() ==
+ Okular::Settings::EnumViewMode::FacingFirstCentered
&& !newPageOn)
{
if ( m_pageCurrentlyGrabbed == 1 )
@@ -815,8 +816,8 @@ void ThumbnailListPrivate::mouseMoveEvent( QMouseEvent * e )
else if ( direction == ThumbnailListPrivate::Down )
{
vp.rePos.normalizedY = 0.0;
- if ( Okular::Settings::viewMode() ==
- Okular::Settings::EnumViewMode::FacingFirstCentered
+ if ( Okular::Settings::viewMode() ==
+ Okular::Settings::EnumViewMode::FacingFirstCentered
&& !m_pageCurrentlyGrabbed)
{
if ( origNormalX < 0.5 )
diff --git a/ui/thumbnaillist.h b/ui/thumbnaillist.h
index ab50b04..52460ba 100644
--- a/ui/thumbnaillist.h
+++ b/ui/thumbnaillist.h
@@ -10,12 +10,12 @@
#ifndef _OKULAR_THUMBNAILLIST_H_
#define _OKULAR_THUMBNAILLIST_H_
-#include <qscrollarea.h>
-
-#include <qtoolbar.h>
+#include <QScrollArea>
+#include <QToolBar>
+#include <QVBoxLayout>
#include "core/observer.h"
-#include <QVBoxLayout>
+
class ThumbnailListPrivate;
namespace Okular {