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 | |||
@@ -64,24 +64,28 @@ | |||
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(); |
@@ -413,25 +417,27 @@ 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 | ||
@@ -491,56 +497,75 @@ void Launcher::updateMimeTypes(AppLnkSet* folder) | |||
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 | ||
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 | |||
@@ -16,24 +16,25 @@ | |||
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 |
@@ -123,16 +124,17 @@ private: | |||
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 | |||
@@ -12,43 +12,43 @@ | |||
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 | ||