mirror of
https://invent.kde.org/graphics/okular
synced 2024-07-16 10:17:04 +00:00
porting
svn path=/branches/work/kde4/playground/graphics/okular/; revision=522251
This commit is contained in:
parent
db09e1aabe
commit
8b41489e2f
4
dcop.h
4
dcop.h
|
@ -18,10 +18,10 @@ class okular_dcop : virtual public DCOPObject
|
|||
K_DCOP
|
||||
k_dcop:
|
||||
virtual ASYNC goToPage( uint page ) = 0;
|
||||
virtual ASYNC openDocument( KURL doc ) = 0;
|
||||
virtual ASYNC openDocument( KUrl doc ) = 0;
|
||||
virtual uint pages() = 0;
|
||||
virtual uint currentPage() = 0;
|
||||
virtual KURL currentDocument() = 0;
|
||||
virtual KUrl currentDocument() = 0;
|
||||
virtual void slotPreferences() = 0;
|
||||
virtual void slotFind() = 0;
|
||||
virtual void slotPrintPreview() = 0;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <qtimer.h>
|
||||
|
||||
class QTextEdit;
|
||||
class KURLLabel;
|
||||
class KUrlLabel;
|
||||
class GSLogWindow : public QVBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
30
part.cpp
30
part.cpp
|
@ -26,13 +26,13 @@
|
|||
#include <qpainter.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlabel.h>
|
||||
#include <qvbox.h>
|
||||
#include <kvbox.h>
|
||||
#include <qtoolbox.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <dcopobject.h>
|
||||
#include <dcopclient.h>
|
||||
#include <kapplication.h>
|
||||
#include <klistviewsearchline.h>
|
||||
#include <k3listviewsearchline.h>
|
||||
#include <kaction.h>
|
||||
#include <kdirwatch.h>
|
||||
#include <kinstance.h>
|
||||
|
@ -40,14 +40,14 @@
|
|||
#include <kstdaction.h>
|
||||
#include <kdeversion.h>
|
||||
#include <kparts/genericfactory.h>
|
||||
#include <kurldrag.h>
|
||||
#include <k3urldrag.h>
|
||||
#include <kfiledialog.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kfinddialog.h>
|
||||
#include <knuminput.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kio/netaccess.h>
|
||||
#include <kpopupmenu.h>
|
||||
#include <k3popupmenu.h>
|
||||
#include <kxmlguiclient.h>
|
||||
#include <kxmlguifactory.h>
|
||||
#include <ktrader.h>
|
||||
|
@ -105,7 +105,7 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
|
|||
connect( m_document, SIGNAL( linkGoToPage() ), this, SLOT( slotGoToPage() ) );
|
||||
connect( m_document, SIGNAL( linkPresentation() ), this, SLOT( slotShowPresentation() ) );
|
||||
connect( m_document, SIGNAL( linkEndPresentation() ), this, SLOT( slotHidePresentation() ) );
|
||||
connect( m_document, SIGNAL( openURL(const KURL &) ), this, SLOT( openURLFromDocument(const KURL &) ) );
|
||||
connect( m_document, SIGNAL( openURL(const KUrl &) ), this, SLOT( openURLFromDocument(const KUrl &) ) );
|
||||
connect( m_document, SIGNAL( close() ), this, SLOT( close() ) );
|
||||
|
||||
if (parent && parent->metaObject()->slotNames(true).contains("slotQuit()"))
|
||||
|
@ -151,12 +151,12 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
|
|||
enableTOC( false );
|
||||
|
||||
// [left toolbox: Thumbnails and Bookmarks] | []
|
||||
QVBox * thumbsBox = new ThumbnailsBox( m_toolBox );
|
||||
KVBox * thumbsBox = new ThumbnailsBox( m_toolBox );
|
||||
thumbsBox->setSpacing( 4 );
|
||||
m_searchWidget = new SearchWidget( thumbsBox, m_document );
|
||||
m_thumbnailList = new ThumbnailList( thumbsBox, m_document );
|
||||
// ThumbnailController * m_tc = new ThumbnailController( thumbsBox, m_thumbnailList );
|
||||
connect( m_thumbnailList, SIGNAL( urlDropped( const KURL& ) ), SLOT( openURLFromDocument( const KURL & )) );
|
||||
connect( m_thumbnailList, SIGNAL( urlDropped( const KUrl& ) ), SLOT( openURLFromDocument( const KUrl & )) );
|
||||
connect( m_thumbnailList, SIGNAL( rightClick(const KPDFPage *, const QPoint &) ), this, SLOT( slotShowMenu(const KPDFPage *, const QPoint &) ) );
|
||||
// shrink the bottom controller toolbar (too hackish..)
|
||||
thumbsBox->setStretchFactor( m_searchWidget, 100 );
|
||||
|
@ -189,7 +189,7 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
|
|||
// rightLayout->addWidget( rtb );
|
||||
m_pageView = new PageView( m_splitter, m_document );
|
||||
m_pageView->setFocus(); //usability setting
|
||||
connect( m_pageView, SIGNAL( urlDropped( const KURL& ) ), SLOT( openURLFromDocument( const KURL & )));
|
||||
connect( m_pageView, SIGNAL( urlDropped( const KUrl& ) ), SLOT( openURLFromDocument( const KUrl & )));
|
||||
connect( m_pageView, SIGNAL( rightClick(const KPDFPage *, const QPoint &) ), this, SLOT( slotShowMenu(const KPDFPage *, const QPoint &) ) );
|
||||
connect( m_document, SIGNAL(error(QString&,int )),m_pageView,SLOT(errorMessage(QString&,int )));
|
||||
connect( m_document, SIGNAL(warning(QString&,int )),m_pageView,SLOT(warningMessage(QString&,int )));
|
||||
|
@ -323,7 +323,7 @@ Part::~Part()
|
|||
delete m_document;
|
||||
}
|
||||
|
||||
void Part::openURLFromDocument(const KURL &url)
|
||||
void Part::openURLFromDocument(const KUrl &url)
|
||||
{
|
||||
m_bExtension->openURLNotify();
|
||||
m_bExtension->setLocationBarURL(url.prettyURL());
|
||||
|
@ -438,7 +438,7 @@ void Part::goToPage(uint i)
|
|||
m_document->setViewportPage( i - 1 );
|
||||
}
|
||||
|
||||
void Part::openDocument(KURL doc)
|
||||
void Part::openDocument(KUrl doc)
|
||||
{
|
||||
openURL(doc);
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ uint Part::currentPage()
|
|||
return m_document->pages() ? m_document->currentPage() + 1 : 0;
|
||||
}
|
||||
|
||||
KURL Part::currentDocument()
|
||||
KUrl Part::currentDocument()
|
||||
{
|
||||
return m_document->currentDocument();
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ KAboutData* Part::createAboutData()
|
|||
|
||||
bool Part::slotImportPSFile()
|
||||
{
|
||||
KURL url = KFileDialog::getOpenURL( QString::null, "application/postscript" );
|
||||
KUrl url = KFileDialog::getOpenURL( QString::null, "application/postscript" );
|
||||
KTempFile tf( QString::null, ".pdf" );
|
||||
|
||||
if ( tf.status() == 0 && url.isLocalFile())
|
||||
|
@ -543,7 +543,7 @@ bool Part::openFile()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Part::openURL(const KURL &url)
|
||||
bool Part::openURL(const KUrl &url)
|
||||
{
|
||||
// note: this can be the right place to check the file for gz or bz2 extension
|
||||
// if it matches then: download it (if not local) extract to a temp file using
|
||||
|
@ -799,7 +799,7 @@ void Part::slotFindNext()
|
|||
|
||||
void Part::slotSaveFileAs()
|
||||
{
|
||||
KURL saveURL = KFileDialog::getSaveURL( url().isLocalFile() ? url().url() : url().fileName(), QString::null, widget() );
|
||||
KUrl saveURL = KFileDialog::getSaveURL( url().isLocalFile() ? url().url() : url().fileName(), QString::null, widget() );
|
||||
if ( saveURL.isValid() && !saveURL.isEmpty() )
|
||||
{
|
||||
if ( KIO::NetAccess::exists( saveURL, false, widget() ) )
|
||||
|
@ -1054,7 +1054,7 @@ void Part::doPrint(KPrinter &printer)
|
|||
}
|
||||
}
|
||||
|
||||
void Part::restoreDocument(const KURL &url, int page)
|
||||
void Part::restoreDocument(const KUrl &url, int page)
|
||||
{
|
||||
if (openURL(url)) goToPage(page);
|
||||
}
|
||||
|
|
12
part.h
12
part.h
|
@ -27,7 +27,7 @@ class QWidget;
|
|||
class QSplitter;
|
||||
class QToolBox;
|
||||
|
||||
class KURL;
|
||||
class KUrl;
|
||||
class KAction;
|
||||
class KConfig;
|
||||
class KDirWatch;
|
||||
|
@ -76,10 +76,10 @@ public:
|
|||
static KAboutData* createAboutData();
|
||||
|
||||
ASYNC goToPage(uint page);
|
||||
ASYNC openDocument(KURL doc);
|
||||
ASYNC openDocument(KUrl doc);
|
||||
uint pages();
|
||||
uint currentPage();
|
||||
KURL currentDocument();
|
||||
KUrl currentDocument();
|
||||
|
||||
signals:
|
||||
void enablePrintAction(bool enable);
|
||||
|
@ -87,7 +87,7 @@ signals:
|
|||
protected:
|
||||
// reimplemented from KParts::ReadOnlyPart
|
||||
bool openFile();
|
||||
bool openURL(const KURL &url);
|
||||
bool openURL(const KUrl &url);
|
||||
bool closeURL();
|
||||
// filter that watches for splitter size changes
|
||||
bool eventFilter( QObject * watched, QEvent * e );
|
||||
|
@ -95,7 +95,7 @@ protected:
|
|||
|
||||
protected slots:
|
||||
// connected to actions
|
||||
void openURLFromDocument(const KURL &url);
|
||||
void openURLFromDocument(const KUrl &url);
|
||||
void slotGoToPage();
|
||||
void slotPreviousPage();
|
||||
void slotNextPage();
|
||||
|
@ -127,7 +127,7 @@ protected slots:
|
|||
public slots:
|
||||
// connected to Shell action (and browserExtension), not local one
|
||||
void slotPrint();
|
||||
void restoreDocument(const KURL &url, int page);
|
||||
void restoreDocument(const KUrl &url, int page);
|
||||
void saveDocumentRestoreInfo(KConfig* config);
|
||||
void slotFileDirty( const QString& );
|
||||
void slotDoFileDirty();
|
||||
|
|
|
@ -116,8 +116,8 @@ public:
|
|||
// actions
|
||||
KSelectAction * aOrientation;
|
||||
KSelectAction * aPaperSizes;
|
||||
KToggleAction * aMouseNormal;
|
||||
KToggleAction * aMouseSelect;
|
||||
KAction * aMouseNormal;
|
||||
KAction * aMouseSelect;
|
||||
KToggleAction * aToggleAnnotator;
|
||||
KSelectAction * aZoom;
|
||||
KToggleAction * aZoomFitWidth;
|
||||
|
@ -263,15 +263,17 @@ void PageView::setupActions( KActionCollection * ac )
|
|||
d->aViewContinuous->setChecked( KpdfSettings::viewContinuous() );
|
||||
|
||||
// Mouse-Mode actions
|
||||
d->aMouseNormal = new KRadioAction( i18n("&Browse Tool"), "mouse", 0, this, SLOT( slotSetMouseNormal() ), ac, "mouse_drag" );
|
||||
d->aMouseNormal->setExclusiveGroup( "MouseType" );
|
||||
QActionGroup * actGroup = new QActionGroup( this );
|
||||
actGroup->setExclusive( true );
|
||||
d->aMouseNormal = new KAction( i18n("&Browse Tool"), "mouse", 0, this, SLOT( slotSetMouseNormal() ), ac, "mouse_drag" );
|
||||
d->aMouseNormal->setActionGroup( actGroup );
|
||||
d->aMouseNormal->setChecked( true );
|
||||
|
||||
KToggleAction * mz = new KRadioAction( i18n("&Zoom Tool"), "viewmag", 0, this, SLOT( slotSetMouseZoom() ), ac, "mouse_zoom" );
|
||||
mz->setExclusiveGroup( "MouseType" );
|
||||
KAction * mz = new KAction( i18n("&Zoom Tool"), "viewmag", 0, this, SLOT( slotSetMouseZoom() ), ac, "mouse_zoom" );
|
||||
mz->setActionGroup( actGroup );
|
||||
|
||||
d->aMouseSelect = new KRadioAction( i18n("&Select Tool"), "frame_edit", 0, this, SLOT( slotSetMouseSelect() ), ac, "mouse_select" );
|
||||
d->aMouseSelect->setExclusiveGroup( "MouseType" );
|
||||
d->aMouseSelect = new KAction( i18n("&Select Tool"), "frame_edit", 0, this, SLOT( slotSetMouseSelect() ), ac, "mouse_select" );
|
||||
d->aMouseSelect->setActionGroup( actGroup );
|
||||
|
||||
d->aToggleAnnotator = new KToggleAction( i18n("&Review"), "pencil", 0, ac, "mouse_toggle_annotate" );
|
||||
connect( d->aToggleAnnotator, SIGNAL( toggled( bool ) ), SLOT( slotToggleAnnotator( bool ) ) );
|
||||
|
@ -633,7 +635,7 @@ if ( d->document->handleEvent( pe ) )
|
|||
if ( d->mouseTextSelecting )
|
||||
{
|
||||
QRect blendRect;
|
||||
QLinkedList<QRect>::iterator it=d->mouseTextSelectionRect->begin(),
|
||||
QList<QRect>::iterator it=d->mouseTextSelectionRect->begin(),
|
||||
end=d->mouseTextSelectionRect->end();
|
||||
XRenderColor col;
|
||||
float alpha=0.2f;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <qlayout.h>
|
||||
#include <qlabel.h>
|
||||
#include <klocale.h>
|
||||
#include <klistview.h>
|
||||
#include <k3listview.h>
|
||||
#include <ksqueezedtextlabel.h>
|
||||
#include <kglobalsettings.h>
|
||||
|
||||
|
@ -78,7 +78,7 @@ PropertiesDialog::PropertiesDialog(QWidget *parent, KPDFDocument *doc)
|
|||
QFrame *page2 = addPage(i18n("Fonts"));
|
||||
page2Layout = new QVBoxLayout(page2, 0, KDialog::spacingHint());
|
||||
// add a klistview with 4 columns
|
||||
KListView *lv = new KListView(page2);
|
||||
K3ListView *lv = new K3ListView(page2);
|
||||
lv->addColumn( i18n("Name") );
|
||||
lv->addColumn( i18n("Type") );
|
||||
lv->addColumn( i18n("Embedded") );
|
||||
|
@ -87,7 +87,7 @@ PropertiesDialog::PropertiesDialog(QWidget *parent, KPDFDocument *doc)
|
|||
// populate the klistview
|
||||
for ( QDomNode node = fonts->documentElement().firstChild(); !node.isNull(); node = node.nextSibling() ) {
|
||||
QDomElement e = node.toElement();
|
||||
new KListViewItem( lv, e.attribute( "Name" ), e.attribute( "Type" ),
|
||||
new K3ListViewItem( lv, e.attribute( "Name" ), e.attribute( "Type" ),
|
||||
e.attribute( "Embedded" ), e.attribute( "File" ) );
|
||||
}
|
||||
}
|
||||
|
@ -95,9 +95,9 @@ PropertiesDialog::PropertiesDialog(QWidget *parent, KPDFDocument *doc)
|
|||
// current width: left columnt + right column + dialog borders
|
||||
int width = layout->minimumSize().width() + valMaxWidth + 2 * marginHint() + spacingHint() + 30;
|
||||
if ( page2Layout )
|
||||
width = QMAX( width, page2Layout->sizeHint().width() + marginHint() + spacingHint() + 31 );
|
||||
width = qMax( width, page2Layout->sizeHint().width() + marginHint() + spacingHint() + 31 );
|
||||
// stay inside the 2/3 of the screen width
|
||||
QRect screenContainer = KGlobalSettings::desktopGeometry( this );
|
||||
width = QMIN( width, 2*screenContainer.width()/3 );
|
||||
width = qMin( width, 2*screenContainer.width()/3 );
|
||||
resize(width, 1);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <klocale.h>
|
||||
#include <kiconloader.h>
|
||||
#include <klineedit.h>
|
||||
#include <ktoolbarbutton.h>
|
||||
|
||||
// local includes
|
||||
#include "searchwidget.h"
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include <qlayout.h>
|
||||
#include <qtimer.h>
|
||||
#include <ktoolbar.h>
|
||||
#include <klistview.h>
|
||||
#include <klistviewsearchline.h>
|
||||
#include <k3listview.h>
|
||||
#include <k3listviewsearchline.h>
|
||||
#include <kaction.h>
|
||||
#include <kactionclasses.h>
|
||||
#include <klocale.h>
|
||||
|
@ -35,13 +35,13 @@ Reviews::Reviews( QWidget * parent, KPDFDocument * document )
|
|||
QVBoxLayout * vLayout = new QVBoxLayout( this, 0, 4 );
|
||||
m_toolBar1 = new KToolBar( this, "reviewSearchBar" );
|
||||
vLayout->addWidget( m_toolBar1 );
|
||||
m_listView = new KListView( this );
|
||||
m_listView = new K3ListView( this );
|
||||
vLayout->addWidget( m_listView );
|
||||
m_toolBar2 = new KToolBar( this, "reviewOptsBar" );
|
||||
vLayout->addWidget( m_toolBar2 );
|
||||
|
||||
// setup 1-UPPER toolbar and searchLine
|
||||
m_searchLine = new KListViewSearchLine( m_toolBar1, m_listView );
|
||||
m_searchLine = new K3ListViewSearchLine( m_toolBar1, m_listView );
|
||||
m_toolBar1->setIconDimensions( 16 );
|
||||
m_toolBar1->setMovable( false );
|
||||
// - add Clear button
|
||||
|
@ -79,7 +79,7 @@ Reviews::Reviews( QWidget * parent, KPDFDocument * document )
|
|||
m_listView->addColumn( i18n("Annotation") );
|
||||
m_listView->header()->hide();
|
||||
m_listView->setTreeStepSize( 16 );
|
||||
m_listView->setResizeMode( KListView::AllColumns );
|
||||
m_listView->setResizeMode( K3ListView::AllColumns );
|
||||
}
|
||||
|
||||
//BEGIN DocumentObserver Notifies -> requestListViewUpdate
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
class KPDFDocument;
|
||||
class KPDFPage;
|
||||
class KToolBar;
|
||||
class KListView;
|
||||
class KListViewSearchLine;
|
||||
class K3ListView;
|
||||
class K3ListViewSearchLine;
|
||||
class QTimer;
|
||||
|
||||
/**
|
||||
|
@ -51,8 +51,8 @@ class Reviews : public QWidget, public DocumentObserver
|
|||
// data fields (GUI)
|
||||
KToolBar * m_toolBar1;
|
||||
KToolBar * m_toolBar2;
|
||||
KListView * m_listView;
|
||||
KListViewSearchLine * m_searchLine;
|
||||
K3ListView * m_listView;
|
||||
K3ListViewSearchLine * m_searchLine;
|
||||
// internal storage
|
||||
KPDFDocument * m_document;
|
||||
QVector< KPDFPage * > m_pages;
|
||||
|
|
14
ui/toc.cpp
14
ui/toc.cpp
|
@ -22,19 +22,19 @@
|
|||
// they're slow when converted to page number. drop the 2nd column idea.
|
||||
// to enable set TocPageColumn=true in [Nav Panel]
|
||||
|
||||
class TOCItem : public KListViewItem
|
||||
class TOCItem : public K3ListViewItem
|
||||
{
|
||||
public:
|
||||
TOCItem( KListView *parent, TOCItem *after, const QDomElement & e )
|
||||
: KListViewItem( parent, after, e.tagName() ), m_element( e )
|
||||
TOCItem( K3ListView *parent, TOCItem *after, const QDomElement & e )
|
||||
: K3ListViewItem( parent, after, e.tagName() ), m_element( e )
|
||||
{
|
||||
if ( KpdfSettings::tocPageColumn() && e.hasAttribute( "Page" ) )
|
||||
setText( 1, e.attribute( "Page" ) );
|
||||
setMultiLinesEnabled( true );
|
||||
}
|
||||
|
||||
TOCItem( KListViewItem *parent, TOCItem *after, const QDomElement & e )
|
||||
: KListViewItem( parent, after, e.tagName() ), m_element( e )
|
||||
TOCItem( K3ListViewItem *parent, TOCItem *after, const QDomElement & e )
|
||||
: K3ListViewItem( parent, after, e.tagName() ), m_element( e )
|
||||
{
|
||||
if ( KpdfSettings::tocPageColumn() && e.hasAttribute( "Page" ) )
|
||||
setText( 1, e.attribute( "Page" ) );
|
||||
|
@ -50,7 +50,7 @@ class TOCItem : public KListViewItem
|
|||
QDomElement m_element;
|
||||
};
|
||||
|
||||
TOC::TOC(QWidget *parent, KPDFDocument *document) : KListView(parent), m_document(document)
|
||||
TOC::TOC(QWidget *parent, KPDFDocument *document) : K3ListView(parent), m_document(document)
|
||||
{
|
||||
addColumn( i18n("Topic") );
|
||||
if (KpdfSettings::tocPageColumn())
|
||||
|
@ -96,7 +96,7 @@ void TOC::notifySetup( const QVector< KPDFPage * > & /*pages*/, bool documentCha
|
|||
emit hasTOC( true );
|
||||
}
|
||||
|
||||
void TOC::addChildren( const QDomNode & parentNode, KListViewItem * parentItem )
|
||||
void TOC::addChildren( const QDomNode & parentNode, K3ListViewItem * parentItem )
|
||||
{
|
||||
// keep track of the current listViewItem
|
||||
TOCItem * currentItem = 0;
|
||||
|
|
6
ui/toc.h
6
ui/toc.h
|
@ -11,13 +11,13 @@
|
|||
#define _KPDF_TOC_H_
|
||||
|
||||
#include <qdom.h>
|
||||
#include <klistview.h>
|
||||
#include <k3listview.h>
|
||||
#include "core/document.h"
|
||||
#include "core/observer.h"
|
||||
|
||||
class KPDFDocument;
|
||||
|
||||
class TOC : public KListView, public DocumentObserver
|
||||
class TOC : public K3ListView, public DocumentObserver
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -35,7 +35,7 @@ Q_OBJECT
|
|||
void slotExecuted(Q3ListViewItem *i);
|
||||
|
||||
private:
|
||||
void addChildren( const QDomNode & parentNode, KListViewItem * parentItem = 0 );
|
||||
void addChildren( const QDomNode & parentNode, K3ListViewItem * parentItem = 0 );
|
||||
DocumentViewport getViewport( const QDomElement &e ) const;
|
||||
KPDFDocument *m_document;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue