Commit ef6f5ebc authored by Olivier Churlaud's avatar Olivier Churlaud
Browse files

Porting more files out of KDialog

parent 33122dd8
......@@ -313,6 +313,7 @@ target_link_libraries(okularpart okularcore
Phonon::phonon4qt5
KF5::Archive
KF5::Bookmarks
KF5::I18n
KF5::IconThemes
KF5::ItemViews
KF5::KDELibs4Support
......
......@@ -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 ###############
......
......@@ -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)
......
......@@ -23,7 +23,7 @@
#include "pageitem.h"
#include "thumbnailitem.h"
#include <QtQml/QQmlEngine>
#include <QQmlEngine>
#include <QPluginLoader>
void OkularPlugin::registerTypes(const char *uri)
......
......@@ -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
{
......
......@@ -10,7 +10,7 @@
#ifndef OKULAR_GUIUTILS_H
#define OKULAR_GUIUTILS_H
#include <QtCore/QString>
#include <QString>
class QColor;
class QImage;
......
......@@ -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 ) )
{
......
......@@ -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 )
......
......@@ -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 {
......
Markdown is supported
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