author | zecke <zecke> | 2002-03-22 22:39:51 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-03-22 22:39:51 (UTC) |
commit | f0add730524cb63fd3bcce741da2e1fba83acb9f (patch) (unidiff) | |
tree | 029b1bfb012cff89cf57ef1009a657bc7fee168c | |
parent | 796cb4b76f2e949b1baea3d4cf7a70b24186939d (diff) | |
download | opie-f0add730524cb63fd3bcce741da2e1fba83acb9f.zip opie-f0add730524cb63fd3bcce741da2e1fba83acb9f.tar.gz opie-f0add730524cb63fd3bcce741da2e1fba83acb9f.tar.bz2 |
make some people happy
-rw-r--r-- | core/launcher/launcher.cpp | 31 | ||||
-rw-r--r-- | core/launcher/launcher.h | 2 | ||||
-rw-r--r-- | core/launcher/mediummountgui.cpp | 4 |
3 files changed, 32 insertions, 5 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index b26bd8b..dcc3ba1 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -28,96 +28,100 @@ | |||
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include <qpe/applnk.h> | 29 | #include <qpe/applnk.h> |
30 | #include <qpe/config.h> | 30 | #include <qpe/config.h> |
31 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
34 | #include <qpe/storage.h> | 34 | #include <qpe/storage.h> |
35 | #include <qpe/palmtoprecord.h> | 35 | #include <qpe/palmtoprecord.h> |
36 | 36 | ||
37 | #include <qdatetime.h> | 37 | #include <qdatetime.h> |
38 | #include <qdir.h> | 38 | #include <qdir.h> |
39 | #include <qwindowsystem_qws.h> | 39 | #include <qwindowsystem_qws.h> |
40 | #include <qtimer.h> | 40 | #include <qtimer.h> |
41 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
42 | #include <qvbox.h> | 42 | #include <qvbox.h> |
43 | #include <qlayout.h> | 43 | #include <qlayout.h> |
44 | #include <qstyle.h> | 44 | #include <qstyle.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | #include <qtabbar.h> | 46 | #include <qtabbar.h> |
47 | #include <qwidgetstack.h> | 47 | #include <qwidgetstack.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qregexp.h> | 49 | #include <qregexp.h> |
50 | #include <qmessagebox.h> | 50 | #include <qmessagebox.h> |
51 | #include <qframe.h> | 51 | #include <qframe.h> |
52 | #include <qpainter.h> | 52 | #include <qpainter.h> |
53 | #include <qlabel.h> | 53 | #include <qlabel.h> |
54 | #include <qtextstream.h> | 54 | #include <qtextstream.h> |
55 | 55 | ||
56 | #include "launcherview.h" | 56 | #include "launcherview.h" |
57 | #include "launcher.h" | 57 | #include "launcher.h" |
58 | #include "syncdialog.h" | 58 | #include "syncdialog.h" |
59 | #include "desktop.h" | 59 | #include "desktop.h" |
60 | #include <qpe/lnkproperties.h> | 60 | #include <qpe/lnkproperties.h> |
61 | #include "mrulist.h" | 61 | #include "mrulist.h" |
62 | #include "qrsync.h" | 62 | #include "qrsync.h" |
63 | #include <stdlib.h> | 63 | #include <stdlib.h> |
64 | #include <unistd.h> | 64 | #include <unistd.h> |
65 | 65 | ||
66 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 66 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
67 | #include <stdio.h> | 67 | #include <stdio.h> |
68 | #include <sys/vfs.h> | 68 | #include <sys/vfs.h> |
69 | #include <mntent.h> | 69 | #include <mntent.h> |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | #include <qpe/storage.h> | 72 | #include <qpe/storage.h> |
73 | #include "mediummountgui.h" | 73 | #include "mediummountgui.h" |
74 | //#define SHOW_ALL | 74 | //#define SHOW_ALL |
75 | 75 | ||
76 | // uidGen | ||
77 | |||
78 | // uidGen | ||
79 | |||
76 | CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : | 80 | CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : |
77 | QVBox( parent ) | 81 | QVBox( parent ) |
78 | { | 82 | { |
79 | categoryBar = 0; | 83 | categoryBar = 0; |
80 | stack = 0; | 84 | stack = 0; |
81 | } | 85 | } |
82 | 86 | ||
83 | void CategoryTabWidget::prevTab() | 87 | void CategoryTabWidget::prevTab() |
84 | { | 88 | { |
85 | if ( categoryBar ) { | 89 | if ( categoryBar ) { |
86 | int n = categoryBar->count(); | 90 | int n = categoryBar->count(); |
87 | int tab = categoryBar->currentTab(); | 91 | int tab = categoryBar->currentTab(); |
88 | if ( tab >= 0 ) | 92 | if ( tab >= 0 ) |
89 | categoryBar->setCurrentTab( (tab - 1 + n)%n ); | 93 | categoryBar->setCurrentTab( (tab - 1 + n)%n ); |
90 | } | 94 | } |
91 | } | 95 | } |
92 | 96 | ||
93 | void CategoryTabWidget::nextTab() | 97 | void CategoryTabWidget::nextTab() |
94 | { | 98 | { |
95 | if ( categoryBar ) { | 99 | if ( categoryBar ) { |
96 | int n = categoryBar->count(); | 100 | int n = categoryBar->count(); |
97 | int tab = categoryBar->currentTab(); | 101 | int tab = categoryBar->currentTab(); |
98 | categoryBar->setCurrentTab( (tab + 1)%n ); | 102 | categoryBar->setCurrentTab( (tab + 1)%n ); |
99 | } | 103 | } |
100 | } | 104 | } |
101 | 105 | ||
102 | void CategoryTabWidget::addItem( const QString& linkfile ) | 106 | void CategoryTabWidget::addItem( const QString& linkfile ) |
103 | { | 107 | { |
104 | int i=0; | 108 | int i=0; |
105 | AppLnk *app = new AppLnk(linkfile); | 109 | AppLnk *app = new AppLnk(linkfile); |
106 | if ( !app->isValid() ) { | 110 | if ( !app->isValid() ) { |
107 | delete app; | 111 | delete app; |
108 | return; | 112 | return; |
109 | } | 113 | } |
110 | if ( !app->file().isEmpty() ) { | 114 | if ( !app->file().isEmpty() ) { |
111 | // A document | 115 | // A document |
112 | delete app; | 116 | delete app; |
113 | app = new DocLnk(linkfile); | 117 | app = new DocLnk(linkfile); |
114 | ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); | 118 | ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); |
115 | return; | 119 | return; |
116 | } | 120 | } |
117 | for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { | 121 | for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { |
118 | if ( !(*it).isEmpty() ) { | 122 | if ( !(*it).isEmpty() ) { |
119 | QRegExp tf(*it,FALSE,TRUE); | 123 | QRegExp tf(*it,FALSE,TRUE); |
120 | if ( tf.match(app->type()) >= 0 ) { | 124 | if ( tf.match(app->type()) >= 0 ) { |
121 | ((LauncherView*)stack->widget(i))->addItem(app); | 125 | ((LauncherView*)stack->widget(i))->addItem(app); |
122 | return; | 126 | return; |
123 | } | 127 | } |
@@ -377,206 +381,227 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&, | |||
377 | if ( t->iconSet() ) { | 381 | if ( t->iconSet() ) { |
378 | // the tab has an iconset, draw it in the right mode | 382 | // the tab has an iconset, draw it in the right mode |
379 | QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; | 383 | QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; |
380 | if ( mode == QIconSet::Normal && has_focus ) | 384 | if ( mode == QIconSet::Normal && has_focus ) |
381 | mode = QIconSet::Active; | 385 | mode = QIconSet::Active; |
382 | QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); | 386 | QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); |
383 | int pixw = pixmap.width(); | 387 | int pixw = pixmap.width(); |
384 | int pixh = pixmap.height(); | 388 | int pixh = pixmap.height(); |
385 | p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); | 389 | p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); |
386 | r.setLeft( r.left() + pixw + 5 ); | 390 | r.setLeft( r.left() + pixw + 5 ); |
387 | } | 391 | } |
388 | 392 | ||
389 | QRect tr = r; | 393 | QRect tr = r; |
390 | 394 | ||
391 | if ( r.width() < 20 ) | 395 | if ( r.width() < 20 ) |
392 | return; | 396 | return; |
393 | 397 | ||
394 | if ( t->isEnabled() && isEnabled() ) { | 398 | if ( t->isEnabled() && isEnabled() ) { |
395 | #if defined(_WS_WIN32_) | 399 | #if defined(_WS_WIN32_) |
396 | if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) ) | 400 | if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) ) |
397 | p->setPen( colorGroup().buttonText() ); | 401 | p->setPen( colorGroup().buttonText() ); |
398 | else | 402 | else |
399 | p->setPen( colorGroup().foreground() ); | 403 | p->setPen( colorGroup().foreground() ); |
400 | #else | 404 | #else |
401 | p->setPen( colorGroup().foreground() ); | 405 | p->setPen( colorGroup().foreground() ); |
402 | #endif | 406 | #endif |
403 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); | 407 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); |
404 | } else { | 408 | } else { |
405 | p->setPen( palette().disabled().foreground() ); | 409 | p->setPen( palette().disabled().foreground() ); |
406 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); | 410 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); |
407 | } | 411 | } |
408 | } | 412 | } |
409 | 413 | ||
410 | //--------------------------------------------------------------------------- | 414 | //--------------------------------------------------------------------------- |
411 | 415 | ||
412 | Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) | 416 | Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) |
413 | : QMainWindow( parent, name, fl ) | 417 | : QMainWindow( parent, name, fl ) |
414 | { | 418 | { |
415 | setCaption( tr("Launcher") ); | 419 | setCaption( tr("Launcher") ); |
416 | 420 | ||
417 | syncDialog = 0; | 421 | syncDialog = 0; |
418 | 422 | ||
419 | // we have a pretty good idea how big we'll be | 423 | // we have a pretty good idea how big we'll be |
420 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); | 424 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); |
421 | 425 | ||
422 | tabs = 0; | 426 | tabs = 0; |
423 | rootFolder = 0; | 427 | rootFolder = 0; |
424 | docsFolder = 0; | 428 | docsFolder = 0; |
425 | m_timeStamp = QDateTime::currentDateTime().toString(); | 429 | int stamp = uidgen.generate(); |
430 | uidgen.store( stamp ); | ||
431 | m_timeStamp = QString::number( stamp ); | ||
426 | 432 | ||
427 | tabs = new CategoryTabWidget( this ); | 433 | tabs = new CategoryTabWidget( this ); |
428 | tabs->setMaximumWidth( qApp->desktop()->width() ); | 434 | tabs->setMaximumWidth( qApp->desktop()->width() ); |
429 | setCentralWidget( tabs ); | 435 | setCentralWidget( tabs ); |
430 | 436 | ||
431 | connect( tabs, SIGNAL(selected(const QString&)), | 437 | connect( tabs, SIGNAL(selected(const QString&)), |
432 | this, SLOT(viewSelected(const QString&)) ); | 438 | this, SLOT(viewSelected(const QString&)) ); |
433 | connect( tabs, SIGNAL(clicked(const AppLnk*)), | 439 | connect( tabs, SIGNAL(clicked(const AppLnk*)), |
434 | this, SLOT(select(const AppLnk*))); | 440 | this, SLOT(select(const AppLnk*))); |
435 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 441 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
436 | this, SLOT(properties(AppLnk*))); | 442 | this, SLOT(properties(AppLnk*))); |
437 | 443 | ||
438 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 444 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
439 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 445 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
440 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 446 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
441 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); | 447 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); |
442 | #endif | 448 | #endif |
443 | 449 | ||
444 | storage = new StorageInfo( this ); | 450 | storage = new StorageInfo( this ); |
445 | connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) ); | 451 | connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) ); |
446 | 452 | ||
447 | updateTabs(); | 453 | updateTabs(); |
448 | 454 | ||
449 | preloadApps(); | 455 | preloadApps(); |
450 | 456 | ||
451 | in_lnk_props = FALSE; | 457 | in_lnk_props = FALSE; |
452 | got_lnk_change = FALSE; | 458 | got_lnk_change = FALSE; |
453 | } | 459 | } |
454 | 460 | ||
455 | Launcher::~Launcher() | 461 | Launcher::~Launcher() |
456 | { | 462 | { |
457 | } | 463 | } |
458 | 464 | ||
459 | static bool isVisibleWindow(int wid) | 465 | static bool isVisibleWindow(int wid) |
460 | { | 466 | { |
461 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 467 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
462 | QWSWindow* w; | 468 | QWSWindow* w; |
463 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 469 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
464 | if ( w->winId() == wid ) | 470 | if ( w->winId() == wid ) |
465 | return !w->isFullyObscured(); | 471 | return !w->isFullyObscured(); |
466 | } | 472 | } |
467 | return FALSE; | 473 | return FALSE; |
468 | } | 474 | } |
469 | 475 | ||
470 | void Launcher::showMaximized() | 476 | void Launcher::showMaximized() |
471 | { | 477 | { |
472 | if ( isVisibleWindow( winId() ) ) | 478 | if ( isVisibleWindow( winId() ) ) |
473 | doMaximize(); | 479 | doMaximize(); |
474 | else | 480 | else |
475 | QTimer::singleShot( 20, this, SLOT(doMaximize()) ); | 481 | QTimer::singleShot( 20, this, SLOT(doMaximize()) ); |
476 | } | 482 | } |
477 | 483 | ||
478 | void Launcher::doMaximize() | 484 | void Launcher::doMaximize() |
479 | { | 485 | { |
480 | QMainWindow::showMaximized(); | 486 | QMainWindow::showMaximized(); |
481 | } | 487 | } |
482 | 488 | ||
483 | void Launcher::updateMimeTypes() | 489 | void Launcher::updateMimeTypes() |
484 | { | 490 | { |
485 | MimeType::clear(); | 491 | MimeType::clear(); |
486 | updateMimeTypes(rootFolder); | 492 | updateMimeTypes(rootFolder); |
487 | } | 493 | } |
488 | 494 | ||
489 | void Launcher::updateMimeTypes(AppLnkSet* folder) | 495 | void Launcher::updateMimeTypes(AppLnkSet* folder) |
490 | { | 496 | { |
491 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { | 497 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { |
492 | AppLnk *app = it.current(); | 498 | AppLnk *app = it.current(); |
493 | if ( app->type() == "Folder" ) | 499 | if ( app->type() == "Folder" ) |
494 | updateMimeTypes((AppLnkSet *)app); | 500 | updateMimeTypes((AppLnkSet *)app); |
495 | else { | 501 | else { |
496 | MimeType::registerApp(*app); | 502 | MimeType::registerApp(*app); |
497 | } | 503 | } |
498 | } | 504 | } |
499 | } | 505 | } |
500 | 506 | ||
501 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | 507 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: |
502 | { | 508 | { |
509 | qWarning("loading Documents" ); | ||
510 | qWarning("The currentTimeStamp is: %s", m_timeStamp.latin1() ); | ||
503 | delete docsFolder; | 511 | delete docsFolder; |
504 | docsFolder = new DocLnkSet; | 512 | docsFolder = new DocLnkSet; |
513 | qWarning("new DocLnkSet" ); | ||
505 | // find out wich filesystems are new in this round | 514 | // find out wich filesystems are new in this round |
506 | // We will do this by having a timestamp inside each mountpoint | 515 | // We will do this by having a timestamp inside each mountpoint |
507 | // if the current timestamp doesn't match this is a new file system and | 516 | // if the current timestamp doesn't match this is a new file system and |
508 | // come up with our MediumMountGui :) let the hacking begin | 517 | // come up with our MediumMountGui :) let the hacking begin |
509 | QString newStamp = QDateTime::currentDateTime().toString(); | 518 | int stamp = uidgen.generate(); |
519 | |||
520 | QString newStamp = QString::number( stamp ); | ||
521 | qWarning("new time stamp is: %s", newStamp.latin1() ); | ||
510 | StorageInfo storage; | 522 | StorageInfo storage; |
511 | const QList<FileSystem> &fileSystems = storage.fileSystems(); | 523 | const QList<FileSystem> &fileSystems = storage.fileSystems(); |
524 | qWarning("QList<FileSystem>" ); | ||
512 | QListIterator<FileSystem> it ( fileSystems ); | 525 | QListIterator<FileSystem> it ( fileSystems ); |
526 | qWarning("iterator initiliazed" ); | ||
513 | for ( ; it.current(); ++it ) { | 527 | for ( ; it.current(); ++it ) { |
528 | qWarning("inside for loop" ); | ||
529 | qWarning("checking device %s", (*it)->path().latin1() ); | ||
514 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it | 530 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it |
531 | qWarning("%s is removeable", (*it)->path().latin1() ); | ||
515 | OConfig cfg( (*it)->path() + "/.opiestorage.cf"); | 532 | OConfig cfg( (*it)->path() + "/.opiestorage.cf"); |
516 | cfg.setGroup("main"); | 533 | cfg.setGroup("main"); |
517 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); | 534 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); |
518 | if( stamp == m_timeStamp ){ // ok we know this card | 535 | if( stamp == m_timeStamp ){ // ok we know this card |
536 | qWarning("time stamp match" ); | ||
519 | cfg.writeEntry("timestamp", newStamp ); | 537 | cfg.writeEntry("timestamp", newStamp ); |
520 | // we need to scan the list now. Hopefully the cache will be there | 538 | // we need to scan the list now. Hopefully the cache will be there |
521 | }else{ // come up with the gui | 539 | }else{ // come up with the gui |
522 | MediumMountGui medium((*it)->path() + "/.opiestorage.cf" ); | 540 | qWarning("time stamp doesn't match" ); |
541 | MediumMountGui medium((*it)->path() ); | ||
542 | qWarning("medium mount gui created" ); | ||
523 | if( medium.check() ){ | 543 | if( medium.check() ){ |
544 | qWarning("need to check this device" ); | ||
524 | if( medium.exec() ){ //ok | 545 | if( medium.exec() ){ //ok |
525 | // speicher | 546 | // speicher |
547 | qWarning("execed" ); | ||
526 | cfg.writeEntry("timestamp", newStamp ); | 548 | cfg.writeEntry("timestamp", newStamp ); |
527 | } | 549 | } |
528 | }else{ | 550 | }else{ |
551 | qWarning("wrong :(" ); | ||
529 | // do something different see what we need to do | 552 | // do something different see what we need to do |
530 | } | 553 | } |
531 | } | 554 | } |
532 | } | 555 | } |
533 | } | 556 | } |
557 | qWarning("findDocuments" ); | ||
534 | Global::findDocuments(docsFolder); // get rid of this call later | 558 | Global::findDocuments(docsFolder); // get rid of this call later |
559 | qWarning("done" ); | ||
535 | m_timeStamp = newStamp; | 560 | m_timeStamp = newStamp; |
536 | } | 561 | } |
537 | 562 | ||
538 | void Launcher::updateTabs() | 563 | void Launcher::updateTabs() |
539 | { | 564 | { |
540 | MimeType::updateApplications(); // ### reads all applnks twice | 565 | MimeType::updateApplications(); // ### reads all applnks twice |
541 | 566 | ||
542 | delete rootFolder; | 567 | delete rootFolder; |
543 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); | 568 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); |
544 | 569 | ||
545 | loadDocs(); | 570 | loadDocs(); |
546 | 571 | ||
547 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); | 572 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); |
548 | } | 573 | } |
549 | 574 | ||
550 | void Launcher::updateDocs() | 575 | void Launcher::updateDocs() |
551 | { | 576 | { |
552 | loadDocs(); | 577 | loadDocs(); |
553 | tabs->updateDocs(docsFolder,storage->fileSystems()); | 578 | tabs->updateDocs(docsFolder,storage->fileSystems()); |
554 | } | 579 | } |
555 | 580 | ||
556 | void Launcher::viewSelected(const QString& s) | 581 | void Launcher::viewSelected(const QString& s) |
557 | { | 582 | { |
558 | setCaption( s + tr(" - Launcher") ); | 583 | setCaption( s + tr(" - Launcher") ); |
559 | } | 584 | } |
560 | 585 | ||
561 | void Launcher::nextView() | 586 | void Launcher::nextView() |
562 | { | 587 | { |
563 | tabs->nextTab(); | 588 | tabs->nextTab(); |
564 | } | 589 | } |
565 | 590 | ||
566 | 591 | ||
567 | void Launcher::select( const AppLnk *appLnk ) | 592 | void Launcher::select( const AppLnk *appLnk ) |
568 | { | 593 | { |
569 | if ( appLnk->type() == "Folder" ) { | 594 | if ( appLnk->type() == "Folder" ) { |
570 | // Not supported: flat is simpler for the user | 595 | // Not supported: flat is simpler for the user |
571 | } else { | 596 | } else { |
572 | if ( appLnk->exec().isNull() ) { | 597 | if ( appLnk->exec().isNull() ) { |
573 | QMessageBox::information(this,tr("No application"), | 598 | QMessageBox::information(this,tr("No application"), |
574 | tr("<p>No application is defined for this document." | 599 | tr("<p>No application is defined for this document." |
575 | "<p>Type is %1.").arg(appLnk->type())); | 600 | "<p>Type is %1.").arg(appLnk->type())); |
576 | return; | 601 | return; |
577 | } | 602 | } |
578 | tabs->setBusy(TRUE); | 603 | tabs->setBusy(TRUE); |
579 | emit executing( appLnk ); | 604 | emit executing( appLnk ); |
580 | appLnk->execute(); | 605 | appLnk->execute(); |
581 | } | 606 | } |
582 | } | 607 | } |
diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index 197bd19..d2efa58 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h | |||
@@ -1,75 +1,76 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef LAUNCHER_H | 20 | #ifndef LAUNCHER_H |
21 | #define LAUNCHER_H | 21 | #define LAUNCHER_H |
22 | 22 | ||
23 | #include <qmainwindow.h> | 23 | #include <qmainwindow.h> |
24 | #include <qtabbar.h> | 24 | #include <qtabbar.h> |
25 | #include <qstringlist.h> | 25 | #include <qstringlist.h> |
26 | #include <qvbox.h> | 26 | #include <qvbox.h> |
27 | #include <qlist.h> | 27 | #include <qlist.h> |
28 | #include <qpe/palmtopuidgen.h> | ||
28 | #include "launcherview.h" | 29 | #include "launcherview.h" |
29 | 30 | ||
30 | class AppLnk; | 31 | class AppLnk; |
31 | class AppLnkSet; | 32 | class AppLnkSet; |
32 | class DocLnkSet; | 33 | class DocLnkSet; |
33 | class QWidgetStack; | 34 | class QWidgetStack; |
34 | class StorageInfo; | 35 | class StorageInfo; |
35 | class SyncDialog; | 36 | class SyncDialog; |
36 | 37 | ||
37 | class CategoryTabBar : public QTabBar | 38 | class CategoryTabBar : public QTabBar |
38 | { | 39 | { |
39 | Q_OBJECT | 40 | Q_OBJECT |
40 | public: | 41 | public: |
41 | CategoryTabBar( QWidget *parent=0, const char *name=0 ); | 42 | CategoryTabBar( QWidget *parent=0, const char *name=0 ); |
42 | ~CategoryTabBar(); | 43 | ~CategoryTabBar(); |
43 | 44 | ||
44 | protected slots: | 45 | protected slots: |
45 | virtual void layoutTabs(); | 46 | virtual void layoutTabs(); |
46 | 47 | ||
47 | protected: | 48 | protected: |
48 | void paint ( QPainter *p, QTab *t, bool f ) const; | 49 | void paint ( QPainter *p, QTab *t, bool f ) const; |
49 | void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const; | 50 | void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const; |
50 | }; | 51 | }; |
51 | 52 | ||
52 | class CategoryTabWidget : public QVBox { | 53 | class CategoryTabWidget : public QVBox { |
53 | // can't use a QTabWidget, since it won't let us set the frame style. | 54 | // can't use a QTabWidget, since it won't let us set the frame style. |
54 | Q_OBJECT | 55 | Q_OBJECT |
55 | public: | 56 | public: |
56 | CategoryTabWidget( QWidget* parent ); | 57 | CategoryTabWidget( QWidget* parent ); |
57 | void initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder, | 58 | void initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder, |
58 | const QList<FileSystem> &); | 59 | const QList<FileSystem> &); |
59 | void updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs); | 60 | void updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs); |
60 | void updateLink(const QString& linkfile); | 61 | void updateLink(const QString& linkfile); |
61 | void setBusy(bool on); | 62 | void setBusy(bool on); |
62 | 63 | ||
63 | signals: | 64 | signals: |
64 | void selected(const QString&); | 65 | void selected(const QString&); |
65 | void clicked(const AppLnk*); | 66 | void clicked(const AppLnk*); |
66 | void rightPressed(AppLnk*); | 67 | void rightPressed(AppLnk*); |
67 | 68 | ||
68 | public slots: | 69 | public slots: |
69 | void nextTab(); | 70 | void nextTab(); |
70 | void prevTab(); | 71 | void prevTab(); |
71 | 72 | ||
72 | protected: | 73 | protected: |
73 | void paletteChange( const QPalette &p ); | 74 | void paletteChange( const QPalette &p ); |
74 | 75 | ||
75 | private: | 76 | private: |
@@ -87,52 +88,53 @@ class Launcher : public QMainWindow | |||
87 | Q_OBJECT | 88 | Q_OBJECT |
88 | friend class LauncherPrivate; | 89 | friend class LauncherPrivate; |
89 | public: | 90 | public: |
90 | Launcher( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 91 | Launcher( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
91 | ~Launcher(); | 92 | ~Launcher(); |
92 | 93 | ||
93 | static QString appsFolderName(); | 94 | static QString appsFolderName(); |
94 | 95 | ||
95 | virtual void showMaximized(); | 96 | virtual void showMaximized(); |
96 | static bool mkdir(const QString &path); | 97 | static bool mkdir(const QString &path); |
97 | 98 | ||
98 | public slots: | 99 | public slots: |
99 | void viewSelected(const QString&); | 100 | void viewSelected(const QString&); |
100 | void select( const AppLnk * ); | 101 | void select( const AppLnk * ); |
101 | void externalSelected( const AppLnk *); | 102 | void externalSelected( const AppLnk *); |
102 | void properties( AppLnk * ); | 103 | void properties( AppLnk * ); |
103 | void nextView(); | 104 | void nextView(); |
104 | 105 | ||
105 | signals: | 106 | signals: |
106 | void executing( const AppLnk * ); | 107 | void executing( const AppLnk * ); |
107 | void busy(); | 108 | void busy(); |
108 | void notBusy(const QString&); | 109 | void notBusy(const QString&); |
109 | 110 | ||
110 | private slots: | 111 | private slots: |
111 | void doMaximize(); | 112 | void doMaximize(); |
112 | void systemMessage( const QCString &, const QByteArray &); | 113 | void systemMessage( const QCString &, const QByteArray &); |
113 | void storageChanged(); | 114 | void storageChanged(); |
114 | void cancelSync(); | 115 | void cancelSync(); |
115 | 116 | ||
116 | private: | 117 | private: |
117 | void updateApps(); | 118 | void updateApps(); |
118 | void loadDocs(); | 119 | void loadDocs(); |
119 | void updateDocs(); | 120 | void updateDocs(); |
120 | void updateTabs(); | 121 | void updateTabs(); |
121 | void updateMimeTypes(); | 122 | void updateMimeTypes(); |
122 | void updateMimeTypes(AppLnkSet*); | 123 | void updateMimeTypes(AppLnkSet*); |
123 | void preloadApps(); | 124 | void preloadApps(); |
124 | AppLnkSet *rootFolder; | 125 | AppLnkSet *rootFolder; |
125 | DocLnkSet *docsFolder; | 126 | DocLnkSet *docsFolder; |
126 | CategoryTabWidget *tabs; | 127 | CategoryTabWidget *tabs; |
127 | StorageInfo *storage; | 128 | StorageInfo *storage; |
128 | SyncDialog *syncDialog; | 129 | SyncDialog *syncDialog; |
129 | 130 | ||
130 | void updateLink(const QString& link); | 131 | void updateLink(const QString& link); |
131 | bool in_lnk_props; | 132 | bool in_lnk_props; |
132 | bool got_lnk_change; | 133 | bool got_lnk_change; |
133 | QString lnk_change; | 134 | QString lnk_change; |
134 | QString m_timeStamp; | 135 | QString m_timeStamp; |
136 | Qtopia::UidGen uidgen; | ||
135 | }; | 137 | }; |
136 | 138 | ||
137 | #endif // LAUNCHERVIEW_H | 139 | #endif // LAUNCHERVIEW_H |
138 | 140 | ||
diff --git a/core/launcher/mediummountgui.cpp b/core/launcher/mediummountgui.cpp index f193024..6ad97e1 100644 --- a/core/launcher/mediummountgui.cpp +++ b/core/launcher/mediummountgui.cpp | |||
@@ -1,90 +1,90 @@ | |||
1 | 1 | ||
2 | #include "mediummountgui.h" | 2 | #include "mediummountgui.h" |
3 | 3 | ||
4 | #include <qvariant.h> | 4 | #include <qvariant.h> |
5 | #include <qcheckbox.h> | 5 | #include <qcheckbox.h> |
6 | #include <qgroupbox.h> | 6 | #include <qgroupbox.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qlayout.h> | 10 | #include <qlayout.h> |
11 | #include <qtooltip.h> | 11 | #include <qtooltip.h> |
12 | #include <qwhatsthis.h> | 12 | #include <qwhatsthis.h> |
13 | #include <qimage.h> | 13 | #include <qimage.h> |
14 | #include <qpixmap.h> | 14 | #include <qpixmap.h> |
15 | 15 | ||
16 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
17 | #include <opie/oconfig.h> | 17 | #include <opie/oconfig.h> |
18 | 18 | ||
19 | 19 | ||
20 | #include <qapplication.h> | 20 | #include <qapplication.h> |
21 | 21 | ||
22 | 22 | ||
23 | MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const char* name, bool modal, WFlags fl ) | 23 | MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const char* name, bool modal, WFlags fl ) |
24 | : QDialog( parent, name, modal, fl ) { | 24 | : QDialog( parent, name, true ) { |
25 | 25 | ||
26 | 26 | ||
27 | QWidget *d = QApplication::desktop(); | 27 | QWidget *d = QApplication::desktop(); |
28 | int w=d->width(); | 28 | int w=d->width(); |
29 | int h=d->height(); | 29 | int h=d->height(); |
30 | resize( w , h ); | 30 | resize( w , h ); |
31 | setCaption( tr( "Medium inserted" ) ); | 31 | setCaption( tr( "Medium inserted" ) ); |
32 | 32 | ||
33 | mediumPath = path; | 33 | mediumPath = path; |
34 | readConfig(); | 34 | readConfig(); |
35 | startGui(); | 35 | startGui(); |
36 | } | 36 | } |
37 | 37 | ||
38 | void MediumMountGui::readConfig(){ | 38 | void MediumMountGui::readConfig(){ |
39 | 39 | ||
40 | OConfig cfg (mediumPath +"/.opiestorage.cf"); | 40 | OConfig cfg (mediumPath +"/.opiestorage.cf"); |
41 | cfg.setGroup("main"); | 41 | cfg.setGroup("main"); |
42 | checkagain = cfg.readBoolEntry("check", false); | 42 | checkagain = cfg.readBoolEntry("check", true); |
43 | 43 | ||
44 | cfg.setGroup("mimetypes"); | 44 | cfg.setGroup("mimetypes"); |
45 | checkmimeaudio = cfg.readBoolEntry("audio", true); | 45 | checkmimeaudio = cfg.readBoolEntry("audio", true); |
46 | checkmimeimage = cfg.readBoolEntry("image", true); | 46 | checkmimeimage = cfg.readBoolEntry("image", true); |
47 | checkmimetext = cfg.readBoolEntry("text", true); | 47 | checkmimetext = cfg.readBoolEntry("text", true); |
48 | checkmimevideo = cfg.readBoolEntry("video", true); | 48 | checkmimevideo = cfg.readBoolEntry("video", true); |
49 | checkmimeall = cfg.readBoolEntry("all", true); | 49 | checkmimeall = cfg.readBoolEntry("all", true); |
50 | 50 | ||
51 | cfg.setGroup("dirs"); | 51 | cfg.setGroup("dirs"); |
52 | limittodirs = cfg.readEntry("dirs", ""); | 52 | limittodirs = cfg.readEntry("dirs", ""); |
53 | } | 53 | } |
54 | 54 | ||
55 | bool MediumMountGui::check() { | 55 | bool MediumMountGui::check() { |
56 | return checkagain; | 56 | return checkagain; |
57 | } | 57 | } |
58 | 58 | ||
59 | QStringList MediumMountGui::dirs() { | 59 | QStringList MediumMountGui::dirs() { |
60 | QStringList list = QStringList::split(",", limittodirs ); | 60 | QStringList list = QStringList::split(",", limittodirs ); |
61 | return list; | 61 | return list; |
62 | } | 62 | } |
63 | 63 | ||
64 | void MediumMountGui::writeConfig(bool autocheck) { | 64 | void MediumMountGui::writeConfig(bool autocheck) { |
65 | 65 | ||
66 | OConfig cfg (mediumPath +"/.opiestorage.cf"); | 66 | OConfig cfg (mediumPath +"/.opiestorage.cf"); |
67 | cfg.setGroup("main"); | 67 | cfg.setGroup("main"); |
68 | cfg.writeEntry("check", AskBox->isChecked() ); | 68 | cfg.writeEntry("check", AskBox->isChecked() ); |
69 | cfg.writeEntry("autocheck", autocheck ); | 69 | cfg.writeEntry("autocheck", autocheck ); |
70 | 70 | ||
71 | cfg.setGroup("mimetypes"); | 71 | cfg.setGroup("mimetypes"); |
72 | 72 | ||
73 | cfg.writeEntry("audio", CheckBoxAudio->isChecked() ); | 73 | cfg.writeEntry("audio", CheckBoxAudio->isChecked() ); |
74 | cfg.writeEntry("image",CheckBoxImage->isChecked() ); | 74 | cfg.writeEntry("image",CheckBoxImage->isChecked() ); |
75 | cfg.writeEntry("text",CheckBoxImage->isChecked() ); | 75 | cfg.writeEntry("text",CheckBoxImage->isChecked() ); |
76 | cfg.writeEntry("video",CheckBoxVideo->isChecked() ); | 76 | cfg.writeEntry("video",CheckBoxVideo->isChecked() ); |
77 | cfg.writeEntry("all",CheckBoxAll->isChecked() ); | 77 | cfg.writeEntry("all",CheckBoxAll->isChecked() ); |
78 | 78 | ||
79 | cfg.setGroup("dirs"); | 79 | cfg.setGroup("dirs"); |
80 | cfg.writeEntry("dirs", ""); | 80 | cfg.writeEntry("dirs", ""); |
81 | 81 | ||
82 | 82 | ||
83 | // if all is checked then add only "null" to the list. | 83 | // if all is checked then add only "null" to the list. |
84 | if (checkmimeall) { | 84 | if (checkmimeall) { |
85 | mimeTypeList += ("null"); | 85 | mimeTypeList += ("null"); |
86 | } else { | 86 | } else { |
87 | if (checkmimeaudio) { | 87 | if (checkmimeaudio) { |
88 | mimeTypeList += ("audio//*"); | 88 | mimeTypeList += ("audio//*"); |
89 | } | 89 | } |
90 | if (checkmimetext) { | 90 | if (checkmimetext) { |