Commit 14ebfddd authored by Laurent Montel's avatar Laurent Montel 😁

Add show/hide scrollbar as in kghostview

svn path=/trunk/kdegraphics/kpdf/; revision=251084
parent 5c58b576
......@@ -120,6 +120,12 @@ namespace KPDF
mutex.unlock();
}
void PageWidget::enableScrollBars( bool b )
{
setHScrollBarMode( b ? Auto : AlwaysOff );
setVScrollBarMode( b ? Auto : AlwaysOff );
}
void PageWidget::updatePixmap()
{
if ( m_doc )
......
......@@ -30,7 +30,7 @@ namespace KPDF
void setPage(int pagenum);
int getPage() const { return m_currentPage; };
void enableScrollBars( bool b );
public slots:
void nextPage();
void previousPage();
......
......@@ -59,6 +59,15 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
setWidget(pdfpartview);
m_showScrollBars = new KToggleAction( i18n( "Show &Scrollbars" ), 0,
actionCollection(), "show_scrollbars" );
m_showPageList = new KToggleAction( i18n( "Show &Page List" ), 0,
actionCollection(), "show_page_list" );
connect( m_showScrollBars, SIGNAL( toggled( bool ) ),
SLOT( showScrollBars( bool ) ) );
connect( m_showPageList, SIGNAL( toggled( bool ) ),
SLOT( showMarkList( bool ) ) );
// create our actions
KStdAction::find (this, SLOT(find()),
actionCollection(), "find");
......@@ -102,6 +111,20 @@ Part::~Part()
delete globalParams;
}
void Part::showScrollBars( bool show )
{
m_outputDev->enableScrollBars( show );
}
void Part::showMarkList( bool show )
{
#if 0
_markList->setShown( show );
_scrollBox->setShown( show );
_divider->setShown( show );
#endif
}
void Part::slotGotoEnd()
{
if ( m_doc && m_doc->getNumPages() > 0 );
......
......@@ -95,6 +95,9 @@ namespace KPDF
void executeAction(LinkAction*);
void showScrollBars( bool );
void showMarkList( bool );
private:
PDFDoc* m_doc;
PageWidget* m_outputDev;
......@@ -103,6 +106,8 @@ namespace KPDF
KAction* m_lastPage;
KAction* m_prevPage;
KAction* m_nextPage;
KToggleAction* m_showScrollBars;
KToggleAction* m_showPageList;
KToggleAction* m_fitToWidth;
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kpdf_part" version="5">
<kpartgui name="kpdf_part" version="6">
<MenuBar>
<Menu name="edit"><text>&amp;Edit</text>
<Action name="find"/>
......@@ -18,6 +18,10 @@
<Action name="previous_page"/>
<Action name="next_page"/>
</Menu>
<Menu name="settings"><text>&amp;Settings</text>
<Action name="show_scrollbars"/>
<Action name="show_page_list"/>
</Menu>
</MenuBar>
<ToolBar name="mainToolBar">
<Action name="previous_page"/>
......
......@@ -17,6 +17,7 @@
#include <kstdaction.h>
#include <kurl.h>
#include <kdebug.h>
#include <klocale.h>
using namespace KPDF;
......@@ -53,7 +54,7 @@ Shell::Shell()
{
// if we couldn't find our Part, we exit since the Shell by
// itself can't do anything useful
KMessageBox::error(this, "Could not find our Part!");
KMessageBox::error(this, i18n("Could not find our Part!"));
kapp->quit();
// we return here, cause kapp->quit() only means "exit the
// next time we enter the event loop...
......
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