-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.cpp | 24 | ||||
-rw-r--r-- | noncore/apps/opie-reader/fileBrowser.cpp | 8 |
2 files changed, 16 insertions, 16 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index e759249..b0d589e 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp | |||
@@ -236,317 +236,317 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
236 | } | 236 | } |
237 | else if (rot.contains("Rot180")) | 237 | else if (rot.contains("Rot180")) |
238 | { | 238 | { |
239 | m_rot = 180; | 239 | m_rot = 180; |
240 | } | 240 | } |
241 | else if (rot.contains("Rot270")) | 241 | else if (rot.contains("Rot270")) |
242 | { | 242 | { |
243 | m_rot = 270; | 243 | m_rot = 270; |
244 | } | 244 | } |
245 | 245 | ||
246 | // qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot); | 246 | // qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot); |
247 | */ | 247 | */ |
248 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; | 248 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; |
249 | 249 | ||
250 | #ifdef USEQPE | 250 | #ifdef USEQPE |
251 | setIcon( Resource::loadPixmap( PICDIR "uqtreader") ); | 251 | setIcon( Resource::loadPixmap( PICDIR "uqtreader") ); |
252 | #else | 252 | #else |
253 | setIcon( QPixmap (PICDIR "uqtreader.png") ); | 253 | setIcon( QPixmap (PICDIR "uqtreader.png") ); |
254 | #endif /* USEQPE */ | 254 | #endif /* USEQPE */ |
255 | 255 | ||
256 | // QToolBar *bar = new QToolBar( this ); | 256 | // QToolBar *bar = new QToolBar( this ); |
257 | // menubar = new QToolBar( this ); | 257 | // menubar = new QToolBar( this ); |
258 | #ifdef USEQPE | 258 | #ifdef USEQPE |
259 | Config config( APPDIR ); | 259 | Config config( APPDIR ); |
260 | #else | 260 | #else |
261 | QDir d = QDir::home(); // "/" | 261 | QDir d = QDir::home(); // "/" |
262 | if ( !d.cd(APPDIR) ) { // "/tmp" | 262 | if ( !d.cd(APPDIR) ) { // "/tmp" |
263 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 263 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); |
264 | d = QDir::home(); | 264 | d = QDir::home(); |
265 | d.mkdir(APPDIR); | 265 | d.mkdir(APPDIR); |
266 | d.cd(APPDIR); | 266 | d.cd(APPDIR); |
267 | } | 267 | } |
268 | QFileInfo fi(d, INIFILE); | 268 | QFileInfo fi(d, INIFILE); |
269 | // qDebug("Path:%s", (const char*)fi.absFilePath()); | 269 | // qDebug("Path:%s", (const char*)fi.absFilePath()); |
270 | Config config(fi.absFilePath()); | 270 | Config config(fi.absFilePath()); |
271 | #endif | 271 | #endif |
272 | config.setGroup("Toolbar"); | 272 | config.setGroup("Toolbar"); |
273 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); | 273 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); |
274 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); | 274 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); |
275 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); | 275 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); |
276 | menubar = new QToolBar("Menus", this, m_tbposition); | 276 | menubar = new QToolBar("Menus", this, m_tbposition); |
277 | 277 | ||
278 | // fileBar = new QToolBar("File", this); | 278 | // fileBar = new QToolBar("File", this); |
279 | // QToolBar* viewBar = new QToolBar("File", this); | 279 | // QToolBar* viewBar = new QToolBar("File", this); |
280 | // QToolBar* navBar = new QToolBar("File", this); | 280 | // QToolBar* navBar = new QToolBar("File", this); |
281 | // QToolBar* markBar = new QToolBar("File", this); | 281 | // QToolBar* markBar = new QToolBar("File", this); |
282 | 282 | ||
283 | #ifdef USEQPE | 283 | #ifdef USEQPE |
284 | mb = new QMenuBar( menubar ); | 284 | mb = new QMenuBar( menubar ); |
285 | #else | 285 | #else |
286 | mb = new QMenuBar( menubar ); | 286 | mb = new QMenuBar( menubar ); |
287 | #endif | 287 | #endif |
288 | 288 | ||
289 | //#ifdef USEQPE | 289 | //#ifdef USEQPE |
290 | QPopupMenu* tmp = new QPopupMenu(mb); | 290 | QPopupMenu* tmp = new QPopupMenu(mb); |
291 | mb->insertItem( geticon( "AppsIcon" ), tmp ); | 291 | mb->insertItem( geticon( "AppsIcon" ), tmp ); |
292 | //#else | 292 | //#else |
293 | // QMenuBar* tmp = mb; | 293 | // QMenuBar* tmp = mb; |
294 | //#endif | 294 | //#endif |
295 | 295 | ||
296 | QPopupMenu *file = new QPopupMenu( mb ); | 296 | QPopupMenu *file = new QPopupMenu( mb ); |
297 | tmp->insertItem( tr( "File" ), file ); | 297 | tmp->insertItem( tr( "File" ), file ); |
298 | 298 | ||
299 | QPopupMenu *navigation = new QPopupMenu(mb); | 299 | QPopupMenu *navigation = new QPopupMenu(mb); |
300 | tmp->insertItem( tr( "Navigation" ), navigation ); | 300 | tmp->insertItem( tr( "Navigation" ), navigation ); |
301 | 301 | ||
302 | QPopupMenu *view = new QPopupMenu( mb ); | 302 | QPopupMenu *view = new QPopupMenu( mb ); |
303 | tmp->insertItem( tr( "View" ), view ); | 303 | tmp->insertItem( tr( "View" ), view ); |
304 | 304 | ||
305 | QPopupMenu *marks = new QPopupMenu( this ); | 305 | QPopupMenu *marks = new QPopupMenu( this ); |
306 | tmp->insertItem( tr( "Marks" ), marks ); | 306 | tmp->insertItem( tr( "Marks" ), marks ); |
307 | 307 | ||
308 | QPopupMenu *settings = new QPopupMenu( this ); | 308 | QPopupMenu *settings = new QPopupMenu( this ); |
309 | tmp->insertItem( tr( "Settings" ), settings ); | 309 | tmp->insertItem( tr( "Settings" ), settings ); |
310 | 310 | ||
311 | // addToolBar(menubar, "Menus",QMainWindow::Top); | 311 | // addToolBar(menubar, "Menus",QMainWindow::Top); |
312 | // addToolBar(fileBar, "Toolbar",QMainWindow::Top); | 312 | // addToolBar(fileBar, "Toolbar",QMainWindow::Top); |
313 | 313 | ||
314 | // QPopupMenu *edit = new QPopupMenu( this ); | 314 | // QPopupMenu *edit = new QPopupMenu( this ); |
315 | 315 | ||
316 | /* | 316 | /* |
317 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 317 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
318 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 318 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
319 | a->addTo( bar ); | 319 | a->addTo( bar ); |
320 | a->addTo( file ); | 320 | a->addTo( file ); |
321 | */ | 321 | */ |
322 | 322 | ||
323 | editorStack = new QWidgetStack( this ); | 323 | editorStack = new QWidgetStack( this ); |
324 | setCentralWidget( editorStack ); | 324 | setCentralWidget( editorStack ); |
325 | 325 | ||
326 | searchVisible = FALSE; | 326 | searchVisible = FALSE; |
327 | regVisible = FALSE; | 327 | regVisible = FALSE; |
328 | m_fontVisible = false; | 328 | m_fontVisible = false; |
329 | 329 | ||
330 | m_annoWin = new CAnnoEdit(editorStack); | 330 | m_annoWin = new CAnnoEdit(editorStack); |
331 | editorStack->addWidget(m_annoWin, get_unique_id()); | 331 | editorStack->addWidget(m_annoWin, get_unique_id()); |
332 | connect( m_annoWin, SIGNAL( finished(const QString&, const QString&) ), this, SLOT( addAnno(const QString&, const QString&) ) ); | 332 | connect( m_annoWin, SIGNAL( finished(const QString&,const QString&) ), this, SLOT( addAnno(const QString&,const QString&) ) ); |
333 | connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) ); | 333 | connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) ); |
334 | 334 | ||
335 | m_infoWin = new infowin(editorStack); | 335 | m_infoWin = new infowin(editorStack); |
336 | editorStack->addWidget(m_infoWin, get_unique_id()); | 336 | editorStack->addWidget(m_infoWin, get_unique_id()); |
337 | connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) ); | 337 | connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) ); |
338 | 338 | ||
339 | m_graphicwin = new GraphicWin(editorStack); | 339 | m_graphicwin = new GraphicWin(editorStack); |
340 | editorStack->addWidget(m_graphicwin, get_unique_id()); | 340 | editorStack->addWidget(m_graphicwin, get_unique_id()); |
341 | connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); | 341 | connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); |
342 | 342 | ||
343 | // bkmkselector = new QListBox(editorStack, "Bookmarks"); | 343 | // bkmkselector = new QListBox(editorStack, "Bookmarks"); |
344 | bkmkselector = new CBkmkSelector(editorStack, "Bookmarks"); | 344 | bkmkselector = new CBkmkSelector(editorStack, "Bookmarks"); |
345 | // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) ); | 345 | // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) ); |
346 | connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) ); | 346 | connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) ); |
347 | connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); | 347 | connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); |
348 | editorStack->addWidget( bkmkselector, get_unique_id() ); | 348 | editorStack->addWidget( bkmkselector, get_unique_id() ); |
349 | 349 | ||
350 | /* | 350 | /* |
351 | importSelector = new FileSelector( "*", editorStack, "importselector", false ); | 351 | importSelector = new FileSelector( "*", editorStack, "importselector", false ); |
352 | connect( importSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( importFile( const DocLnk & ) ) ); | 352 | connect( importSelector, SIGNAL( fileSelected(const DocLnk&) ), this, SLOT( importFile(const DocLnk&) ) ); |
353 | 353 | ||
354 | editorStack->addWidget( importSelector, get_unique_id() ); | 354 | editorStack->addWidget( importSelector, get_unique_id() ); |
355 | 355 | ||
356 | // don't need the close visible, it is redundant... | 356 | // don't need the close visible, it is redundant... |
357 | importSelector->setCloseVisible( FALSE ); | 357 | importSelector->setCloseVisible( FALSE ); |
358 | */ | 358 | */ |
359 | // qDebug("Reading file list"); | 359 | // qDebug("Reading file list"); |
360 | readfilelist(); | 360 | readfilelist(); |
361 | 361 | ||
362 | reader = new QTReader( editorStack ); | 362 | reader = new QTReader( editorStack ); |
363 | 363 | ||
364 | reader->bDoUpdates = false; | 364 | reader->bDoUpdates = false; |
365 | 365 | ||
366 | #ifdef USEQPE | 366 | #ifdef USEQPE |
367 | ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); | 367 | ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); |
368 | #endif | 368 | #endif |
369 | 369 | ||
370 | // qDebug("Reading config"); | 370 | // qDebug("Reading config"); |
371 | // Config config( APPDIR ); | 371 | // Config config( APPDIR ); |
372 | config.setGroup( "View" ); | 372 | config.setGroup( "View" ); |
373 | m_debounce = config.readNumEntry("Debounce", 0); | 373 | m_debounce = config.readNumEntry("Debounce", 0); |
374 | #ifdef USEQPE | 374 | #ifdef USEQPE |
375 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); | 375 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); |
376 | #else | 376 | #else |
377 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); | 377 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); |
378 | #endif | 378 | #endif |
379 | reader->bstripcr = config.readBoolEntry( "StripCr", true ); | 379 | reader->bstripcr = config.readBoolEntry( "StripCr", true ); |
380 | reader->bfulljust = config.readBoolEntry( "FullJust", false ); | 380 | reader->bfulljust = config.readBoolEntry( "FullJust", false ); |
381 | reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); | 381 | reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); |
382 | reader->setlead(config.readNumEntry( "ExtraLead", 0 )); | 382 | reader->setlead(config.readNumEntry( "ExtraLead", 0 )); |
383 | reader->btextfmt = config.readBoolEntry( "TextFmt", false ); | 383 | reader->btextfmt = config.readBoolEntry( "TextFmt", false ); |
384 | reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); | 384 | reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); |
385 | reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); | 385 | reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); |
386 | reader->bpeanut = config.readBoolEntry( "Peanut", false ); | 386 | reader->bpeanut = config.readBoolEntry( "Peanut", false ); |
387 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); | 387 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); |
388 | reader->bdepluck = config.readBoolEntry( "Depluck", false ); | 388 | reader->bdepluck = config.readBoolEntry( "Depluck", false ); |
389 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); | 389 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); |
390 | reader->bonespace = config.readBoolEntry( "OneSpace", false ); | 390 | reader->bonespace = config.readBoolEntry( "OneSpace", false ); |
391 | reader->bunindent = config.readBoolEntry( "Unindent", false ); | 391 | reader->bunindent = config.readBoolEntry( "Unindent", false ); |
392 | reader->brepara = config.readBoolEntry( "Repara", false ); | 392 | reader->brepara = config.readBoolEntry( "Repara", false ); |
393 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); | 393 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); |
394 | reader->bindenter = config.readNumEntry( "Indent", 0 ); | 394 | reader->bindenter = config.readNumEntry( "Indent", 0 ); |
395 | reader->m_textsize = config.readNumEntry( "FontSize", 12 ); | 395 | reader->m_textsize = config.readNumEntry( "FontSize", 12 ); |
396 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); | 396 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); |
397 | reader->m_lastfile = config.readEntry( "LastFile", QString::null ); | 397 | reader->m_lastfile = config.readEntry( "LastFile", QString::null ); |
398 | reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); | 398 | reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); |
399 | reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); | 399 | reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); |
400 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); | 400 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); |
401 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false); | 401 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false); |
402 | reader->m_fontname = config.readEntry( "Fontname", "helvetica" ); | 402 | reader->m_fontname = config.readEntry( "Fontname", "helvetica" ); |
403 | reader->m_encd = config.readNumEntry( "Encoding", 0 ); | 403 | reader->m_encd = config.readNumEntry( "Encoding", 0 ); |
404 | reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); | 404 | reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); |
405 | reader->m_overlap = config.readNumEntry( "Overlap", 0 ); | 405 | reader->m_overlap = config.readNumEntry( "Overlap", 0 ); |
406 | reader->m_border = config.readNumEntry( "Margin", 6 ); | 406 | reader->m_border = config.readNumEntry( "Margin", 6 ); |
407 | #ifdef REPALM | 407 | #ifdef REPALM |
408 | reader->brepalm = config.readBoolEntry( "Repalm", true ); | 408 | reader->brepalm = config.readBoolEntry( "Repalm", true ); |
409 | #endif | 409 | #endif |
410 | reader->bremap = config.readBoolEntry( "Remap", true ); | 410 | reader->bremap = config.readBoolEntry( "Remap", true ); |
411 | reader->bmakebold = config.readBoolEntry( "MakeBold", false ); | 411 | reader->bmakebold = config.readBoolEntry( "MakeBold", false ); |
412 | reader->setContinuous(config.readBoolEntry( "Continuous", true )); | 412 | reader->setContinuous(config.readBoolEntry( "Continuous", true )); |
413 | m_targetapp = config.readEntry( "TargetApp", QString::null ); | 413 | m_targetapp = config.readEntry( "TargetApp", QString::null ); |
414 | m_targetmsg = config.readEntry( "TargetMsg", QString::null ); | 414 | m_targetmsg = config.readEntry( "TargetMsg", QString::null ); |
415 | #ifdef _SCROLLPIPE | 415 | #ifdef _SCROLLPIPE |
416 | reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); | 416 | reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); |
417 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); | 417 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); |
418 | #endif | 418 | #endif |
419 | m_twoTouch = config.readBoolEntry( "TwoTouch", false); | 419 | m_twoTouch = config.readBoolEntry( "TwoTouch", false); |
420 | m_doAnnotation = config.readBoolEntry( "Annotation", false); | 420 | m_doAnnotation = config.readBoolEntry( "Annotation", false); |
421 | m_doDictionary = config.readBoolEntry( "Dictionary", false); | 421 | m_doDictionary = config.readBoolEntry( "Dictionary", false); |
422 | m_doClipboard = config.readBoolEntry( "Clipboard", false); | 422 | m_doClipboard = config.readBoolEntry( "Clipboard", false); |
423 | m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); | 423 | m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); |
424 | m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); | 424 | m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); |
425 | m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); | 425 | m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); |
426 | m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); | 426 | m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); |
427 | m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); | 427 | m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); |
428 | m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); | 428 | m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); |
429 | m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); | 429 | m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); |
430 | 430 | ||
431 | m_leftScroll = config.readBoolEntry("LeftScroll", false); | 431 | m_leftScroll = config.readBoolEntry("LeftScroll", false); |
432 | m_rightScroll = config.readBoolEntry("RightScroll", false); | 432 | m_rightScroll = config.readBoolEntry("RightScroll", false); |
433 | m_upScroll = config.readBoolEntry("UpScroll", true); | 433 | m_upScroll = config.readBoolEntry("UpScroll", true); |
434 | m_downScroll = config.readBoolEntry("DownScroll", true); | 434 | m_downScroll = config.readBoolEntry("DownScroll", true); |
435 | 435 | ||
436 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false); | 436 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false); |
437 | reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); | 437 | reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); |
438 | 438 | ||
439 | #ifndef USEQPE | 439 | #ifndef USEQPE |
440 | config.setGroup( "Geometry" ); | 440 | config.setGroup( "Geometry" ); |
441 | setGeometry(0,0, | 441 | setGeometry(0,0, |
442 | config.readNumEntry( "width", QApplication::desktop()->width()/2 ), | 442 | config.readNumEntry( "width", QApplication::desktop()->width()/2 ), |
443 | config.readNumEntry( "height", QApplication::desktop()->height()/2 )); | 443 | config.readNumEntry( "height", QApplication::desktop()->height()/2 )); |
444 | move( | 444 | move( |
445 | config.readNumEntry( "x", 20 ), | 445 | config.readNumEntry( "x", 20 ), |
446 | config.readNumEntry( "y", 20 )); | 446 | config.readNumEntry( "y", 20 )); |
447 | #endif | 447 | #endif |
448 | 448 | ||
449 | 449 | ||
450 | 450 | ||
451 | setTwoTouch(m_twoTouch); | 451 | setTwoTouch(m_twoTouch); |
452 | 452 | ||
453 | connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) ); | 453 | connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) ); |
454 | 454 | ||
455 | connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) ); | 455 | connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) ); |
456 | connect( reader, SIGNAL( OnWordSelected(const QString&, size_t, const QString&) ), this, SLOT( OnWordSelected(const QString&, size_t, const QString&) ) ); | 456 | connect( reader, SIGNAL( OnWordSelected(const QString&,size_t,const QString&) ), this, SLOT( OnWordSelected(const QString&,size_t,const QString&) ) ); |
457 | connect( reader, SIGNAL( OnURLSelected(const QString&) ), this, SLOT( OnURLSelected(const QString&) ) ); | 457 | connect( reader, SIGNAL( OnURLSelected(const QString&) ), this, SLOT( OnURLSelected(const QString&) ) ); |
458 | editorStack->addWidget( reader, get_unique_id() ); | 458 | editorStack->addWidget( reader, get_unique_id() ); |
459 | 459 | ||
460 | m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL); | 460 | m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL); |
461 | connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) ); | 461 | connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) ); |
462 | m_preferences_action->addTo( settings ); | 462 | m_preferences_action->addTo( settings ); |
463 | 463 | ||
464 | m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL); | 464 | m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL); |
465 | connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) ); | 465 | connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) ); |
466 | m_saveconfig_action->addTo( settings ); | 466 | m_saveconfig_action->addTo( settings ); |
467 | 467 | ||
468 | m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL); | 468 | m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL); |
469 | connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) ); | 469 | connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) ); |
470 | m_loadconfig_action->addTo( settings ); | 470 | m_loadconfig_action->addTo( settings ); |
471 | 471 | ||
472 | m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL); | 472 | m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL); |
473 | connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) ); | 473 | connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) ); |
474 | m_tidyconfig_action->addTo( settings ); | 474 | m_tidyconfig_action->addTo( settings ); |
475 | 475 | ||
476 | settings->insertSeparator(); | 476 | settings->insertSeparator(); |
477 | m_toolbarprefs_action = new QAction( tr( "Toolbars" ), QString::null, 0, this, NULL); | 477 | m_toolbarprefs_action = new QAction( tr( "Toolbars" ), QString::null, 0, this, NULL); |
478 | connect( m_toolbarprefs_action, SIGNAL( activated() ), this, SLOT( showtoolbarprefs() ) ); | 478 | connect( m_toolbarprefs_action, SIGNAL( activated() ), this, SLOT( showtoolbarprefs() ) ); |
479 | m_toolbarprefs_action->addTo( settings ); | 479 | m_toolbarprefs_action->addTo( settings ); |
480 | 480 | ||
481 | m_open_action = new QAction( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 ); | 481 | m_open_action = new QAction( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 ); |
482 | connect( m_open_action, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); | 482 | connect( m_open_action, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); |
483 | m_open_action->addTo( file ); | 483 | m_open_action->addTo( file ); |
484 | 484 | ||
485 | m_close_action = new QAction( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 ); | 485 | m_close_action = new QAction( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 ); |
486 | connect( m_close_action, SIGNAL( activated() ), this, SLOT( fileClose() ) ); | 486 | connect( m_close_action, SIGNAL( activated() ), this, SLOT( fileClose() ) ); |
487 | m_close_action->addTo( file ); | 487 | m_close_action->addTo( file ); |
488 | 488 | ||
489 | #ifdef _SCRIPT | 489 | #ifdef _SCRIPT |
490 | a = new QAction( tr( "Run Script" ), QString::null, 0, this, NULL); | 490 | a = new QAction( tr( "Run Script" ), QString::null, 0, this, NULL); |
491 | connect( a, SIGNAL( activated() ), this, SLOT( RunScript() ) ); | 491 | connect( a, SIGNAL( activated() ), this, SLOT( RunScript() ) ); |
492 | a->addTo( file ); | 492 | a->addTo( file ); |
493 | #endif | 493 | #endif |
494 | /* | 494 | /* |
495 | a = new QAction( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 ); | 495 | a = new QAction( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 ); |
496 | connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) ); | 496 | connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) ); |
497 | a->addTo( file ); | 497 | a->addTo( file ); |
498 | 498 | ||
499 | a = new QAction( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 ); | 499 | a = new QAction( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 ); |
500 | connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); | 500 | connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); |
501 | a->addTo( filebar() ); | 501 | a->addTo( filebar() ); |
502 | a->addTo( edit ); | 502 | a->addTo( edit ); |
503 | */ | 503 | */ |
504 | 504 | ||
505 | m_info_action = new QAction( tr( "Info" ), geticon( "UtilsIcon" ), QString::null, 0, this, NULL); | 505 | m_info_action = new QAction( tr( "Info" ), geticon( "UtilsIcon" ), QString::null, 0, this, NULL); |
506 | connect( m_info_action, SIGNAL( activated() ), this, SLOT( showinfo() ) ); | 506 | connect( m_info_action, SIGNAL( activated() ), this, SLOT( showinfo() ) ); |
507 | m_info_action->addTo( file ); | 507 | m_info_action->addTo( file ); |
508 | 508 | ||
509 | m_touch_action = new QAction( tr( "Two/One Touch" ), geticon( "1to1" ), QString::null, 0, this, NULL, true ); | 509 | m_touch_action = new QAction( tr( "Two/One Touch" ), geticon( "1to1" ), QString::null, 0, this, NULL, true ); |
510 | connect( m_touch_action, SIGNAL( toggled(bool) ), this, SLOT( setTwoTouch(bool) ) ); | 510 | connect( m_touch_action, SIGNAL( toggled(bool) ), this, SLOT( setTwoTouch(bool) ) ); |
511 | m_touch_action->setOn(m_twoTouch); | 511 | m_touch_action->setOn(m_twoTouch); |
512 | m_touch_action->addTo( file ); | 512 | m_touch_action->addTo( file ); |
513 | 513 | ||
514 | m_find_action = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, NULL); | 514 | m_find_action = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, NULL); |
515 | connect( m_find_action, SIGNAL( activated() ), this, SLOT( editFind() ) ); | 515 | connect( m_find_action, SIGNAL( activated() ), this, SLOT( editFind() ) ); |
516 | file->insertSeparator(); | 516 | file->insertSeparator(); |
517 | // a->addTo( bar ); | 517 | // a->addTo( bar ); |
518 | m_find_action->addTo( file ); | 518 | m_find_action->addTo( file ); |
519 | 519 | ||
520 | m_exportlinks_action = new QAction( tr( "Export Links" ), QString::null, 0, this, NULL); | 520 | m_exportlinks_action = new QAction( tr( "Export Links" ), QString::null, 0, this, NULL); |
521 | connect( m_exportlinks_action, SIGNAL( activated() ), this, SLOT( ExportLinks() ) ); | 521 | connect( m_exportlinks_action, SIGNAL( activated() ), this, SLOT( ExportLinks() ) ); |
522 | m_exportlinks_action->addTo( file ); | 522 | m_exportlinks_action->addTo( file ); |
523 | 523 | ||
524 | m_scrollButton = new QAction( tr( "Scroll" ), getmyicon( "panel-arrow-down" ), QString::null, 0, this, 0, true ); | 524 | m_scrollButton = new QAction( tr( "Scroll" ), getmyicon( "panel-arrow-down" ), QString::null, 0, this, 0, true ); |
525 | connect( m_scrollButton, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) ); | 525 | connect( m_scrollButton, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) ); |
526 | m_scrollButton->addTo(navigation); | 526 | m_scrollButton->addTo(navigation); |
527 | m_scrollButton->setOn(false); | 527 | m_scrollButton->setOn(false); |
528 | 528 | ||
529 | m_start_action = new QAction( tr( "Goto Start" ), geticon( "start" ), QString::null, 0, this, NULL); | 529 | m_start_action = new QAction( tr( "Goto Start" ), geticon( "start" ), QString::null, 0, this, NULL); |
530 | connect( m_start_action, SIGNAL( activated() ), this, SLOT( gotoStart() ) ); | 530 | connect( m_start_action, SIGNAL( activated() ), this, SLOT( gotoStart() ) ); |
531 | m_start_action->addTo(navigation); | 531 | m_start_action->addTo(navigation); |
532 | 532 | ||
533 | m_end_action = new QAction( tr( "Goto End" ), geticon( "finish" ), QString::null, 0, this, NULL); | 533 | m_end_action = new QAction( tr( "Goto End" ), geticon( "finish" ), QString::null, 0, this, NULL); |
534 | connect( m_end_action, SIGNAL( activated() ), this, SLOT( gotoEnd() ) ); | 534 | connect( m_end_action, SIGNAL( activated() ), this, SLOT( gotoEnd() ) ); |
535 | m_end_action->addTo(navigation); | 535 | m_end_action->addTo(navigation); |
536 | 536 | ||
537 | m_jump_action = new QAction( tr( "Jump" ), geticon( "rotate" ), QString::null, 0, this, NULL); | 537 | m_jump_action = new QAction( tr( "Jump" ), geticon( "rotate" ), QString::null, 0, this, NULL); |
538 | connect( m_jump_action, SIGNAL( activated() ), this, SLOT( jump() ) ); | 538 | connect( m_jump_action, SIGNAL( activated() ), this, SLOT( jump() ) ); |
539 | m_jump_action->addTo(navigation); | 539 | m_jump_action->addTo(navigation); |
540 | 540 | ||
541 | m_pageline_action = new QAction( tr( "Page/Line Scroll" ), geticon( "pass" ), QString::null, 0, this, NULL, true ); | 541 | m_pageline_action = new QAction( tr( "Page/Line Scroll" ), geticon( "pass" ), QString::null, 0, this, NULL, true ); |
542 | connect( m_pageline_action, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) ); | 542 | connect( m_pageline_action, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) ); |
543 | m_pageline_action->addTo(navigation); | 543 | m_pageline_action->addTo(navigation); |
544 | m_pageline_action->setOn(reader->m_bpagemode); | 544 | m_pageline_action->setOn(reader->m_bpagemode); |
545 | 545 | ||
546 | m_pageup_action = new QAction( tr( "Up" ), geticon( "up" ), QString::null, 0, this, 0 ); | 546 | m_pageup_action = new QAction( tr( "Up" ), geticon( "up" ), QString::null, 0, this, 0 ); |
547 | connect( m_pageup_action, SIGNAL( activated() ), this, SLOT( pageup() ) ); | 547 | connect( m_pageup_action, SIGNAL( activated() ), this, SLOT( pageup() ) ); |
548 | m_pageup_action->addTo( navigation ); | 548 | m_pageup_action->addTo( navigation ); |
549 | 549 | ||
550 | m_pagedn_action = new QAction( tr( "Down" ), geticon( "down" ), QString::null, 0, this, 0 ); | 550 | m_pagedn_action = new QAction( tr( "Down" ), geticon( "down" ), QString::null, 0, this, 0 ); |
551 | connect( m_pagedn_action, SIGNAL( activated() ), this, SLOT( pagedn() ) ); | 551 | connect( m_pagedn_action, SIGNAL( activated() ), this, SLOT( pagedn() ) ); |
552 | m_pagedn_action->addTo( navigation ); | 552 | m_pagedn_action->addTo( navigation ); |
@@ -633,266 +633,266 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
633 | view->insertSeparator(); | 633 | view->insertSeparator(); |
634 | m_setenc_action = new QAction( tr( "Set Encoding" ), getmyicon( "charset" ), QString::null, 0, this); | 634 | m_setenc_action = new QAction( tr( "Set Encoding" ), getmyicon( "charset" ), QString::null, 0, this); |
635 | connect( m_setenc_action, SIGNAL( activated() ), this, SLOT( chooseencoding() ) ); | 635 | connect( m_setenc_action, SIGNAL( activated() ), this, SLOT( chooseencoding() ) ); |
636 | m_setenc_action->addTo( view ); | 636 | m_setenc_action->addTo( view ); |
637 | 637 | ||
638 | m_setmono_action = new QAction( tr( "Ideogram" ), getmyicon( "ideogram" ), QString::null, 0, this, NULL, true); | 638 | m_setmono_action = new QAction( tr( "Ideogram" ), getmyicon( "ideogram" ), QString::null, 0, this, NULL, true); |
639 | connect( m_setmono_action, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); | 639 | connect( m_setmono_action, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); |
640 | m_setmono_action->addTo( view ); | 640 | m_setmono_action->addTo( view ); |
641 | m_setmono_action->setOn(reader->m_bMonoSpaced); | 641 | m_setmono_action->setOn(reader->m_bMonoSpaced); |
642 | 642 | ||
643 | 643 | ||
644 | // a = new QAction( tr( "Zoom" ), QString::null, 0, this, NULL, true ); | 644 | // a = new QAction( tr( "Zoom" ), QString::null, 0, this, NULL, true ); |
645 | // a = new QAction( tr( "Zoom" ), geticon( "mag" ), QString::null, 0, this, 0 ); | 645 | // a = new QAction( tr( "Zoom" ), geticon( "mag" ), QString::null, 0, this, 0 ); |
646 | 646 | ||
647 | 647 | ||
648 | 648 | ||
649 | // a->addTo( filebar() ); | 649 | // a->addTo( filebar() ); |
650 | // view->insertSeparator(); | 650 | // view->insertSeparator(); |
651 | 651 | ||
652 | /* | 652 | /* |
653 | a = new QAction( tr( "Ideogram/Word" ), QString::null, 0, this, NULL, true ); | 653 | a = new QAction( tr( "Ideogram/Word" ), QString::null, 0, this, NULL, true ); |
654 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); | 654 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); |
655 | a->setOn(reader->m_bMonoSpaced); | 655 | a->setOn(reader->m_bMonoSpaced); |
656 | a->addTo( view ); | 656 | a->addTo( view ); |
657 | */ | 657 | */ |
658 | /* | 658 | /* |
659 | a = new QAction( tr( "Set Width" ), QString::null, 0, this, NULL); | 659 | a = new QAction( tr( "Set Width" ), QString::null, 0, this, NULL); |
660 | connect( a, SIGNAL( activated() ), this, SLOT( setspacing() ) ); | 660 | connect( a, SIGNAL( activated() ), this, SLOT( setspacing() ) ); |
661 | a->addTo( view ); | 661 | a->addTo( view ); |
662 | */ | 662 | */ |
663 | 663 | ||
664 | m_mark_action = new QAction( tr( "Bookmark" ), getmyicon( "bookmark" ), QString::null, 0, this, NULL); | 664 | m_mark_action = new QAction( tr( "Bookmark" ), getmyicon( "bookmark" ), QString::null, 0, this, NULL); |
665 | connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) ); | 665 | connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) ); |
666 | m_mark_action->addTo( marks ); | 666 | m_mark_action->addTo( marks ); |
667 | 667 | ||
668 | m_annotate_action = new QAction( tr( "Annotate" ), getmyicon( "annotate" ), QString::null, 0, this, NULL); | 668 | m_annotate_action = new QAction( tr( "Annotate" ), getmyicon( "annotate" ), QString::null, 0, this, NULL); |
669 | connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) ); | 669 | connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) ); |
670 | m_annotate_action->addTo( marks ); | 670 | m_annotate_action->addTo( marks ); |
671 | 671 | ||
672 | m_goto_action = new QAction( tr( "Goto" ), getmyicon( "bookmark_goto" ), QString::null, 0, this, NULL, false ); | 672 | m_goto_action = new QAction( tr( "Goto" ), getmyicon( "bookmark_goto" ), QString::null, 0, this, NULL, false ); |
673 | connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) ); | 673 | connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) ); |
674 | m_goto_action->addTo( marks ); | 674 | m_goto_action->addTo( marks ); |
675 | 675 | ||
676 | m_delete_action = new QAction( tr( "Delete" ), getmyicon( "bookmark_delete" ), QString::null, 0, this, NULL); | 676 | m_delete_action = new QAction( tr( "Delete" ), getmyicon( "bookmark_delete" ), QString::null, 0, this, NULL); |
677 | connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) ); | 677 | connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) ); |
678 | m_delete_action->addTo( marks ); | 678 | m_delete_action->addTo( marks ); |
679 | 679 | ||
680 | m_autogen_action = new QAction( tr( "Autogen" ), geticon( "exec" ), QString::null, 0, this, NULL, false ); | 680 | m_autogen_action = new QAction( tr( "Autogen" ), geticon( "exec" ), QString::null, 0, this, NULL, false ); |
681 | connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) ); | 681 | connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) ); |
682 | marks->insertSeparator(); | 682 | marks->insertSeparator(); |
683 | m_autogen_action->addTo( marks ); | 683 | m_autogen_action->addTo( marks ); |
684 | 684 | ||
685 | m_clear_action = new QAction( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL); | 685 | m_clear_action = new QAction( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL); |
686 | connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) ); | 686 | connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) ); |
687 | m_clear_action->addTo( marks ); | 687 | m_clear_action->addTo( marks ); |
688 | 688 | ||
689 | m_save_action = new QAction( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL ); | 689 | m_save_action = new QAction( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL ); |
690 | connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) ); | 690 | connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) ); |
691 | m_save_action->addTo( marks ); | 691 | m_save_action->addTo( marks ); |
692 | 692 | ||
693 | m_tidy_action = new QAction( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL); | 693 | m_tidy_action = new QAction( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL); |
694 | connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) ); | 694 | connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) ); |
695 | marks->insertSeparator(); | 695 | marks->insertSeparator(); |
696 | m_tidy_action->addTo( marks ); | 696 | m_tidy_action->addTo( marks ); |
697 | 697 | ||
698 | m_startBlock_action = new QAction( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL); | 698 | m_startBlock_action = new QAction( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL); |
699 | connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) ); | 699 | connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) ); |
700 | marks->insertSeparator(); | 700 | marks->insertSeparator(); |
701 | m_startBlock_action->addTo( marks ); | 701 | m_startBlock_action->addTo( marks ); |
702 | 702 | ||
703 | m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL); | 703 | m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL); |
704 | connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) ); | 704 | connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) ); |
705 | m_endBlock_action->addTo( marks ); | 705 | m_endBlock_action->addTo( marks ); |
706 | 706 | ||
707 | m_bkmkAvail = NULL; | 707 | m_bkmkAvail = NULL; |
708 | 708 | ||
709 | 709 | ||
710 | setToolBarsMovable(m_tbmove); | 710 | setToolBarsMovable(m_tbmove); |
711 | addtoolbars(&config); | 711 | addtoolbars(&config); |
712 | 712 | ||
713 | pbar = new QProgressBar(this); | 713 | pbar = new QProgressBar(this); |
714 | pbar->hide(); | 714 | pbar->hide(); |
715 | 715 | ||
716 | searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE ); | 716 | searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
717 | 717 | ||
718 | searchBar->setHorizontalStretchable( TRUE ); | 718 | searchBar->setHorizontalStretchable( TRUE ); |
719 | 719 | ||
720 | connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); | 720 | connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); |
721 | 721 | ||
722 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 722 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
723 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 723 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
724 | // searchEdit->setFont( f ); | 724 | // searchEdit->setFont( f ); |
725 | searchBar->setStretchableWidget( searchEdit ); | 725 | searchBar->setStretchableWidget( searchEdit ); |
726 | 726 | ||
727 | 727 | ||
728 | #ifdef __ISEARCH | 728 | #ifdef __ISEARCH |
729 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 729 | connect( searchEdit, SIGNAL( textChanged(const QString&) ), |
730 | this, SLOT( search( const QString& ) ) ); | 730 | this, SLOT( search(const QString&) ) ); |
731 | #else | 731 | #else |
732 | connect( searchEdit, SIGNAL( returnPressed( ) ), | 732 | connect( searchEdit, SIGNAL( returnPressed() ), |
733 | this, SLOT( search( ) ) ); | 733 | this, SLOT( search() ) ); |
734 | #endif | 734 | #endif |
735 | QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 ); | 735 | QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 ); |
736 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); | 736 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); |
737 | a->addTo( searchBar ); | 737 | a->addTo( searchBar ); |
738 | 738 | ||
739 | a = new QAction( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 ); | 739 | a = new QAction( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 ); |
740 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 740 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
741 | a->addTo( searchBar ); | 741 | a->addTo( searchBar ); |
742 | 742 | ||
743 | searchBar->hide(); | 743 | searchBar->hide(); |
744 | 744 | ||
745 | regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE ); | 745 | regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE ); |
746 | connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); | 746 | connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); |
747 | 747 | ||
748 | regBar->setHorizontalStretchable( TRUE ); | 748 | regBar->setHorizontalStretchable( TRUE ); |
749 | 749 | ||
750 | regEdit = new QLineEdit( regBar, "regEdit" ); | 750 | regEdit = new QLineEdit( regBar, "regEdit" ); |
751 | // regEdit->setFont( f ); | 751 | // regEdit->setFont( f ); |
752 | 752 | ||
753 | regBar->setStretchableWidget( regEdit ); | 753 | regBar->setStretchableWidget( regEdit ); |
754 | 754 | ||
755 | connect( regEdit, SIGNAL( returnPressed( ) ), | 755 | connect( regEdit, SIGNAL( returnPressed() ), |
756 | this, SLOT( do_regaction() ) ); | 756 | this, SLOT( do_regaction() ) ); |
757 | 757 | ||
758 | a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 ); | 758 | a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 ); |
759 | connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); | 759 | connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); |
760 | a->addTo( regBar ); | 760 | a->addTo( regBar ); |
761 | 761 | ||
762 | a = new QAction( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 ); | 762 | a = new QAction( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 ); |
763 | connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) ); | 763 | connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) ); |
764 | a->addTo( regBar ); | 764 | a->addTo( regBar ); |
765 | 765 | ||
766 | regBar->hide(); | 766 | regBar->hide(); |
767 | 767 | ||
768 | m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); | 768 | m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); |
769 | 769 | ||
770 | m_fontBar->setHorizontalStretchable( TRUE ); | 770 | m_fontBar->setHorizontalStretchable( TRUE ); |
771 | 771 | ||
772 | // qDebug("Font selector"); | 772 | // qDebug("Font selector"); |
773 | m_fontSelector = new QComboBox(false, m_fontBar); | 773 | m_fontSelector = new QComboBox(false, m_fontBar); |
774 | m_fontBar->setStretchableWidget( m_fontSelector ); | 774 | m_fontBar->setStretchableWidget( m_fontSelector ); |
775 | { | 775 | { |
776 | #ifndef USEQPE | 776 | #ifndef USEQPE |
777 | QFontDatabase f; | 777 | QFontDatabase f; |
778 | #else | 778 | #else |
779 | FontDatabase f; | 779 | FontDatabase f; |
780 | #endif | 780 | #endif |
781 | QStringList flist = f.families(); | 781 | QStringList flist = f.families(); |
782 | bool realfont = false; | 782 | bool realfont = false; |
783 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) | 783 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) |
784 | { | 784 | { |
785 | if (reader->m_fontname == *nm) | 785 | if (reader->m_fontname == *nm) |
786 | { | 786 | { |
787 | realfont = true; | 787 | realfont = true; |
788 | } | 788 | } |
789 | if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm); | 789 | if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm); |
790 | } | 790 | } |
791 | if (!realfont) reader->m_fontname = flist[0]; | 791 | if (!realfont) reader->m_fontname = flist[0]; |
792 | } // delete the FontDatabase!!! | 792 | } // delete the FontDatabase!!! |
793 | connect( m_fontSelector, SIGNAL( activated(const QString& ) ), | 793 | connect( m_fontSelector, SIGNAL( activated(const QString&) ), |
794 | this, SLOT( do_setfont(const QString&) ) ); | 794 | this, SLOT( do_setfont(const QString&) ) ); |
795 | connect( m_fontSelector, SIGNAL( activated(int ) ), | 795 | connect( m_fontSelector, SIGNAL( activated(int) ), |
796 | this, SLOT( do_setencoding(int) ) ); | 796 | this, SLOT( do_setencoding(int) ) ); |
797 | 797 | ||
798 | m_fontBar->hide(); | 798 | m_fontBar->hide(); |
799 | m_fontVisible = false; | 799 | m_fontVisible = false; |
800 | #ifdef USEMSGS | 800 | #ifdef USEMSGS |
801 | connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ), | 801 | connect(qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), |
802 | this, SLOT( msgHandler(const QCString&, const QByteArray&) ) ); | 802 | this, SLOT( msgHandler(const QCString&,const QByteArray&) ) ); |
803 | #endif | 803 | #endif |
804 | // qDebug("Initing"); | 804 | // qDebug("Initing"); |
805 | reader->init(); | 805 | reader->init(); |
806 | // qDebug("Inited"); | 806 | // qDebug("Inited"); |
807 | // m_buttonAction[m_spaceTarget]->setOn(true); | 807 | // m_buttonAction[m_spaceTarget]->setOn(true); |
808 | // qDebug("fonting"); | 808 | // qDebug("fonting"); |
809 | do_setfont(reader->m_fontname); | 809 | do_setfont(reader->m_fontname); |
810 | if (!reader->m_lastfile.isEmpty()) | 810 | if (!reader->m_lastfile.isEmpty()) |
811 | { | 811 | { |
812 | //qDebug("doclnk"); | 812 | //qDebug("doclnk"); |
813 | //doc = new DocLnk(reader->m_lastfile); | 813 | //doc = new DocLnk(reader->m_lastfile); |
814 | //qDebug("doclnk done"); | 814 | //qDebug("doclnk done"); |
815 | if (pOpenlist != NULL) | 815 | if (pOpenlist != NULL) |
816 | { | 816 | { |
817 | 817 | ||
818 | /* | 818 | /* |
819 | int ind = 0; | 819 | int ind = 0; |
820 | Bkmk* p = (*pOpenlist)[ind]; | 820 | Bkmk* p = (*pOpenlist)[ind]; |
821 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) | 821 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) |
822 | { | 822 | { |
823 | p = (*pOpenlist)[++ind]; | 823 | p = (*pOpenlist)[++ind]; |
824 | } | 824 | } |
825 | */ | 825 | */ |
826 | Bkmk* p = NULL; | 826 | Bkmk* p = NULL; |
827 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) | 827 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) |
828 | { | 828 | { |
829 | p = iter.pContent(); | 829 | p = iter.pContent(); |
830 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) | 830 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) |
831 | { | 831 | { |
832 | break; | 832 | break; |
833 | } | 833 | } |
834 | // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name())); | 834 | // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name())); |
835 | p = NULL; | 835 | p = NULL; |
836 | } | 836 | } |
837 | if (p != NULL) | 837 | if (p != NULL) |
838 | { | 838 | { |
839 | //qDebug("openfrombkmk"); | 839 | //qDebug("openfrombkmk"); |
840 | if (!openfrombkmk(p)) | 840 | if (!openfrombkmk(p)) |
841 | showEditTools(); | 841 | showEditTools(); |
842 | } | 842 | } |
843 | else | 843 | else |
844 | { | 844 | { |
845 | //qDebug("openfile"); | 845 | //qDebug("openfile"); |
846 | openFile( reader->m_lastfile ); | 846 | openFile( reader->m_lastfile ); |
847 | } | 847 | } |
848 | } | 848 | } |
849 | else | 849 | else |
850 | { | 850 | { |
851 | // qDebug("Openfile 2"); | 851 | // qDebug("Openfile 2"); |
852 | if (!reader->m_lastfile.isEmpty()) | 852 | if (!reader->m_lastfile.isEmpty()) |
853 | openFile( reader->m_lastfile ); | 853 | openFile( reader->m_lastfile ); |
854 | } | 854 | } |
855 | } | 855 | } |
856 | else | 856 | else |
857 | { | 857 | { |
858 | showEditTools(); | 858 | showEditTools(); |
859 | } | 859 | } |
860 | // qApp->processEvents(); | 860 | // qApp->processEvents(); |
861 | reader->bDoUpdates = true; | 861 | reader->bDoUpdates = true; |
862 | reader->update(); | 862 | reader->update(); |
863 | config.setGroup("Version"); | 863 | config.setGroup("Version"); |
864 | int major = config.readNumEntry("Major", 0); | 864 | int major = config.readNumEntry("Major", 0); |
865 | int bkmktype = config.readNumEntry("BkmkType", 0); | 865 | int bkmktype = config.readNumEntry("BkmkType", 0); |
866 | char minor = config.readNumEntry("Minor", 0); | 866 | char minor = config.readNumEntry("Minor", 0); |
867 | if (CheckVersion(major, bkmktype, minor)) | 867 | if (CheckVersion(major, bkmktype, minor)) |
868 | { | 868 | { |
869 | config.writeEntry("Major", major); | 869 | config.writeEntry("Major", major); |
870 | config.writeEntry("BkmkType", bkmktype); | 870 | config.writeEntry("BkmkType", bkmktype); |
871 | config.writeEntry("Minor", (int)minor); | 871 | config.writeEntry("Minor", (int)minor); |
872 | } | 872 | } |
873 | // qDebug("finished update"); | 873 | // qDebug("finished update"); |
874 | } | 874 | } |
875 | 875 | ||
876 | void QTReaderApp::addtoolbars(Config* config) | 876 | void QTReaderApp::addtoolbars(Config* config) |
877 | { | 877 | { |
878 | config->setGroup("Toolbar"); | 878 | config->setGroup("Toolbar"); |
879 | 879 | ||
880 | if (fileBar != NULL) | 880 | if (fileBar != NULL) |
881 | { | 881 | { |
882 | if (fileBar != menubar) | 882 | if (fileBar != menubar) |
883 | { | 883 | { |
884 | fileBar->clear(); | 884 | fileBar->clear(); |
885 | } | 885 | } |
886 | else | 886 | else |
887 | { | 887 | { |
888 | m_preferences_action->removeFrom( filebar() ); | 888 | m_preferences_action->removeFrom( filebar() ); |
889 | m_open_action->removeFrom( filebar() ); | 889 | m_open_action->removeFrom( filebar() ); |
890 | m_close_action->removeFrom( filebar() ); | 890 | m_close_action->removeFrom( filebar() ); |
891 | m_info_action->removeFrom( filebar() ); | 891 | m_info_action->removeFrom( filebar() ); |
892 | m_touch_action->removeFrom( filebar() ); | 892 | m_touch_action->removeFrom( filebar() ); |
893 | m_find_action->removeFrom( filebar() ); | 893 | m_find_action->removeFrom( filebar() ); |
894 | } | 894 | } |
895 | } | 895 | } |
896 | 896 | ||
897 | m_preferences_action->addTo( filebar() ); | 897 | m_preferences_action->addTo( filebar() ); |
898 | addfilebar(config, "Open", m_open_action); | 898 | addfilebar(config, "Open", m_open_action); |
diff --git a/noncore/apps/opie-reader/fileBrowser.cpp b/noncore/apps/opie-reader/fileBrowser.cpp index ebd14f3..e1cde6c 100644 --- a/noncore/apps/opie-reader/fileBrowser.cpp +++ b/noncore/apps/opie-reader/fileBrowser.cpp | |||
@@ -1,176 +1,176 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | 2 | ||
3 | Derived from a file browser which was | 3 | Derived from a file browser which was |
4 | 4 | ||
5 | ** copyright 2001 ljp ljp@llornkcor.com | 5 | ** copyright 2001 ljp ljp@llornkcor.com |
6 | 6 | ||
7 | Extensive modification by Tim Wentford to allow it to work in rotated mode | 7 | Extensive modification by Tim Wentford to allow it to work in rotated mode |
8 | 8 | ||
9 | ****************************************************************************/ | 9 | ****************************************************************************/ |
10 | #include "fileBrowser.h" | 10 | #include "fileBrowser.h" |
11 | 11 | ||
12 | #include "QtrListView.h" | 12 | #include "QtrListView.h" |
13 | #include <qlineedit.h> | 13 | #include <qlineedit.h> |
14 | #include <qpushbutton.h> | 14 | #include <qpushbutton.h> |
15 | #ifndef _WINDOWS | 15 | #ifndef _WINDOWS |
16 | #include <unistd.h> | 16 | #include <unistd.h> |
17 | #endif | 17 | #endif |
18 | #include <qlayout.h> | 18 | #include <qlayout.h> |
19 | #ifdef _WINDOWS | 19 | #ifdef _WINDOWS |
20 | #include <direct.h> | 20 | #include <direct.h> |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | 24 | ||
25 | 25 | ||
26 | fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) | 26 | fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) |
27 | : QDialog( parent, name, true, | 27 | : QDialog( parent, name, true, |
28 | fl/* | WStyle_Customize | WStyle_Tool*/), | 28 | fl/* | WStyle_Customize | WStyle_Tool*/), |
29 | filterspec(QDir::All) | 29 | filterspec(QDir::All) |
30 | { | 30 | { |
31 | // showMaximized(); | 31 | // showMaximized(); |
32 | if ( !name ) | 32 | if ( !name ) |
33 | setName( "fileBrowser" ); | 33 | setName( "fileBrowser" ); |
34 | /* | 34 | /* |
35 | if (parent != NULL) | 35 | if (parent != NULL) |
36 | { | 36 | { |
37 | #ifdef OPIE | 37 | #ifdef OPIE |
38 | move(0,0); | 38 | move(0,0); |
39 | resize( parent->width(), parent->height() ); | 39 | resize( parent->width(), parent->height() ); |
40 | #else | 40 | #else |
41 | setGeometry(parent->x(), parent->y(), parent->width(), parent->height() ); | 41 | setGeometry(parent->x(), parent->y(), parent->width(), parent->height() ); |
42 | #endif | 42 | #endif |
43 | } | 43 | } |
44 | */ | 44 | */ |
45 | // showFullScreen(); | 45 | // showFullScreen(); |
46 | setCaption(tr( "Browse for file" ) ); | 46 | setCaption(tr( "Browse for file" ) ); |
47 | filterStr=filter; | 47 | filterStr=filter; |
48 | 48 | ||
49 | buttonOk = new QPushButton( this, "buttonOk" ); | 49 | buttonOk = new QPushButton( this, "buttonOk" ); |
50 | buttonOk->setFixedSize( 25, 25 ); | 50 | buttonOk->setFixedSize( 25, 25 ); |
51 | buttonOk->setAutoDefault( false ); | 51 | buttonOk->setAutoDefault( false ); |
52 | buttonOk->setText( tr( "/" ) ); | 52 | buttonOk->setText( tr( "/" ) ); |
53 | 53 | ||
54 | buttonShowHidden = new QPushButton( this, "buttonShowHidden" ); | 54 | buttonShowHidden = new QPushButton( this, "buttonShowHidden" ); |
55 | // buttonShowHidden->setFixedSize( 50, 25 ); | 55 | // buttonShowHidden->setFixedSize( 50, 25 ); |
56 | buttonShowHidden->setText( tr( "Hidden" ) ); | 56 | buttonShowHidden->setText( tr( "Hidden" ) ); |
57 | buttonShowHidden->setAutoDefault( false ); | 57 | buttonShowHidden->setAutoDefault( false ); |
58 | buttonShowHidden->setToggleButton( true ); | 58 | buttonShowHidden->setToggleButton( true ); |
59 | buttonShowHidden->setOn( false ); | 59 | buttonShowHidden->setOn( false ); |
60 | 60 | ||
61 | dirLabel = new QLabel(this, "DirLabel"); | 61 | dirLabel = new QLabel(this, "DirLabel"); |
62 | dirLabel->setAlignment(AlignLeft | AlignVCenter | ExpandTabs | WordBreak); | 62 | dirLabel->setAlignment(AlignLeft | AlignVCenter | ExpandTabs | WordBreak); |
63 | dirLabel->setText(currentDir.canonicalPath()); | 63 | dirLabel->setText(currentDir.canonicalPath()); |
64 | 64 | ||
65 | ListView = new QtrListView( this, "ListView" ); | 65 | ListView = new QtrListView( this, "ListView" ); |
66 | ListView->addColumn( tr( "Name" ) ); | 66 | ListView->addColumn( tr( "Name" ) ); |
67 | ListView->setSorting( 2, FALSE); | 67 | ListView->setSorting( 2, FALSE); |
68 | ListView->addColumn( tr( "Size" ) ); | 68 | ListView->addColumn( tr( "Size" ) ); |
69 | ListView->setSelectionMode(QListView::Single); | 69 | ListView->setSelectionMode(QListView::Single); |
70 | ListView->setAllColumnsShowFocus( TRUE ); | 70 | ListView->setAllColumnsShowFocus( TRUE ); |
71 | ListView->setColumnWidthMode(0, QListView::Manual); | 71 | ListView->setColumnWidthMode(0, QListView::Manual); |
72 | ListView->setColumnWidthMode(1, QListView::Manual); | 72 | ListView->setColumnWidthMode(1, QListView::Manual); |
73 | 73 | ||
74 | // signals and slots connections | 74 | // signals and slots connections |
75 | connect( buttonShowHidden, SIGNAL( toggled(bool) ), this, SLOT( setHidden(bool) ) ); | 75 | connect( buttonShowHidden, SIGNAL( toggled(bool) ), this, SLOT( setHidden(bool) ) ); |
76 | connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) ); | 76 | connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) ); |
77 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); | 77 | connect( ListView, SIGNAL(doubleClicked(QListViewItem*)), SLOT(listDoubleClicked(QListViewItem*)) ); |
78 | connect( ListView, SIGNAL(clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 78 | connect( ListView, SIGNAL(clicked(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); |
79 | connect( ListView, SIGNAL(OnOKButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 79 | connect( ListView, SIGNAL(OnOKButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); |
80 | connect( ListView, SIGNAL(OnCentreButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 80 | connect( ListView, SIGNAL(OnCentreButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); |
81 | connect( ListView, SIGNAL(OnCancelButton()), SLOT(OnCancel()) ); | 81 | connect( ListView, SIGNAL(OnCancelButton()), SLOT(OnCancel()) ); |
82 | 82 | ||
83 | QVBoxLayout* grid = new QVBoxLayout(this); | 83 | QVBoxLayout* grid = new QVBoxLayout(this); |
84 | QHBoxLayout* hgrid = new QHBoxLayout(grid); | 84 | QHBoxLayout* hgrid = new QHBoxLayout(grid); |
85 | hgrid->addWidget(dirLabel,1); | 85 | hgrid->addWidget(dirLabel,1); |
86 | hgrid->addWidget(buttonShowHidden); | 86 | hgrid->addWidget(buttonShowHidden); |
87 | hgrid->addWidget(buttonOk); | 87 | hgrid->addWidget(buttonOk); |
88 | grid->addWidget(ListView,1); | 88 | grid->addWidget(ListView,1); |
89 | if (allownew) | 89 | if (allownew) |
90 | { | 90 | { |
91 | m_filename = new QLineEdit(this); | 91 | m_filename = new QLineEdit(this); |
92 | grid->addWidget(m_filename); | 92 | grid->addWidget(m_filename); |
93 | connect( m_filename, SIGNAL( returnPressed() ), this, SLOT( onReturn() )); | 93 | connect( m_filename, SIGNAL( returnPressed() ), this, SLOT( onReturn() )); |
94 | } | 94 | } |
95 | else | 95 | else |
96 | { | 96 | { |
97 | m_filename = NULL; | 97 | m_filename = NULL; |
98 | } | 98 | } |
99 | 99 | ||
100 | if (QFileInfo(iPath).exists()) | 100 | if (QFileInfo(iPath).exists()) |
101 | { | 101 | { |
102 | currentDir.setPath(iPath); | 102 | currentDir.setPath(iPath); |
103 | #ifdef _WINDOWS | 103 | #ifdef _WINDOWS |
104 | _chdir(iPath.latin1()); | 104 | _chdir(iPath.latin1()); |
105 | #else | 105 | #else |
106 | chdir(iPath.latin1()); | 106 | chdir(iPath.latin1()); |
107 | #endif | 107 | #endif |
108 | } | 108 | } |
109 | else | 109 | else |
110 | { | 110 | { |
111 | currentDir.setPath(QDir::currentDirPath()); | 111 | currentDir.setPath(QDir::currentDirPath()); |
112 | chdir(QDir::currentDirPath().latin1()); | 112 | chdir(QDir::currentDirPath().latin1()); |
113 | } | 113 | } |
114 | 114 | ||
115 | populateList(); | 115 | populateList(); |
116 | 116 | ||
117 | if (modal) | 117 | if (modal) |
118 | QPEApplication::showDialog( this ); | 118 | QPEApplication::showDialog( this ); |
119 | } | 119 | } |
120 | 120 | ||
121 | void fileBrowser::resizeEvent(QResizeEvent* e) | 121 | void fileBrowser::resizeEvent(QResizeEvent* e) |
122 | { | 122 | { |
123 | ListView->setColumnWidth(1,(ListView->width())/4); | 123 | ListView->setColumnWidth(1,(ListView->width())/4); |
124 | ListView->setColumnWidth(0,ListView->width()-20-ListView->columnWidth(1)); | 124 | ListView->setColumnWidth(0,ListView->width()-20-ListView->columnWidth(1)); |
125 | } | 125 | } |
126 | 126 | ||
127 | fileBrowser::~fileBrowser() | 127 | fileBrowser::~fileBrowser() |
128 | { | 128 | { |
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | ||
132 | void fileBrowser::populateList() | 132 | void fileBrowser::populateList() |
133 | { | 133 | { |
134 | ListView->clear(); | 134 | ListView->clear(); |
135 | ////qDebug(currentDir.canonicalPath()); | 135 | ////qDebug(currentDir.canonicalPath()); |
136 | // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); | 136 | // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); |
137 | currentDir.setFilter( filterspec ); | 137 | currentDir.setFilter( filterspec ); |
138 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 138 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
139 | currentDir.setMatchAllDirs(TRUE); | 139 | currentDir.setMatchAllDirs(TRUE); |
140 | 140 | ||
141 | currentDir.setNameFilter(filterStr); | 141 | currentDir.setNameFilter(filterStr); |
142 | // currentDir.setNameFilter("*.txt;*.etx"); | 142 | // currentDir.setNameFilter("*.txt;*.etx"); |
143 | QString fileL, fileS; | 143 | QString fileL, fileS; |
144 | const QFileInfoList *list = currentDir.entryInfoList(); | 144 | const QFileInfoList *list = currentDir.entryInfoList(); |
145 | QFileInfoListIterator it(*list); | 145 | QFileInfoListIterator it(*list); |
146 | QFileInfo *fi; | 146 | QFileInfo *fi; |
147 | while ( (fi=it.current()) ) | 147 | while ( (fi=it.current()) ) |
148 | { | 148 | { |
149 | if (fi->fileName() != ".") | 149 | if (fi->fileName() != ".") |
150 | { | 150 | { |
151 | fileS.sprintf( "%10li", fi->size() ); | 151 | fileS.sprintf( "%10li", fi->size() ); |
152 | fileL.sprintf( "%s",fi->fileName().data() ); | 152 | fileL.sprintf( "%s",fi->fileName().data() ); |
153 | if( fi->isDir() ) | 153 | if( fi->isDir() ) |
154 | { | 154 | { |
155 | fileL+="/"; | 155 | fileL+="/"; |
156 | } | 156 | } |
157 | else | 157 | else |
158 | { | 158 | { |
159 | //// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 159 | //// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
160 | } | 160 | } |
161 | new QListViewItem( ListView,fileL,fileS ); | 161 | new QListViewItem( ListView,fileL,fileS ); |
162 | } | 162 | } |
163 | ++it; | 163 | ++it; |
164 | } | 164 | } |
165 | ListView->setSorting( 2, FALSE); | 165 | ListView->setSorting( 2, FALSE); |
166 | dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath()); | 166 | dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath()); |
167 | ListView->setFocus(); | 167 | ListView->setFocus(); |
168 | } | 168 | } |
169 | 169 | ||
170 | void fileBrowser::upDir() | 170 | void fileBrowser::upDir() |
171 | { | 171 | { |
172 | //// qDebug(currentDir.canonicalPath()); | 172 | //// qDebug(currentDir.canonicalPath()); |
173 | } | 173 | } |
174 | 174 | ||
175 | void fileBrowser::listClicked(QListViewItem *selectedItem) | 175 | void fileBrowser::listClicked(QListViewItem *selectedItem) |
176 | { | 176 | { |