Source Code (Use browser search to find items of interest.)

Class Index

kghostview'KGVPart (./kdegraphics/kghostview/kgv_view.h:32)

class KGVPart: public KParts::ReadOnlyPart
{
  Q_OBJECT
public:
  KGVPart( QWidget *parent = 0, const char *name = 0 );
  virtual ~KGVPart();

  KGVMiniWidget *miniWidget() const { return w; }

protected:
  // reimplemented from ReadOnlyPart
  virtual bool openFile();

  void enableAllActions( bool enable );

private:
  KGVMiniWidget *w;
  KGVBrowserExtension *m_extension;

  KAction *zoomInAct, *zoomOutAct, *backAct, *forwardAct,
      *startAct, *endAct, *endDocAct, *markAct, *gotoAct;
};


kghostview'KGVPart::KGVPart() (./kdegraphics/kghostview/kgv_view.cpp:44)

KGVPart::KGVPart( QWidget *parent, const char *name )
 : KParts::ReadOnlyPart( parent, name )
{
    setInstance( KGVFactory::instance() );
    w = new KGVMiniWidget( parent );
    // Clicking or tabbing on it should make it active (required by KParts)
    w->setFocusPolicy( QWidget::StrongFocus );
    setWidget( w );

    zoomInAct = new KAction(i18n("Zoom In"),
                           QIconSet(BarIcon("viewmag+", KGVFactory::instance())),
                           0, w, SLOT(zoomIn() ), actionCollection(), "zoomIn");
    zoomOutAct = new KAction(i18n("Zoom out"),
                           QIconSet(BarIcon("viewmag-", KGVFactory::instance())),
                           0, w, SLOT(zoomOut() ), actionCollection(), "zoomOut");
    backAct = new KAction(i18n("Go back"),
                           QIconSet(BarIcon("back", KGVFactory::instance())),
                           0, w, SLOT(prevPage() ), actionCollection(), "prevPage");
    forwardAct = new KAction(i18n("Go forward"),
                           QIconSet(BarIcon("forward", KGVFactory::instance())),
                           0, w, SLOT(nextPage() ), actionCollection(), "nextPage");
    startAct = new KAction(i18n("Go to start"),
                           QIconSet(BarIcon("start", KGVFactory::instance())),
                           0, w, SLOT(goToStart() ), actionCollection(), "goToStart");
    endAct = new KAction(i18n("Go to end"),
                           QIconSet(BarIcon("finish", KGVFactory::instance())),
                           0, w, SLOT(goToEnd() ), actionCollection(), "goToEnd");
    endDocAct = new KAction(i18n("Read down document"),
                           QIconSet(BarIcon("next", KGVFactory::instance())),
                           0, w, SLOT(readDown() ), actionCollection(), "readDown");
    markAct = new KAction(i18n("Toggle this page mark"),
                           QIconSet(BarIcon("flag", KGVFactory::instance())),
                           0, w, SLOT(markPage() ), actionCollection(), "markPage");
    gotoAct = new KAction(i18n("Go to page..."),
                           QIconSet(BarIcon("page", KGVFactory::instance())),
                          0, w, SLOT(goToPage() ), actionCollection(), "goToPage");

    m_extension = new KGVBrowserExtension( this );

    setXMLFile( "kgv_part.rc" );
    enableAllActions( false ); // no document to apply the actions to, yet
}


kghostview'KGVPart::~KGVPart() (./kdegraphics/kghostview/kgv_view.cpp:87)

KGVPart::~KGVPart()
{
}


kghostview'KGVPart::enableAllActions() (./kdegraphics/kghostview/kgv_view.cpp:91)

void KGVPart::enableAllActions( bool enable )
{
  int count = actionCollection()->count();
  for ( int i = 0; i < count; i++ )
    actionCollection()->action( i )->setEnabled( enable );
}


kghostview'KGVPart::openFile() (./kdegraphics/kghostview/kgv_view.cpp:98)

bool KGVPart::openFile()
{
  w->openFile(m_file);
  enableAllActions( true );
  return true; // TODO : add return code to KGVMiniWidget::openFile
}