Commit 30f13583 authored by Albert Astals Cid's avatar Albert Astals Cid

Adding dcop functions to gotopage, get # pages and open document (only given the full path)

svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=353886
parent e9a67263
......@@ -38,7 +38,7 @@ shellrc_DATA = kpdf_shell.rc
kde_module_LTLIBRARIES = libkpdfpart.la
# the Part's source, library search path, and link libraries
libkpdfpart_la_SOURCES = QOutputDev.cpp QOutputDevKPrinter.cpp kpdf_part.cpp pixmapwidget.cpp pageview.cpp thumbnaillist.cpp kpdf_error.cpp xpdf_errors.cpp thumbnailgenerator.cpp document.cpp page.cpp searchwidget.cpp toc.cpp
libkpdfpart_la_SOURCES = QOutputDev.cpp QOutputDevKPrinter.cpp kpdf_part.cpp pixmapwidget.cpp pageview.cpp thumbnaillist.cpp kpdf_error.cpp xpdf_errors.cpp thumbnailgenerator.cpp document.cpp page.cpp searchwidget.cpp toc.cpp kpdf_dcop.skel
libkpdfpart_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
libkpdfpart_la_LIBADD = ../xpdf/libxpdf.la $(LIB_KPARTS) $(LIB_KFILE) $(LIB_KDEPRINT) $(LIB_KUTILS) -lm
......
......@@ -34,6 +34,7 @@ Porting / In progress on the branch (first item comes first):
-> pageview: fix keys/mouse in single/continous modes
Done (newest feature comes firts):
-> ADD: Some dcop functions (goToPage, openDocument and give # of pages) (Albert)
-> MRG: link following ('actionMovie' kind is missing)
-> ADD: text selection (rectangular blocks) in selection mode
-> ADD: autoscroll page with Shift+Up/Dn keys (exact konqueror's behavior)
......
/***************************************************************************
* Copyright (C) 2004 by Albert Astals Cid <tsdgeos@terra.es> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef MY_INTERFACE_H
#define MY_INTERFACE_H
#include <dcopobject.h>
#include <kurl.h>
class kpdf_dcop : virtual public DCOPObject
{
K_DCOP
k_dcop:
virtual ASYNC goToPage(uint page) = 0;
virtual ASYNC openDocument(KURL doc) = 0;
virtual uint pages() = 0;
};
#endif
......@@ -29,6 +29,7 @@
#include <qtoolbox.h>
#include <qpushbutton.h>
#include <dcopobject.h>
#include <kaction.h>
#include <kinstance.h>
#include <kprinter.h>
......@@ -66,7 +67,7 @@ unsigned int Part::m_count = 0;
Part::Part(QWidget *parentWidget, const char *widgetName,
QObject *parent, const char *name,
const QStringList & /*args*/ )
: KParts::ReadOnlyPart(parent, name)
: DCOPObject("kpdf"), KParts::ReadOnlyPart(parent, name)
{
// create browser extension (for printing when embedded into browser)
new BrowserExtension(this);
......@@ -204,6 +205,22 @@ Part::~Part()
delete globalParams;
}
void Part::goToPage(uint i)
{
if (i <= document->pages())
document->slotSetCurrentPage( i - 1 );
}
void Part::openDocument(KURL doc)
{
openURL(doc);
}
uint Part::pages()
{
return document->pages();
}
//this don't go anywhere but is required by genericfactory.h
KAboutData* Part::createAboutData()
{
......
......@@ -19,6 +19,8 @@
#include <kparts/browserextension.h>
#include <kparts/part.h>
#include "kpdf_dcop.h"
class QWidget;
class QSplitter;
class QToolBox;
......@@ -50,7 +52,7 @@ class BrowserExtension;
* @author Wilco Greven <greven@kde.org>
* @version 0.2
*/
class Part : public KParts::ReadOnlyPart
class Part : public KParts::ReadOnlyPart, virtual public kpdf_dcop
{
Q_OBJECT
......@@ -63,6 +65,10 @@ public:
~Part();
static KAboutData* createAboutData();
ASYNC goToPage(uint page);
ASYNC openDocument(KURL doc);
uint pages();
protected:
// reimplemented from KParts::ReadOnlyPart
......
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