summaryrefslogtreecommitdiff
path: root/noncore/unsupported/qpdf/qpdf.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/qpdf/qpdf.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/qpdf/qpdf.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/noncore/unsupported/qpdf/qpdf.cpp b/noncore/unsupported/qpdf/qpdf.cpp
index 5cdcccf..75e86d0 100644
--- a/noncore/unsupported/qpdf/qpdf.cpp
+++ b/noncore/unsupported/qpdf/qpdf.cpp
@@ -64,107 +64,107 @@ int main ( int argc, char **argv )
64 64
65QPdfDlg::QPdfDlg ( ) : QMainWindow ( ) 65QPdfDlg::QPdfDlg ( ) : QMainWindow ( )
66{ 66{
67 setCaption ( tr( "QPdf" )); 67 setCaption ( tr( "QPdf" ));
68 setIcon ( Resource::loadPixmap ( "qpdf_icon" )); 68 setIcon ( Resource::loadPixmap ( "qpdf_icon" ));
69 69
70 m_busy = false; 70 m_busy = false;
71 71
72 m_doc = 0; 72 m_doc = 0;
73 m_pages = 0; 73 m_pages = 0;
74 m_zoom = 72; 74 m_zoom = 72;
75 m_currentpage = 0; 75 m_currentpage = 0;
76 76
77 m_fullscreen = false; 77 m_fullscreen = false;
78 m_renderok = false; 78 m_renderok = false;
79 79
80 80
81 setToolBarsMovable ( false ); 81 setToolBarsMovable ( false );
82 82
83 m_stack = new QWidgetStack ( this ); 83 m_stack = new QWidgetStack ( this );
84 m_stack-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding )); 84 m_stack-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding ));
85 setCentralWidget ( m_stack ); 85 setCentralWidget ( m_stack );
86 86
87 m_outdev = new QPEOutputDev ( m_stack ); 87 m_outdev = new QPEOutputDev ( m_stack );
88 connect ( m_outdev, SIGNAL( selectionChanged ( const QRect & )), this, SLOT( copyToClipboard ( const QRect & ))); 88 connect ( m_outdev, SIGNAL( selectionChanged(const QRect&)), this, SLOT( copyToClipboard(const QRect&)));
89 89
90#ifdef QPDF_QPE_ONLY 90#ifdef QPDF_QPE_ONLY
91 m_filesel = new FileSelector ( "application/pdf", m_stack, "fs", false, true ); 91 m_filesel = new FileSelector ( "application/pdf", m_stack, "fs", false, true );
92#else 92#else
93 m_filesel = new OFileSelector ( "application/pdf", m_stack, "fs", false, true ); 93 m_filesel = new OFileSelector ( "application/pdf", m_stack, "fs", false, true );
94#endif 94#endif
95 95
96 connect ( m_filesel, SIGNAL( closeMe ( )), this, SLOT( closeFileSelector ( ))); 96 connect ( m_filesel, SIGNAL( closeMe()), this, SLOT( closeFileSelector()));
97 connect ( m_filesel, SIGNAL( fileSelected ( const DocLnk & )), this, SLOT( openFile ( const DocLnk & ))); 97 connect ( m_filesel, SIGNAL( fileSelected(const DocLnk&)), this, SLOT( openFile(const DocLnk&)));
98 98
99 m_tb_menu = new QToolBar ( this ); 99 m_tb_menu = new QToolBar ( this );
100 m_tb_menu-> setHorizontalStretchable ( true ); 100 m_tb_menu-> setHorizontalStretchable ( true );
101 101
102 QMenuBar *mb = new QMenuBar ( m_tb_menu ); 102 QMenuBar *mb = new QMenuBar ( m_tb_menu );
103 103
104 m_pm_zoom = new QPopupMenu ( mb ); 104 m_pm_zoom = new QPopupMenu ( mb );
105 m_pm_zoom-> setCheckable ( true ); 105 m_pm_zoom-> setCheckable ( true );
106 106
107 mb-> insertItem ( tr( "Zoom" ), m_pm_zoom ); 107 mb-> insertItem ( tr( "Zoom" ), m_pm_zoom );
108 108
109 m_pm_zoom-> insertItem ( tr( "Fit to width" ), 1 ); 109 m_pm_zoom-> insertItem ( tr( "Fit to width" ), 1 );
110 m_pm_zoom-> insertItem ( tr( "Fit to page" ), 2 ); 110 m_pm_zoom-> insertItem ( tr( "Fit to page" ), 2 );
111 m_pm_zoom-> insertSeparator ( ); 111 m_pm_zoom-> insertSeparator ( );
112 m_pm_zoom-> insertItem ( tr( "50%" ), 50 ); 112 m_pm_zoom-> insertItem ( tr( "50%" ), 50 );
113 m_pm_zoom-> insertItem ( tr( "75%" ), 75 ); 113 m_pm_zoom-> insertItem ( tr( "75%" ), 75 );
114 m_pm_zoom-> insertItem ( tr( "100%" ), 100 ); 114 m_pm_zoom-> insertItem ( tr( "100%" ), 100 );
115 m_pm_zoom-> insertItem ( tr( "125%" ), 125 ); 115 m_pm_zoom-> insertItem ( tr( "125%" ), 125 );
116 m_pm_zoom-> insertItem ( tr( "150%" ), 150 ); 116 m_pm_zoom-> insertItem ( tr( "150%" ), 150 );
117 m_pm_zoom-> insertItem ( tr( "200%" ), 200 ); 117 m_pm_zoom-> insertItem ( tr( "200%" ), 200 );
118 118
119 connect ( m_pm_zoom, SIGNAL( activated ( int )), this, SLOT( setZoom ( int ))); 119 connect ( m_pm_zoom, SIGNAL( activated(int)), this, SLOT( setZoom(int)));
120 120
121 m_tb_tool = new QToolBar ( this ); 121 m_tb_tool = new QToolBar ( this );
122 122
123 new QToolButton ( Resource::loadIconSet ( "fileopen" ), tr( "Open..." ), QString::null, this, SLOT( openFile ( )), m_tb_tool, "open" ); 123 new QToolButton ( Resource::loadIconSet ( "fileopen" ), tr( "Open..." ), QString::null, this, SLOT( openFile()), m_tb_tool, "open" );
124 m_tb_tool-> addSeparator ( ); 124 m_tb_tool-> addSeparator ( );
125 m_to_find = new QToolButton ( Resource::loadIconSet ( "find" ), tr( "Find..." ), QString::null, this, SLOT( toggleFindBar ( )), m_tb_tool, "find" ); 125 m_to_find = new QToolButton ( Resource::loadIconSet ( "find" ), tr( "Find..." ), QString::null, this, SLOT( toggleFindBar()), m_tb_tool, "find" );
126 m_to_find-> setToggleButton ( true ); 126 m_to_find-> setToggleButton ( true );
127 m_tb_tool-> addSeparator ( ); 127 m_tb_tool-> addSeparator ( );
128 m_to_full = new QToolButton ( Resource::loadIconSet ( "fullscreen" ), tr( "Fullscreen" ), QString::null, this, SLOT( toggleFullscreen ( )), m_tb_tool, "fullscreen" ); 128 m_to_full = new QToolButton ( Resource::loadIconSet ( "fullscreen" ), tr( "Fullscreen" ), QString::null, this, SLOT( toggleFullscreen()), m_tb_tool, "fullscreen" );
129 m_to_full-> setToggleButton ( true ); 129 m_to_full-> setToggleButton ( true );
130 m_tb_tool-> addSeparator ( ); 130 m_tb_tool-> addSeparator ( );
131 new QToolButton ( Resource::loadIconSet ( "fastback" ), tr( "First page" ), QString::null, this, SLOT( firstPage ( )), m_tb_tool, "first" ); 131 new QToolButton ( Resource::loadIconSet ( "fastback" ), tr( "First page" ), QString::null, this, SLOT( firstPage()), m_tb_tool, "first" );
132 new QToolButton ( Resource::loadIconSet ( "back" ), tr( "Previous page" ), QString::null, this, SLOT( prevPage ( )), m_tb_tool, "prev" ); 132 new QToolButton ( Resource::loadIconSet ( "back" ), tr( "Previous page" ), QString::null, this, SLOT( prevPage()), m_tb_tool, "prev" );
133 new QToolButton ( Resource::loadIconSet ( "down" ), tr( "Goto page..." ), QString::null, this, SLOT( gotoPageDialog ( )), m_tb_tool, "goto" ); 133 new QToolButton ( Resource::loadIconSet ( "down" ), tr( "Goto page..." ), QString::null, this, SLOT( gotoPageDialog()), m_tb_tool, "goto" );
134 new QToolButton ( Resource::loadIconSet ( "forward" ), tr( "Next page" ), QString::null, this, SLOT( nextPage ( )), m_tb_tool, "next" ); 134 new QToolButton ( Resource::loadIconSet ( "forward" ), tr( "Next page" ), QString::null, this, SLOT( nextPage()), m_tb_tool, "next" );
135 new QToolButton ( Resource::loadIconSet ( "fastforward" ), tr( "Last page" ), QString::null, this, SLOT( lastPage ( )), m_tb_tool, "last" ); 135 new QToolButton ( Resource::loadIconSet ( "fastforward" ), tr( "Last page" ), QString::null, this, SLOT( lastPage()), m_tb_tool, "last" );
136 136
137 m_tb_find = new QToolBar ( this ); 137 m_tb_find = new QToolBar ( this );
138 addToolBar ( m_tb_find, "Search", QMainWindow::Top, true ); 138 addToolBar ( m_tb_find, "Search", QMainWindow::Top, true );
139 m_tb_find-> setHorizontalStretchable ( true ); 139 m_tb_find-> setHorizontalStretchable ( true );
140 m_tb_find-> hide ( ); 140 m_tb_find-> hide ( );
141 141
142 m_findedit = new QLineEdit ( m_tb_find, "findedit" ); 142 m_findedit = new QLineEdit ( m_tb_find, "findedit" );
143 m_tb_find-> setStretchableWidget ( m_findedit ); 143 m_tb_find-> setStretchableWidget ( m_findedit );
144 connect ( m_findedit, SIGNAL( textChanged ( const QString & )), this, SLOT( findText ( const QString & ))); 144 connect ( m_findedit, SIGNAL( textChanged(const QString&)), this, SLOT( findText(const QString&)));
145 145
146 new QToolButton ( Resource::loadIconSet ( "next" ), tr( "Next" ), QString::null, this, SLOT( findText ( )), m_tb_find, "findnext" ); 146 new QToolButton ( Resource::loadIconSet ( "next" ), tr( "Next" ), QString::null, this, SLOT( findText()), m_tb_find, "findnext" );
147 147
148 openFile ( ); 148 openFile ( );
149} 149}
150 150
151QPdfDlg::~QPdfDlg ( ) 151QPdfDlg::~QPdfDlg ( )
152{ 152{
153 delete m_doc; 153 delete m_doc;
154} 154}
155 155
156// vv Fullscreen handling (for broken QT-lib) [David Hedbor, www.eongames.com] 156// vv Fullscreen handling (for broken QT-lib) [David Hedbor, www.eongames.com]
157 157
158void QPdfDlg::resizeEvent ( QResizeEvent * ) 158void QPdfDlg::resizeEvent ( QResizeEvent * )
159{ 159{
160 if ( m_fullscreen && ( size ( ) != qApp-> desktop ( )-> size ( ))) 160 if ( m_fullscreen && ( size ( ) != qApp-> desktop ( )-> size ( )))
161 setFullscreen ( true ); 161 setFullscreen ( true );
162} 162}
163 163
164void QPdfDlg::focusInEvent ( QFocusEvent * ) 164void QPdfDlg::focusInEvent ( QFocusEvent * )
165{ 165{
166 if ( m_fullscreen ) 166 if ( m_fullscreen )
167 setFullscreen ( true ); 167 setFullscreen ( true );
168} 168}
169 169
170void QPdfDlg::toggleFullscreen ( ) 170void QPdfDlg::toggleFullscreen ( )
@@ -474,49 +474,49 @@ void QPdfDlg::openFile ( const QString &f )
474 QFileInfo fi ( f ); 474 QFileInfo fi ( f );
475 nf. setName ( fi. baseName ( )); 475 nf. setName ( fi. baseName ( ));
476 openFile ( nf ); 476 openFile ( nf );
477} 477}
478 478
479void QPdfDlg::openFile ( const DocLnk &f ) 479void QPdfDlg::openFile ( const DocLnk &f )
480{ 480{
481 QString fn = f. file ( ); 481 QString fn = f. file ( );
482 QFileInfo fi ( fn ); 482 QFileInfo fi ( fn );
483 483
484 if ( fi. exists ( )) { 484 if ( fi. exists ( )) {
485 delete m_doc; 485 delete m_doc;
486 486
487 m_doc = new PDFDoc ( new GString ( fn. local8Bit ( )), 0, 0 ); 487 m_doc = new PDFDoc ( new GString ( fn. local8Bit ( )), 0, 0 );
488 488
489 if ( m_doc-> isOk ( )) { 489 if ( m_doc-> isOk ( )) {
490 m_currentdoc = f. name ( ); 490 m_currentdoc = f. name ( );
491 int sep = m_currentdoc. findRev ( '/' ); 491 int sep = m_currentdoc. findRev ( '/' );
492 if ( sep > 0 ) 492 if ( sep > 0 )
493 m_currentdoc = m_currentdoc. mid ( sep + 1 ); 493 m_currentdoc = m_currentdoc. mid ( sep + 1 );
494 494
495 m_pages = m_doc-> getNumPages ( ); 495 m_pages = m_doc-> getNumPages ( );
496 m_currentpage = 0; 496 m_currentpage = 0;
497 497
498 QTimer::singleShot ( 0, this, SLOT( delayedInit ( ))); 498 QTimer::singleShot ( 0, this, SLOT( delayedInit()));
499 } 499 }
500 else { 500 else {
501 delete m_doc; 501 delete m_doc;
502 m_doc = 0; 502 m_doc = 0;
503 503
504 m_currentdoc = QString::null; 504 m_currentdoc = QString::null;
505 } 505 }
506 506
507 updateCaption ( ); 507 updateCaption ( );
508 } 508 }
509 else 509 else
510 QMessageBox::warning ( this, tr( "Error" ), tr( "File does not exist!" )); 510 QMessageBox::warning ( this, tr( "Error" ), tr( "File does not exist!" ));
511} 511}
512 512
513void QPdfDlg::setDocument ( const QString &f ) 513void QPdfDlg::setDocument ( const QString &f )
514{ 514{
515 if ( f. find ( ".desktop", 0, true ) == -1 ) 515 if ( f. find ( ".desktop", 0, true ) == -1 )
516 openFile ( f ); 516 openFile ( f );
517 else 517 else
518 openFile ( DocLnk ( f )); 518 openFile ( DocLnk ( f ));
519 519
520 closeFileSelector ( ); 520 closeFileSelector ( );
521} 521}
522 522