• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdegraphics
  • Sitemap
  • Contact Us
 

okular

action.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004-2005 by Enrico Ros <eros.kde@email.it>             *
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU General Public License as published by  *
00006  *   the Free Software Foundation; either version 2 of the License, or     *
00007  *   (at your option) any later version.                                   *
00008  ***************************************************************************/
00009 
00010 #include "action.h"
00011 
00012 // kde includes
00013 #include <klocale.h>
00014 
00015 // local includes
00016 #include "document.h"
00017 #include "sound.h"
00018 
00019 using namespace Okular;
00020 
00021 class Okular::ActionPrivate
00022 {
00023     public:
00024         ActionPrivate()
00025         {
00026         }
00027 
00028         virtual ~ActionPrivate()
00029         {
00030         }
00031 };
00032 
00033 Action::Action( ActionPrivate &dd )
00034     : d_ptr( &dd )
00035 {
00036 }
00037 
00038 Action::~Action()
00039 {
00040     delete d_ptr;
00041 }
00042 
00043 QString Action::actionTip() const
00044 {
00045     return "";
00046 }
00047 
00048 // GotoAction
00049 
00050 class Okular::GotoActionPrivate : public Okular::ActionPrivate
00051 {
00052     public:
00053         GotoActionPrivate( const QString &fileName, const DocumentViewport &viewport )
00054             : ActionPrivate(), m_extFileName( fileName ), m_vp( viewport )
00055         {
00056         }
00057 
00058         QString m_extFileName;
00059         DocumentViewport m_vp;
00060 };
00061 
00062 GotoAction::GotoAction( const QString& fileName, const DocumentViewport & viewport )
00063     : Action( *new GotoActionPrivate( fileName, viewport ) )
00064 {
00065 }
00066 
00067 GotoAction::~GotoAction()
00068 {
00069 }
00070 
00071 Action::ActionType GotoAction::actionType() const
00072 {
00073     return Goto;
00074 }
00075 
00076 QString GotoAction::actionTip() const
00077 {
00078     Q_D( const GotoAction );
00079     return d->m_extFileName.isEmpty() ? ( d->m_vp.isValid() ? i18n( "Go to page %1", d->m_vp.pageNumber + 1 ) : "" ) :
00080                                      i18n("Open external file");
00081 }
00082 
00083 bool GotoAction::isExternal() const
00084 {
00085     Q_D( const GotoAction );
00086     return !d->m_extFileName.isEmpty();
00087 }
00088 
00089 QString GotoAction::fileName() const
00090 {
00091     Q_D( const GotoAction );
00092     return d->m_extFileName;
00093 }
00094 
00095 DocumentViewport GotoAction::destViewport() const
00096 {
00097     Q_D( const GotoAction );
00098     return d->m_vp;
00099 }
00100 
00101 // ExecuteAction
00102 
00103 class Okular::ExecuteActionPrivate : public Okular::ActionPrivate
00104 {
00105     public:
00106         ExecuteActionPrivate( const QString &file, const QString & parameters )
00107             : ActionPrivate(), m_fileName( file ), m_parameters( parameters )
00108         {
00109         }
00110 
00111         QString m_fileName;
00112         QString m_parameters;
00113 };
00114 
00115 ExecuteAction::ExecuteAction( const QString &file, const QString & parameters )
00116     : Action( *new ExecuteActionPrivate( file, parameters ) )
00117 {
00118 }
00119 
00120 ExecuteAction::~ExecuteAction()
00121 {
00122 }
00123 
00124 Action::ActionType ExecuteAction::actionType() const
00125 {
00126     return Execute;
00127 }
00128 
00129 QString ExecuteAction::actionTip() const
00130 {
00131     Q_D( const Okular::ExecuteAction );
00132     return i18n( "Execute '%1'...", d->m_fileName );
00133 }
00134 
00135 QString ExecuteAction::fileName() const
00136 {
00137     Q_D( const Okular::ExecuteAction );
00138     return d->m_fileName;
00139 }
00140 
00141 QString ExecuteAction::parameters() const
00142 {
00143     Q_D( const Okular::ExecuteAction );
00144     return d->m_parameters;
00145 }
00146 
00147 // BrowseAction
00148 
00149 class Okular::BrowseActionPrivate : public Okular::ActionPrivate
00150 {
00151     public:
00152         BrowseActionPrivate( const QString &url )
00153             : ActionPrivate(), m_url( url )
00154         {
00155         }
00156 
00157         QString m_url;
00158 };
00159 
00160 BrowseAction::BrowseAction( const QString &url )
00161     : Action( *new BrowseActionPrivate( url ) )
00162 {
00163 }
00164 
00165 BrowseAction::~BrowseAction()
00166 {
00167 }
00168 
00169 Action::ActionType BrowseAction::actionType() const
00170 {
00171     return Browse;
00172 }
00173 
00174 QString BrowseAction::actionTip() const
00175 {
00176     Q_D( const Okular::BrowseAction );
00177     return d->m_url;
00178 }
00179 
00180 QString BrowseAction::url() const
00181 {
00182     Q_D( const Okular::BrowseAction );
00183     return d->m_url;
00184 }
00185 
00186 // DocumentAction
00187 
00188 class Okular::DocumentActionPrivate : public Okular::ActionPrivate
00189 {
00190     public:
00191         DocumentActionPrivate( enum DocumentAction::DocumentActionType documentActionType )
00192             : ActionPrivate(), m_type( documentActionType )
00193         {
00194         }
00195 
00196         DocumentAction::DocumentActionType m_type;
00197 };
00198 
00199 DocumentAction::DocumentAction( enum DocumentActionType documentActionType )
00200     : Action( *new DocumentActionPrivate( documentActionType ) )
00201 {
00202 }
00203 
00204 DocumentAction::~DocumentAction()
00205 {
00206 }
00207 
00208 DocumentAction::DocumentActionType DocumentAction::documentActionType() const
00209 {
00210     Q_D( const Okular::DocumentAction );
00211     return d->m_type;
00212 }
00213 
00214 Action::ActionType DocumentAction::actionType() const
00215 {
00216     return DocAction;
00217 }
00218 
00219 QString DocumentAction::actionTip() const
00220 {
00221     Q_D( const Okular::DocumentAction );
00222     switch ( d->m_type )
00223     {
00224         case PageFirst:
00225             return i18n( "First Page" );
00226         case PagePrev:
00227             return i18n( "Previous Page" );
00228         case PageNext:
00229             return i18n( "Next Page" );
00230         case PageLast:
00231             return i18n( "Last Page" );
00232         case HistoryBack:
00233             return i18n( "Back" );
00234         case HistoryForward:
00235             return i18n( "Forward" );
00236         case Quit:
00237             return i18n( "Quit" );
00238         case Presentation:
00239             return i18n( "Start Presentation" );
00240         case EndPresentation:
00241             return i18n( "End Presentation" );
00242         case Find:
00243             return i18n( "Find..." );
00244         case GoToPage:
00245             return i18n( "Go To Page..." );
00246         case Close:
00247         default: ;
00248     }
00249 
00250     return QString();
00251 }
00252 
00253 // SoundAction
00254 
00255 class Okular::SoundActionPrivate : public Okular::ActionPrivate
00256 {
00257     public:
00258         SoundActionPrivate( double volume, bool sync, bool repeat, bool mix, Okular::Sound *sound )
00259             : ActionPrivate(), m_volume( volume ), m_sync( sync ),
00260               m_repeat( repeat ), m_mix( mix ), m_sound( sound )
00261         {
00262         }
00263 
00264         ~SoundActionPrivate()
00265         {
00266             delete m_sound;
00267         }
00268 
00269         double m_volume;
00270         bool m_sync : 1;
00271         bool m_repeat : 1;
00272         bool m_mix : 1;
00273         Okular::Sound *m_sound;
00274 };
00275 
00276 SoundAction::SoundAction( double volume, bool sync, bool repeat, bool mix, Okular::Sound *sound )
00277     : Action( *new SoundActionPrivate( volume, sync, repeat, mix, sound ) )
00278 {
00279 }
00280 
00281 SoundAction::~SoundAction()
00282 {
00283 }
00284 
00285 Action::ActionType SoundAction::actionType() const
00286 {
00287     return Sound;
00288 }
00289 
00290 QString SoundAction::actionTip() const
00291 {
00292     return i18n( "Play sound..." );
00293 }
00294 
00295 double SoundAction::volume() const
00296 {
00297     Q_D( const Okular::SoundAction );
00298     return d->m_volume;
00299 }
00300 
00301 bool SoundAction::synchronous() const
00302 {
00303     Q_D( const Okular::SoundAction );
00304     return d->m_sync;
00305 }
00306 
00307 bool SoundAction::repeat() const
00308 {
00309     Q_D( const Okular::SoundAction );
00310     return d->m_repeat;
00311 }
00312 
00313 bool SoundAction::mix() const
00314 {
00315     Q_D( const Okular::SoundAction );
00316     return d->m_mix;
00317 }
00318 
00319 Okular::Sound *SoundAction::sound() const
00320 {
00321     Q_D( const Okular::SoundAction );
00322     return d->m_sound;
00323 }
00324 
00325 // MovieAction
00326 
00327 #if 0
00328 class Okular::MovieActionPrivate : public Okular::ActionPrivate
00329 {
00330     public:
00331         MovieActionPrivate()
00332             : ActionPrivate()
00333         {
00334         }
00335 };
00336 
00337 MovieAction::MovieAction()
00338     : Action( *new MovieActionPrivate() )
00339 {
00340 }
00341 
00342 MovieAction::~MovieAction()
00343 {
00344 }
00345 
00346 Action::ActionType MovieAction::actionType() const
00347 {
00348     return Movie;
00349 }
00350 
00351 QString MovieAction::actionTip() const
00352 {
00353     return i18n( "Play movie..." );
00354 }
00355 #endif

okular

Skip menu "okular"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdegraphics

Skip menu "kdegraphics"
  • okular
Generated for kdegraphics by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal