mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-24 18:35:37 +00:00
- Added a print action which doesn't do anything yet.
- Added KPDF::Part::closeURL(). svn path=/trunk/kdegraphics/kpdf/; revision=174621
This commit is contained in:
parent
a9652638c6
commit
788d6e3fb5
|
@ -45,7 +45,7 @@ kde_module_LTLIBRARIES = libkpdfpart.la
|
|||
# the Part's source, library search path, and link libraries
|
||||
libkpdfpart_la_SOURCES = kpdf_part.cpp kpdf_pagewidget.cc
|
||||
libkpdfpart_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
|
||||
libkpdfpart_la_LIBADD = ../xpdf/libxpdf.la $(LIB_KPARTS) $(LIB_KFILE)
|
||||
libkpdfpart_la_LIBADD = ../xpdf/libxpdf.la $(LIB_KPARTS) $(LIB_KFILE) $(LIB_KDEPRINT)
|
||||
|
||||
# this is where the desktop file will go
|
||||
partdesktopdir = $(kde_servicesdir)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <kdebug.h>
|
||||
#include <kfiledialog.h>
|
||||
#include <kinstance.h>
|
||||
#include <kprinter.h>
|
||||
#include <kstdaction.h>
|
||||
#include <kparts/genericfactory.h>
|
||||
|
||||
|
@ -31,8 +32,9 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
|
|||
const QStringList & /*args*/ )
|
||||
: KParts::ReadOnlyPart(parent, name),
|
||||
m_pagePixmap(1, 1),
|
||||
m_doc(0),
|
||||
m_currentPage(0),
|
||||
m_zoomMode(FitWidth),
|
||||
m_zoomMode(FixedFactor),
|
||||
m_zoomFactor(1.0)
|
||||
{
|
||||
globalParams = new GlobalParams("");
|
||||
|
@ -60,6 +62,7 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
|
|||
// create our actions
|
||||
KStdAction::open (this, SLOT(fileOpen()), actionCollection());
|
||||
KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
|
||||
KStdAction::print (this, SLOT(filePrint()), actionCollection());
|
||||
KStdAction::prior (this, SLOT(displayPreviousPage()),
|
||||
actionCollection(), "previous_page");
|
||||
KStdAction::next (this, SLOT(displayNextPage()),
|
||||
|
@ -90,6 +93,15 @@ Part::createAboutData()
|
|||
return aboutData;
|
||||
}
|
||||
|
||||
bool
|
||||
Part::closeURL()
|
||||
{
|
||||
delete m_doc;
|
||||
m_doc = 0;
|
||||
|
||||
return KParts::ReadOnlyPart::closeURL();
|
||||
}
|
||||
|
||||
bool
|
||||
Part::openFile()
|
||||
{
|
||||
|
@ -277,6 +289,36 @@ Part::fileSaveAs()
|
|||
*/
|
||||
}
|
||||
|
||||
void
|
||||
Part::filePrint()
|
||||
{
|
||||
if (m_doc == 0)
|
||||
return;
|
||||
|
||||
KPrinter printer;
|
||||
|
||||
printer.setPageSelection(KPrinter::ApplicationSide);
|
||||
printer.setCurrentPage(m_currentPage);
|
||||
printer.setMinMax(1, m_doc->getNumPages());
|
||||
|
||||
if (printer.setup(widget()))
|
||||
{
|
||||
/*
|
||||
KTempFile tf(QString::null, ".ps");
|
||||
if (tf.status() == 0)
|
||||
{
|
||||
savePages(tf.name(), printer.pageList());
|
||||
printer.printFiles(QStringList( tf.name() ), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Proper error handling
|
||||
;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Part::displayNextPage()
|
||||
{
|
||||
|
@ -301,7 +343,7 @@ Part::setFixedZoomFactor(float zoomFactor)
|
|||
Part::executeAction(LinkAction* action)
|
||||
{
|
||||
if (action == 0)
|
||||
return;
|
||||
return;
|
||||
|
||||
LinkActionKind kind = action->getKind();
|
||||
|
||||
|
|
|
@ -79,6 +79,8 @@ namespace KPDF
|
|||
|
||||
static KAboutData* createAboutData();
|
||||
|
||||
bool closeURL();
|
||||
|
||||
void displayPage(int pageNumber, float zoomFactor = 1.0);
|
||||
void displayDestination(LinkDest*);
|
||||
|
||||
|
@ -91,6 +93,7 @@ namespace KPDF
|
|||
protected slots:
|
||||
void fileOpen();
|
||||
void fileSaveAs();
|
||||
void filePrint();
|
||||
|
||||
void displayNextPage();
|
||||
void displayPreviousPage();
|
||||
|
@ -108,7 +111,6 @@ namespace KPDF
|
|||
|
||||
int m_currentPage;
|
||||
|
||||
// Zoom settings
|
||||
ZoomMode m_zoomMode;
|
||||
float m_zoomFactor;
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
<Action name="file_open"/>
|
||||
<Separator/>
|
||||
<Action name="file_save_as"/>
|
||||
<Separator/>
|
||||
<Action name="file_print"/>
|
||||
</Menu>
|
||||
<Menu name="view">
|
||||
<Action name="fit_width"/>
|
||||
|
|
Loading…
Reference in a new issue