-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 | |||
@@ -1,171 +1,175 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (c) 2002 Holger zecke Freyther | 2 | ** Copyright (c) 2002 Holger zecke Freyther |
3 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 3 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
4 | ** | 4 | ** |
5 | ** This file is part of Qtopia Environment. | 5 | ** This file is part of Qtopia Environment. |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | 22 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT |
23 | // have this class. | 23 | // have this class. |
24 | #define QTOPIA_INTERNAL_FSLP | 24 | #define QTOPIA_INTERNAL_FSLP |
25 | 25 | ||
26 | #include <opie/oconfig.h> | 26 | #include <opie/oconfig.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
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 | } |
124 | i++; | 128 | i++; |
125 | } | 129 | } |
126 | } | 130 | } |
127 | } | 131 | } |
128 | 132 | ||
129 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | 133 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, |
130 | AppLnkSet* docFolder, const QList<FileSystem> &fs) | 134 | AppLnkSet* docFolder, const QList<FileSystem> &fs) |
131 | { | 135 | { |
132 | delete categoryBar; | 136 | delete categoryBar; |
133 | categoryBar = new CategoryTabBar( this ); | 137 | categoryBar = new CategoryTabBar( this ); |
134 | QPalette pal = categoryBar->palette(); | 138 | QPalette pal = categoryBar->palette(); |
135 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 139 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
136 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 140 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
137 | categoryBar->setPalette( pal ); | 141 | categoryBar->setPalette( pal ); |
138 | 142 | ||
139 | delete stack; | 143 | delete stack; |
140 | stack = new QWidgetStack(this); | 144 | stack = new QWidgetStack(this); |
141 | tabs=0; | 145 | tabs=0; |
142 | 146 | ||
143 | ids.clear(); | 147 | ids.clear(); |
144 | 148 | ||
145 | QStringList types = rootFolder->types(); | 149 | QStringList types = rootFolder->types(); |
146 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { | 150 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { |
147 | if ( !(*it).isEmpty() ) { | 151 | if ( !(*it).isEmpty() ) { |
148 | newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); | 152 | newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); |
149 | } | 153 | } |
150 | } | 154 | } |
151 | QListIterator<AppLnk> it( rootFolder->children() ); | 155 | QListIterator<AppLnk> it( rootFolder->children() ); |
152 | AppLnk* l; | 156 | AppLnk* l; |
153 | while ( (l=it.current()) ) { | 157 | while ( (l=it.current()) ) { |
154 | if ( l->type() == "Separator" ) { | 158 | if ( l->type() == "Separator" ) { |
155 | rootFolder->remove(l); | 159 | rootFolder->remove(l); |
156 | delete l; | 160 | delete l; |
157 | } else { | 161 | } else { |
158 | int i=0; | 162 | int i=0; |
159 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { | 163 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { |
160 | if ( *it == l->type() ) | 164 | if ( *it == l->type() ) |
161 | ((LauncherView*)stack->widget(i))->addItem(l,FALSE); | 165 | ((LauncherView*)stack->widget(i))->addItem(l,FALSE); |
162 | i++; | 166 | i++; |
163 | } | 167 | } |
164 | } | 168 | } |
165 | ++it; | 169 | ++it; |
166 | } | 170 | } |
167 | rootFolder->detachChildren(); | 171 | rootFolder->detachChildren(); |
168 | for (int i=0; i<tabs; i++) | 172 | for (int i=0; i<tabs; i++) |
169 | ((LauncherView*)stack->widget(i))->sort(); | 173 | ((LauncherView*)stack->widget(i))->sort(); |
170 | 174 | ||
171 | // all documents | 175 | // all documents |
@@ -329,302 +333,323 @@ void CategoryTabBar::layoutTabs() | |||
329 | update(); | 333 | update(); |
330 | } | 334 | } |
331 | 335 | ||
332 | 336 | ||
333 | void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const | 337 | void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const |
334 | { | 338 | { |
335 | #if QT_VERSION >= 300 | 339 | #if QT_VERSION >= 300 |
336 | QStyle::SFlags flags = QStyle::Style_Default; | 340 | QStyle::SFlags flags = QStyle::Style_Default; |
337 | if ( selected ) | 341 | if ( selected ) |
338 | flags |= QStyle::Style_Selected; | 342 | flags |= QStyle::Style_Selected; |
339 | style().drawControl( QStyle::CE_TabBarTab, p, this, t->rect(), | 343 | style().drawControl( QStyle::CE_TabBarTab, p, this, t->rect(), |
340 | colorGroup(), flags, QStyleOption(t) ); | 344 | colorGroup(), flags, QStyleOption(t) ); |
341 | #else | 345 | #else |
342 | style().drawTab( p, this, t, selected ); | 346 | style().drawTab( p, this, t, selected ); |
343 | #endif | 347 | #endif |
344 | 348 | ||
345 | QRect r( t->rect() ); | 349 | QRect r( t->rect() ); |
346 | QFont f( font() ); | 350 | QFont f( font() ); |
347 | if ( selected ) | 351 | if ( selected ) |
348 | f.setBold( TRUE ); | 352 | f.setBold( TRUE ); |
349 | p->setFont( f ); | 353 | p->setFont( f ); |
350 | 354 | ||
351 | int iw = 0; | 355 | int iw = 0; |
352 | int ih = 0; | 356 | int ih = 0; |
353 | if ( t->iconSet() != 0 ) { | 357 | if ( t->iconSet() != 0 ) { |
354 | iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; | 358 | iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; |
355 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 359 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); |
356 | } | 360 | } |
357 | int w = iw + p->fontMetrics().width( t->text() ) + 4; | 361 | int w = iw + p->fontMetrics().width( t->text() ) + 4; |
358 | int h = QMAX(p->fontMetrics().height() + 4, ih ); | 362 | int h = QMAX(p->fontMetrics().height() + 4, ih ); |
359 | paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, | 363 | paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, |
360 | r.top() + (r.height()-h)/2, w, h ), t, | 364 | r.top() + (r.height()-h)/2, w, h ), t, |
361 | #if QT_VERSION >= 300 | 365 | #if QT_VERSION >= 300 |
362 | t->identifier() == keyboardFocusTab() | 366 | t->identifier() == keyboardFocusTab() |
363 | #else | 367 | #else |
364 | t->identitifer() == keyboardFocusTab() | 368 | t->identitifer() == keyboardFocusTab() |
365 | #endif | 369 | #endif |
366 | ); | 370 | ); |
367 | } | 371 | } |
368 | 372 | ||
369 | 373 | ||
370 | void CategoryTabBar::paintLabel( QPainter* p, const QRect&, | 374 | void CategoryTabBar::paintLabel( QPainter* p, const QRect&, |
371 | QTab* t, bool has_focus ) const | 375 | QTab* t, bool has_focus ) const |
372 | { | 376 | { |
373 | QRect r = t->rect(); | 377 | QRect r = t->rect(); |
374 | // if ( t->id != currentTab() ) | 378 | // if ( t->id != currentTab() ) |
375 | //r.moveBy( 1, 1 ); | 379 | //r.moveBy( 1, 1 ); |
376 | // | 380 | // |
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 | } |
583 | 608 | ||
584 | void Launcher::externalSelected(const AppLnk *appLnk) | 609 | void Launcher::externalSelected(const AppLnk *appLnk) |
585 | { | 610 | { |
586 | tabs->setBusy(TRUE); | 611 | tabs->setBusy(TRUE); |
587 | emit executing( appLnk ); | 612 | emit executing( appLnk ); |
588 | } | 613 | } |
589 | 614 | ||
590 | void Launcher::properties( AppLnk *appLnk ) | 615 | void Launcher::properties( AppLnk *appLnk ) |
591 | { | 616 | { |
592 | if ( appLnk->type() == "Folder" ) { | 617 | if ( appLnk->type() == "Folder" ) { |
593 | // Not supported: flat is simpler for the user | 618 | // Not supported: flat is simpler for the user |
594 | } else { | 619 | } else { |
595 | in_lnk_props = TRUE; | 620 | in_lnk_props = TRUE; |
596 | got_lnk_change = FALSE; | 621 | got_lnk_change = FALSE; |
597 | LnkProperties prop(appLnk); | 622 | LnkProperties prop(appLnk); |
598 | connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 623 | connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
599 | prop.showMaximized(); | 624 | prop.showMaximized(); |
600 | prop.exec(); | 625 | prop.exec(); |
601 | in_lnk_props = FALSE; | 626 | in_lnk_props = FALSE; |
602 | if ( got_lnk_change ) { | 627 | if ( got_lnk_change ) { |
603 | updateLink(lnk_change); | 628 | updateLink(lnk_change); |
604 | } | 629 | } |
605 | } | 630 | } |
606 | } | 631 | } |
607 | 632 | ||
608 | void Launcher::updateLink(const QString& link) | 633 | void Launcher::updateLink(const QString& link) |
609 | { | 634 | { |
610 | if (link.isNull()) | 635 | if (link.isNull()) |
611 | updateTabs(); | 636 | updateTabs(); |
612 | else if (link.isEmpty()) | 637 | else if (link.isEmpty()) |
613 | updateDocs(); | 638 | updateDocs(); |
614 | else | 639 | else |
615 | tabs->updateLink(link); | 640 | tabs->updateLink(link); |
616 | } | 641 | } |
617 | 642 | ||
618 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | 643 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) |
619 | { | 644 | { |
620 | QDataStream stream( data, IO_ReadOnly ); | 645 | QDataStream stream( data, IO_ReadOnly ); |
621 | if ( msg == "linkChanged(QString)" ) { | 646 | if ( msg == "linkChanged(QString)" ) { |
622 | QString link; | 647 | QString link; |
623 | stream >> link; | 648 | stream >> link; |
624 | if ( in_lnk_props ) { | 649 | if ( in_lnk_props ) { |
625 | got_lnk_change = TRUE; | 650 | got_lnk_change = TRUE; |
626 | lnk_change = link; | 651 | lnk_change = link; |
627 | } else { | 652 | } else { |
628 | updateLink(link); | 653 | updateLink(link); |
629 | } | 654 | } |
630 | } else if ( msg == "busy()" ) { | 655 | } else if ( msg == "busy()" ) { |
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,138 +1,140 @@ | |||
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: |
76 | CategoryTabBar* categoryBar; | 77 | CategoryTabBar* categoryBar; |
77 | QWidgetStack* stack; | 78 | QWidgetStack* stack; |
78 | LauncherView* docview; | 79 | LauncherView* docview; |
79 | QStringList ids; | 80 | QStringList ids; |
80 | int tabs; | 81 | int tabs; |
81 | LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); | 82 | LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); |
82 | void addItem( const QString& ); | 83 | void addItem( const QString& ); |
83 | }; | 84 | }; |
84 | 85 | ||
85 | class Launcher : public QMainWindow | 86 | class Launcher : public QMainWindow |
86 | { | 87 | { |
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,138 +1,138 @@ | |||
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) { |
91 | mimeTypeList += ("text//*"); | 91 | mimeTypeList += ("text//*"); |
92 | } | 92 | } |
93 | if (checkmimevideo) { | 93 | if (checkmimevideo) { |
94 | mimeTypeList += ("video//*"); | 94 | mimeTypeList += ("video//*"); |
95 | } | 95 | } |
96 | if (checkmimeimage) { | 96 | if (checkmimeimage) { |
97 | mimeTypeList += ("image//*"); | 97 | mimeTypeList += ("image//*"); |
98 | } | 98 | } |
99 | if (checkmimeall) { | 99 | if (checkmimeall) { |
100 | mimeTypeList << ("null"); | 100 | mimeTypeList << ("null"); |
101 | } | 101 | } |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | void MediumMountGui::startGui() { | 105 | void MediumMountGui::startGui() { |
106 | 106 | ||
107 | QPixmap image = Resource::loadPixmap( "HelpBrowser"); | 107 | QPixmap image = Resource::loadPixmap( "HelpBrowser"); |
108 | 108 | ||
109 | Text_2 = new QLabel( this ); | 109 | Text_2 = new QLabel( this ); |
110 | Text_2->setGeometry( QRect( 10, 15, 40, 40 ) ); | 110 | Text_2->setGeometry( QRect( 10, 15, 40, 40 ) ); |
111 | Text_2->setPixmap( image ); | 111 | Text_2->setPixmap( image ); |
112 | 112 | ||
113 | Text = new QLabel( this, "Text" ); | 113 | Text = new QLabel( this, "Text" ); |
114 | Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) ); | 114 | Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) ); |
115 | Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) ); | 115 | Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) ); |
116 | 116 | ||
117 | // media box | 117 | // media box |
118 | GroupBox1 = new QGroupBox( this, "GroupBox1" ); | 118 | GroupBox1 = new QGroupBox( this, "GroupBox1" ); |
119 | GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 80 ) ); | 119 | GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 80 ) ); |
120 | GroupBox1->setTitle( tr( "Which media files" ) ); | 120 | GroupBox1->setTitle( tr( "Which media files" ) ); |
121 | 121 | ||
122 | CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" ); | 122 | CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" ); |
123 | CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) ); | 123 | CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) ); |
124 | CheckBoxAudio->setText( tr( "Audio" ) ); | 124 | CheckBoxAudio->setText( tr( "Audio" ) ); |
125 | 125 | ||
126 | CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" ); | 126 | CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" ); |
127 | CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) ); | 127 | CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) ); |
128 | CheckBoxImage->setText( tr( "Image" ) ); | 128 | CheckBoxImage->setText( tr( "Image" ) ); |
129 | 129 | ||
130 | CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" ); | 130 | CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" ); |
131 | CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) ); | 131 | CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) ); |
132 | CheckBoxText->setText( tr( "Text" ) ); | 132 | CheckBoxText->setText( tr( "Text" ) ); |
133 | 133 | ||
134 | CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" ); | 134 | CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" ); |
135 | CheckBoxVideo->setGeometry( QRect( (GroupBox1->width()/2), 35, (GroupBox1->width()/2)-15, 15 ) ); | 135 | CheckBoxVideo->setGeometry( QRect( (GroupBox1->width()/2), 35, (GroupBox1->width()/2)-15, 15 ) ); |
136 | CheckBoxVideo->setText( tr( "Video" ) ); | 136 | CheckBoxVideo->setText( tr( "Video" ) ); |
137 | 137 | ||
138 | CheckBoxAll = new QCheckBox ( GroupBox1); | 138 | CheckBoxAll = new QCheckBox ( GroupBox1); |