-rw-r--r-- | core/applets/batteryapplet/battery.cpp | 14 | ||||
-rw-r--r-- | core/applets/batteryapplet/batterystatus.cpp | 2 | ||||
-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 4 | ||||
-rw-r--r-- | core/applets/homeapplet/home.h | 4 | ||||
-rw-r--r-- | core/applets/restartapplet2/.cvsignore | 1 | ||||
-rw-r--r-- | core/applets/suspendapplet/suspend.h | 4 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 1188 | ||||
-rw-r--r-- | core/obex/obex.cc | 15 | ||||
-rw-r--r-- | core/obex/obexhandler.cpp | 2 | ||||
-rw-r--r-- | core/obex/obeximpl.cpp | 2 | ||||
-rw-r--r-- | core/obex/obexsend.cpp | 2 | ||||
-rw-r--r-- | core/obex/receiver.cpp | 73 | ||||
-rw-r--r-- | core/obex/receiver.h | 5 |
13 files changed, 652 insertions, 664 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp index 480d261..078ce8d 100644 --- a/core/applets/batteryapplet/battery.cpp +++ b/core/applets/batteryapplet/battery.cpp | |||
@@ -124,14 +124,4 @@ void BatteryMeter::paintEvent( QPaintEvent* ) | |||
124 | p.setFont( f ); | 124 | p.setFont( f ); |
125 | if ( percent > 98 ) { | 125 | p.drawText( 0, AppLnk::smallIconSize()/2, QString::number( percent ) ); |
126 | p.drawText( 0, 0, width(), height(), Qt::AlignCenter, tr( "F" ) ); | 126 | p.drawText( AppLnk::smallIconSize()/4, AppLnk::smallIconSize(), "%" ); |
127 | } | ||
128 | else if ( percent < 5 ) | ||
129 | { | ||
130 | p.drawText( 0, 0, width(), height(), Qt::AlignCenter, tr( "E" ) ); | ||
131 | } | ||
132 | else | ||
133 | { | ||
134 | p.drawText( 0, AppLnk::smallIconSize()/2, QString::number( percent ) ); | ||
135 | p.drawText( AppLnk::smallIconSize()/4, AppLnk::smallIconSize(), "%" ); | ||
136 | } | ||
137 | return; | 127 | return; |
diff --git a/core/applets/batteryapplet/batterystatus.cpp b/core/applets/batteryapplet/batterystatus.cpp index 092a48d..5936b5d 100644 --- a/core/applets/batteryapplet/batterystatus.cpp +++ b/core/applets/batteryapplet/batterystatus.cpp | |||
@@ -242,3 +242,3 @@ void BatteryStatus::paintEvent( QPaintEvent * ) { | |||
242 | 242 | ||
243 | int jackPerc = ( jackPercent / 100.0 ) * screenWidth - 47; | 243 | int jackPerc = ( jackPercent / 100.0 ) * ( screenWidth - 47 ) ; |
244 | 244 | ||
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index b8c4553..4ed09b8 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -274,3 +274,5 @@ bool CardMonitor::getStatusPcmcia(int showPopUp) | |||
274 | } | 274 | } |
275 | #ifndef QT_NO_SOUND | ||
275 | QSound::play(Resource::findSound("cardmon/card" + what)); | 276 | QSound::play(Resource::findSound("cardmon/card" + what)); |
277 | #endif | ||
276 | } | 278 | } |
@@ -326,3 +328,5 @@ bool CardMonitor::getStatusSd(int showPopUp) | |||
326 | //qDebug("TEXT: " + text ); | 328 | //qDebug("TEXT: " + text ); |
329 | #ifndef QT_NO_SOUND | ||
327 | QSound::play(Resource::findSound("cardmon/card" + what)); | 330 | QSound::play(Resource::findSound("cardmon/card" + what)); |
331 | #endif | ||
328 | popUp(text, "cardmon/ide");// XX add SD pic | 332 | popUp(text, "cardmon/ide");// XX add SD pic |
diff --git a/core/applets/homeapplet/home.h b/core/applets/homeapplet/home.h index 64af97d..1186caf 100644 --- a/core/applets/homeapplet/home.h +++ b/core/applets/homeapplet/home.h | |||
@@ -34,3 +34,3 @@ public: | |||
34 | virtual int position() const; | 34 | virtual int position() const; |
35 | 35 | ||
36 | virtual QString name ( ) const; | 36 | virtual QString name ( ) const; |
@@ -41,3 +41,3 @@ public: | |||
41 | virtual QPopupMenu *popup ( QWidget *parent ) const; | 41 | virtual QPopupMenu *popup ( QWidget *parent ) const; |
42 | 42 | ||
43 | virtual void activated ( ); | 43 | virtual void activated ( ); |
diff --git a/core/applets/restartapplet2/.cvsignore b/core/applets/restartapplet2/.cvsignore index a403d26..4943911 100644 --- a/core/applets/restartapplet2/.cvsignore +++ b/core/applets/restartapplet2/.cvsignore | |||
@@ -6,2 +6 @@ moc_* | |||
6 | opieobjconfig.in | opieobjconfig.in | |
7 | opieobj | ||
diff --git a/core/applets/suspendapplet/suspend.h b/core/applets/suspendapplet/suspend.h index 0c92bcb..75467c1 100644 --- a/core/applets/suspendapplet/suspend.h +++ b/core/applets/suspendapplet/suspend.h | |||
@@ -34,3 +34,3 @@ public: | |||
34 | virtual int position() const; | 34 | virtual int position() const; |
35 | 35 | ||
36 | virtual QString name ( ) const; | 36 | virtual QString name ( ) const; |
@@ -41,3 +41,3 @@ public: | |||
41 | virtual QPopupMenu *popup ( QWidget *parent ) const; | 41 | virtual QPopupMenu *popup ( QWidget *parent ) const; |
42 | 42 | ||
43 | virtual void activated ( ); | 43 | virtual void activated ( ); |
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 0205622..8b2907a 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -24,4 +24,2 @@ | |||
24 | 24 | ||
25 | //#include <opie/ofiledialog.h> | ||
26 | #include <opie/ofileselector.h> | ||
27 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
@@ -93,3 +91,3 @@ namespace { | |||
93 | if(tmpMime ) | 91 | if(tmpMime ) |
94 | mimes.append("audio/*" ); | 92 | mimes.append("audio/*" ); |
95 | 93 | ||
@@ -97,3 +95,3 @@ namespace { | |||
97 | if(tmpMime ) | 95 | if(tmpMime ) |
98 | mimes.append("image/*" ); | 96 | mimes.append("image/*" ); |
99 | 97 | ||
@@ -101,3 +99,3 @@ namespace { | |||
101 | if(tmpMime ) | 99 | if(tmpMime ) |
102 | mimes.append("text/*"); | 100 | mimes.append("text/*"); |
103 | 101 | ||
@@ -105,3 +103,3 @@ namespace { | |||
105 | if(tmpMime ) | 103 | if(tmpMime ) |
106 | mimes.append("video/*" ); | 104 | mimes.append("video/*" ); |
107 | } | 105 | } |
@@ -120,3 +118,3 @@ public: | |||
120 | CategoryTab( const QIconSet &icon, const QString &text=QString::null ) | 118 | CategoryTab( const QIconSet &icon, const QString &text=QString::null ) |
121 | : QTab( icon, text ) | 119 | : QTab( icon, text ) |
122 | { | 120 | { |
@@ -140,5 +138,5 @@ void CategoryTabWidget::prevTab() | |||
140 | if ( categoryBar ) { | 138 | if ( categoryBar ) { |
141 | int n = categoryBar->count(); | 139 | int n = categoryBar->count(); |
142 | int tab = categoryBar->currentTab(); | 140 | int tab = categoryBar->currentTab(); |
143 | if ( tab >= 0 ) | 141 | if ( tab >= 0 ) |
144 | categoryBar->setCurrentTab( (tab - 1 + n)%n ); | 142 | categoryBar->setCurrentTab( (tab - 1 + n)%n ); |
@@ -150,5 +148,5 @@ void CategoryTabWidget::nextTab() | |||
150 | if ( categoryBar ) { | 148 | if ( categoryBar ) { |
151 | int n = categoryBar->count(); | 149 | int n = categoryBar->count(); |
152 | int tab = categoryBar->currentTab(); | 150 | int tab = categoryBar->currentTab(); |
153 | categoryBar->setCurrentTab( (tab + 1)%n ); | 151 | categoryBar->setCurrentTab( (tab + 1)%n ); |
154 | } | 152 | } |
@@ -160,4 +158,4 @@ void CategoryTabWidget::showTab(const QString& id) | |||
160 | if ( categoryBar ) { | 158 | if ( categoryBar ) { |
161 | int idx = ids.findIndex( id ); | 159 | int idx = ids.findIndex( id ); |
162 | categoryBar->setCurrentTab( idx ); | 160 | categoryBar->setCurrentTab( idx ); |
163 | } | 161 | } |
@@ -167,33 +165,33 @@ void CategoryTabWidget::addItem( const QString& linkfile ) | |||
167 | { | 165 | { |
168 | // int i=0; | 166 | int i=0; |
169 | // AppLnk *app = new AppLnk(linkfile); | 167 | AppLnk *app = new AppLnk(linkfile); |
170 | // if ( !app->isValid() ) { | 168 | if ( !app->isValid() ) { |
171 | // delete app; | 169 | delete app; |
172 | // app=0; | 170 | app=0; |
173 | // } | 171 | } |
174 | // if ( !app || !app->file().isEmpty() ) { | 172 | if ( !app || !app->file().isEmpty() ) { |
175 | // A document | 173 | // A document |
176 | // delete app; | 174 | delete app; |
177 | // app = new DocLnk(linkfile); | 175 | app = new DocLnk(linkfile); |
178 | // if ( app->fileKnown() ) { | 176 | if ( app->fileKnown() ) { |
179 | // ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); | 177 | ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); |
180 | // } else { | 178 | } else { |
181 | // ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); | 179 | ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); |
182 | // delete app; | 180 | delete app; |
183 | // } | 181 | } |
184 | // return; | 182 | return; |
185 | // } | 183 | } |
186 | // An application | 184 | // An application |
187 | // for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { | 185 | for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { |
188 | // if ( !(*it).isEmpty() ) { | 186 | if ( !(*it).isEmpty() ) { |
189 | // QRegExp tf(*it,FALSE,TRUE); | 187 | QRegExp tf(*it,FALSE,TRUE); |
190 | // if ( tf.match(app->type()) >= 0 ) { | 188 | if ( tf.match(app->type()) >= 0 ) { |
191 | // ((LauncherView*)stack->widget(i))->addItem(app); | 189 | ((LauncherView*)stack->widget(i))->addItem(app); |
192 | // return; | 190 | return; |
193 | // } | 191 | } |
194 | // i++; | 192 | i++; |
195 | // } | 193 | } |
196 | // } | 194 | } |
197 | 195 | ||
198 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); | 196 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); |
199 | } | 197 | } |
@@ -201,5 +199,5 @@ void CategoryTabWidget::addItem( const QString& linkfile ) | |||
201 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | 199 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, |
202 | AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/) | 200 | AppLnkSet* docFolder, const QList<FileSystem> &fs) |
203 | { | 201 | { |
204 | QString current; | 202 | QString current; |
205 | if ( categoryBar ) { | 203 | if ( categoryBar ) { |
@@ -226,6 +224,6 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | |||
226 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { | 224 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { |
227 | if ( !(*it).isEmpty() ) { | 225 | if ( !(*it).isEmpty() ) { |
228 | (void)newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); | 226 | (void)newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); |
229 | setTabAppearance( *it, cfg ); | 227 | setTabAppearance( *it, cfg ); |
230 | } | 228 | } |
231 | } | 229 | } |
@@ -234,14 +232,14 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | |||
234 | while ( (l=it.current()) ) { | 232 | while ( (l=it.current()) ) { |
235 | if ( l->type() == "Separator" ) { // No tr | 233 | if ( l->type() == "Separator" ) { // No tr |
236 | rootFolder->remove(l); | 234 | rootFolder->remove(l); |
237 | delete l; | 235 | delete l; |
238 | } else { | 236 | } else { |
239 | int i=0; | 237 | int i=0; |
240 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { | 238 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { |
241 | if ( *it == l->type() ) | 239 | if ( *it == l->type() ) |
242 | ((LauncherView*)stack->widget(i))->addItem(l,FALSE); | 240 | ((LauncherView*)stack->widget(i))->addItem(l,FALSE); |
243 | i++; | 241 | i++; |
244 | } | 242 | } |
245 | } | 243 | } |
246 | ++it; | 244 | ++it; |
247 | } | 245 | } |
@@ -249,3 +247,3 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | |||
249 | for (int i=0; i<tabs; i++) | 247 | for (int i=0; i<tabs; i++) |
250 | ((LauncherView*)stack->widget(i))->sort(); | 248 | ((LauncherView*)stack->widget(i))->sort(); |
251 | 249 | ||
@@ -255,21 +253,11 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | |||
255 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 253 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
254 | docview = newView( "Documents", // No tr | ||
255 | pm, tr("Documents")); | ||
256 | docview->populate( docFolder, QString::null ); | ||
257 | docFolder->detachChildren(); | ||
258 | docview->setFileSystems(fs); | ||
259 | docview->setToolsEnabled(TRUE); | ||
260 | setTabAppearance( "Documents", cfg ); // No tr | ||
256 | 261 | ||
257 | //ljpotter | 262 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); |
258 | CategoryTab *catTab ; | ||
259 | catTab = new CategoryTab( pm, "Documents" ); | ||
260 | |||
261 | categoryBar->addTab( catTab ); | ||
262 | |||
263 | fileSel = new DocumentTab( stack, 4, 0, "/",""); | ||
264 | stack->addWidget( fileSel, tabs++ ); | ||
265 | |||
266 | // fileSel->hide(); | ||
267 | |||
268 | connect( fileSel, SIGNAL( fileSelected( const DocLnk & )), | ||
269 | this, SLOT(clickie(const DocLnk&)) ); | ||
270 | |||
271 | // connect( fileSel, SIGNAL( fileSelected( const QString & )), | ||
272 | // this, SLOT(clickie(const QString&)) ); | ||
273 | |||
274 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); | ||
275 | 263 | ||
@@ -287,3 +275,2 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | |||
287 | 275 | ||
288 | |||
289 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); | 276 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); |
@@ -291,12 +278,2 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | |||
291 | 278 | ||
292 | void CategoryTabWidget::clickie(const DocLnk &lnk) { | ||
293 | lnk.execute(); | ||
294 | // fileSel->reparse(); | ||
295 | } | ||
296 | |||
297 | void CategoryTabWidget::clickie(const QString &appStr) { | ||
298 | // DocLnk lnk(appStr); | ||
299 | // lnk.execute(); | ||
300 | } | ||
301 | |||
302 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) | 279 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) |
@@ -312,10 +289,10 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) | |||
312 | if ( view == "List" ) // No tr | 289 | if ( view == "List" ) // No tr |
313 | v->setViewMode( LauncherView::List ); | 290 | v->setViewMode( LauncherView::List ); |
314 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); | 291 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); |
315 | if ( bgType == "Image" ) { // No tr | 292 | if ( bgType == "Image" ) { // No tr |
316 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); | 293 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); |
317 | v->setBackgroundType( LauncherView::Image, pm ); | 294 | v->setBackgroundType( LauncherView::Image, pm ); |
318 | } else if ( bgType == "SolidColor" ) { | 295 | } else if ( bgType == "SolidColor" ) { |
319 | QString c = cfg.readEntry( "BackgroundColor" ); | 296 | QString c = cfg.readEntry( "BackgroundColor" ); |
320 | v->setBackgroundType( LauncherView::SolidColor, c ); | 297 | v->setBackgroundType( LauncherView::SolidColor, c ); |
321 | } | 298 | } |
@@ -323,8 +300,8 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) | |||
323 | if ( textCol.isEmpty() ) | 300 | if ( textCol.isEmpty() ) |
324 | v->setTextColor( QColor() ); | 301 | v->setTextColor( QColor() ); |
325 | else | 302 | else |
326 | v->setTextColor( QColor(textCol) ); | 303 | v->setTextColor( QColor(textCol) ); |
327 | QStringList font = cfg.readListEntry( "Font", ',' ); | 304 | QStringList font = cfg.readListEntry( "Font", ',' ); |
328 | if ( font.count() == 4 ) | 305 | if ( font.count() == 4 ) |
329 | v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); | 306 | v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); |
330 | 307 | ||
@@ -333,16 +310,19 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) | |||
333 | if ( tabCol.isEmpty() ) | 310 | if ( tabCol.isEmpty() ) |
334 | tab->bgColor = QColor(); | 311 | tab->bgColor = QColor(); |
335 | else | 312 | else |
336 | tab->bgColor = QColor(tabCol); | 313 | tab->bgColor = QColor(tabCol); |
337 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); | 314 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); |
338 | if ( tabTextCol.isEmpty() ) | 315 | if ( tabTextCol.isEmpty() ) |
339 | tab->fgColor = QColor(); | 316 | tab->fgColor = QColor(); |
340 | else | 317 | else |
341 | tab->fgColor = QColor(tabTextCol); | 318 | tab->fgColor = QColor(tabTextCol); |
342 | } | 319 | } |
343 | 320 | ||
344 | //void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/) | 321 | void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs) |
345 | //{ | 322 | { |
346 | // docFolder->detachChildren(); | 323 | docview->populate( docFolder, QString::null ); |
347 | //} | 324 | docFolder->detachChildren(); |
325 | docview->setFileSystems(fs); | ||
326 | docview->updateTools(); | ||
327 | } | ||
348 | 328 | ||
@@ -357,3 +337,3 @@ void CategoryTabWidget::tabProperties() | |||
357 | if ( rv >= 0 && rv != view->viewMode() ) { | 337 | if ( rv >= 0 && rv != view->viewMode() ) { |
358 | view->setViewMode( (LauncherView::ViewMode)rv ); | 338 | view->setViewMode( (LauncherView::ViewMode)rv ); |
359 | } | 339 | } |
@@ -365,3 +345,3 @@ QString CategoryTabWidget::getAllDocLinkInfo() const | |||
365 | { | 345 | { |
366 | return ""; | 346 | return docview->getAllDocLinkInfo(); |
367 | } | 347 | } |
@@ -372,5 +352,5 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, | |||
372 | connect( view, SIGNAL(clicked(const AppLnk*)), | 352 | connect( view, SIGNAL(clicked(const AppLnk*)), |
373 | this, SIGNAL(clicked(const AppLnk*))); | 353 | this, SIGNAL(clicked(const AppLnk*))); |
374 | connect( view, SIGNAL(rightPressed(AppLnk*)), | 354 | connect( view, SIGNAL(rightPressed(AppLnk*)), |
375 | this, SIGNAL(rightPressed(AppLnk*))); | 355 | this, SIGNAL(rightPressed(AppLnk*))); |
376 | ids.append(id); | 356 | ids.append(id); |
@@ -383,10 +363,11 @@ void CategoryTabWidget::updateLink(const QString& linkfile) | |||
383 | { | 363 | { |
384 | // LauncherView* view; | 364 | int i=0; |
385 | qApp->processEvents(); | 365 | LauncherView* view; |
386 | // while ((view = (LauncherView*)stack->widget(i++))) { | 366 | //qApp->processEvents(); |
387 | // if ( view->removeLink(linkfile) ) | 367 | while ((view = (LauncherView*)stack->widget(i++))) { |
388 | // break; | 368 | if ( view->removeLink(linkfile) ) |
389 | // } | 369 | break; |
390 | // addItem(linkfile); | 370 | } |
391 | fileSel->reparse(); | 371 | addItem(linkfile); |
372 | docview->updateTools(); | ||
392 | } | 373 | } |
@@ -406,6 +387,6 @@ void CategoryTabWidget::setBusy(bool on) | |||
406 | if ( on ) | 387 | if ( on ) |
407 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); | 388 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); |
408 | else | 389 | else |
409 | for (int i=0; i<tabs-1; i++) | 390 | for (int i=0; i<tabs; i++) |
410 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); | 391 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); |
411 | } | 392 | } |
@@ -420,4 +401,4 @@ void CategoryTabWidget::setBusyIndicatorType ( const QString &type ) | |||
420 | { | 401 | { |
421 | for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it ) | 402 | for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it ) |
422 | view ( *it )-> setBusyIndicatorType ( type ); | 403 | view ( *it )-> setBusyIndicatorType ( type ); |
423 | } | 404 | } |
@@ -440,3 +421,3 @@ void CategoryTabBar::layoutTabs() | |||
440 | if ( !count() ) | 421 | if ( !count() ) |
441 | return; | 422 | return; |
442 | 423 | ||
@@ -456,68 +437,68 @@ void CategoryTabBar::layoutTabs() | |||
456 | for ( int i = 0; i < count(); i++ ) { | 437 | for ( int i = 0; i < count(); i++ ) { |
457 | t = tab(i); | 438 | t = tab(i); |
458 | int iw = fm.width( t->text() ) + hframe - overlap; | 439 | int iw = fm.width( t->text() ) + hframe - overlap; |
459 | if ( i != middleTab ) { | 440 | if ( i != middleTab ) { |
460 | available -= hiddenTabWidth + hframe - overlap; | 441 | available -= hiddenTabWidth + hframe - overlap; |
461 | if ( t->iconSet() != 0 ) | 442 | if ( t->iconSet() != 0 ) |
462 | available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 443 | available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); |
463 | } | 444 | } |
464 | if ( t->iconSet() != 0 ) | 445 | if ( t->iconSet() != 0 ) |
465 | iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 446 | iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); |
466 | required += iw; | 447 | required += iw; |
467 | // As space gets tight, packed looks better than even. "10" must be at least 0. | 448 | // As space gets tight, packed looks better than even. "10" must be at least 0. |
468 | if ( iw >= eventabwidth-10 ) | 449 | if ( iw >= eventabwidth-10 ) |
469 | mode = Pack; | 450 | mode = Pack; |
470 | } | 451 | } |
471 | if ( mode == Pack && required > width()-1 ) | 452 | if ( mode == Pack && required > width()-1 ) |
472 | mode = HideBackText; | 453 | mode = HideBackText; |
473 | for ( int i = 0; i < count(); i++ ) { | 454 | for ( int i = 0; i < count(); i++ ) { |
474 | t = tab(i); | 455 | t = tab(i); |
475 | if ( mode != HideBackText ) { | 456 | if ( mode != HideBackText ) { |
476 | int w = fm.width( t->text() ); | 457 | int w = fm.width( t->text() ); |
477 | int ih = 0; | 458 | int ih = 0; |
478 | if ( t->iconSet() != 0 ) { | 459 | if ( t->iconSet() != 0 ) { |
479 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 460 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); |
480 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 461 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); |
481 | } | 462 | } |
482 | int h = QMAX( fm.height(), ih ); | 463 | int h = QMAX( fm.height(), ih ); |
483 | h = QMAX( h, QApplication::globalStrut().height() ); | 464 | h = QMAX( h, QApplication::globalStrut().height() ); |
484 | 465 | ||
485 | h += vframe; | 466 | h += vframe; |
486 | w += hframe; | 467 | w += hframe; |
487 | 468 | ||
488 | QRect tr(x, 0, | 469 | QRect tr(x, 0, |
489 | mode == Even ? eventabwidth : w * (width()-1)/required, h); | 470 | mode == Even ? eventabwidth : w * (width()-1)/required, h); |
490 | t->setRect(tr); | 471 | t->setRect(tr); |
491 | x += tr.width() - overlap; | 472 | x += tr.width() - overlap; |
492 | r = r.unite(tr); | 473 | r = r.unite(tr); |
493 | } else if ( i != middleTab ) { | 474 | } else if ( i != middleTab ) { |
494 | int w = hiddenTabWidth; | 475 | int w = hiddenTabWidth; |
495 | int ih = 0; | 476 | int ih = 0; |
496 | if ( t->iconSet() != 0 ) { | 477 | if ( t->iconSet() != 0 ) { |
497 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 478 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); |
498 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 479 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); |
499 | } | 480 | } |
500 | int h = QMAX( fm.height(), ih ); | 481 | int h = QMAX( fm.height(), ih ); |
501 | h = QMAX( h, QApplication::globalStrut().height() ); | 482 | h = QMAX( h, QApplication::globalStrut().height() ); |
502 | 483 | ||
503 | h += vframe; | 484 | h += vframe; |
504 | w += hframe; | 485 | w += hframe; |
505 | 486 | ||
506 | t->setRect( QRect(x, 0, w, h) ); | 487 | t->setRect( QRect(x, 0, w, h) ); |
507 | x += t->rect().width() - overlap; | 488 | x += t->rect().width() - overlap; |
508 | r = r.unite( t->rect() ); | 489 | r = r.unite( t->rect() ); |
509 | } else { | 490 | } else { |
510 | int ih = 0; | 491 | int ih = 0; |
511 | if ( t->iconSet() != 0 ) { | 492 | if ( t->iconSet() != 0 ) { |
512 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 493 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); |
513 | } | 494 | } |
514 | int h = QMAX( fm.height(), ih ); | 495 | int h = QMAX( fm.height(), ih ); |
515 | h = QMAX( h, QApplication::globalStrut().height() ); | 496 | h = QMAX( h, QApplication::globalStrut().height() ); |
516 | 497 | ||
517 | h += vframe; | 498 | h += vframe; |
518 | 499 | ||
519 | t->setRect( QRect(x, 0, available, h) ); | 500 | t->setRect( QRect(x, 0, available, h) ); |
520 | x += t->rect().width() - overlap; | 501 | x += t->rect().width() - overlap; |
521 | r = r.unite( t->rect() ); | 502 | r = r.unite( t->rect() ); |
522 | } | 503 | } |
523 | } | 504 | } |
@@ -545,9 +526,9 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const | |||
545 | if ( ct->bgColor.isValid() ) { | 526 | if ( ct->bgColor.isValid() ) { |
546 | pal.setColor( QPalette::Active, QColorGroup::Background, ct->bgColor ); | 527 | pal.setColor( QPalette::Active, QColorGroup::Background, ct->bgColor ); |
547 | pal.setColor( QPalette::Active, QColorGroup::Button, ct->bgColor ); | 528 | pal.setColor( QPalette::Active, QColorGroup::Button, ct->bgColor ); |
548 | pal.setColor( QPalette::Inactive, QColorGroup::Background, ct->bgColor ); | 529 | pal.setColor( QPalette::Inactive, QColorGroup::Background, ct->bgColor ); |
549 | pal.setColor( QPalette::Inactive, QColorGroup::Button, ct->bgColor ); | 530 | pal.setColor( QPalette::Inactive, QColorGroup::Button, ct->bgColor ); |
550 | that->setUpdatesEnabled( FALSE ); | 531 | that->setUpdatesEnabled( FALSE ); |
551 | that->setPalette( pal ); | 532 | that->setPalette( pal ); |
552 | setPal = TRUE; | 533 | setPal = TRUE; |
553 | } | 534 | } |
@@ -566,3 +547,3 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const | |||
566 | if ( selected ) | 547 | if ( selected ) |
567 | f.setBold( TRUE ); | 548 | f.setBold( TRUE ); |
568 | p->setFont( f ); | 549 | p->setFont( f ); |
@@ -570,7 +551,7 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const | |||
570 | if ( ct->fgColor.isValid() ) { | 551 | if ( ct->fgColor.isValid() ) { |
571 | pal.setColor( QPalette::Active, QColorGroup::Foreground, ct->fgColor ); | 552 | pal.setColor( QPalette::Active, QColorGroup::Foreground, ct->fgColor ); |
572 | pal.setColor( QPalette::Inactive, QColorGroup::Foreground, ct->fgColor ); | 553 | pal.setColor( QPalette::Inactive, QColorGroup::Foreground, ct->fgColor ); |
573 | that->setUpdatesEnabled( FALSE ); | 554 | that->setUpdatesEnabled( FALSE ); |
574 | that->setPalette( pal ); | 555 | that->setPalette( pal ); |
575 | setPal = TRUE; | 556 | setPal = TRUE; |
576 | } | 557 | } |
@@ -579,4 +560,4 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const | |||
579 | if ( t->iconSet() != 0 ) { | 560 | if ( t->iconSet() != 0 ) { |
580 | iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; | 561 | iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; |
581 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 562 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); |
582 | } | 563 | } |
@@ -585,12 +566,12 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const | |||
585 | paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, | 566 | paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, |
586 | r.top() + (r.height()-h)/2, w, h ), t, | 567 | r.top() + (r.height()-h)/2, w, h ), t, |
587 | #if QT_VERSION >= 300 | 568 | #if QT_VERSION >= 300 |
588 | t->identifier() == keyboardFocusTab() | 569 | t->identifier() == keyboardFocusTab() |
589 | #else | 570 | #else |
590 | t->identitifer() == keyboardFocusTab() | 571 | t->identitifer() == keyboardFocusTab() |
591 | #endif | 572 | #endif |
592 | ); | 573 | ); |
593 | if ( setPal ) { | 574 | if ( setPal ) { |
594 | that->unsetPalette(); | 575 | that->unsetPalette(); |
595 | that->setUpdatesEnabled( TRUE ); | 576 | that->setUpdatesEnabled( TRUE ); |
596 | } | 577 | } |
@@ -600,3 +581,3 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const | |||
600 | void CategoryTabBar::paintLabel( QPainter* p, const QRect&, | 581 | void CategoryTabBar::paintLabel( QPainter* p, const QRect&, |
601 | QTab* t, bool has_focus ) const | 582 | QTab* t, bool has_focus ) const |
602 | { | 583 | { |
@@ -607,11 +588,11 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&, | |||
607 | if ( t->iconSet() ) { | 588 | if ( t->iconSet() ) { |
608 | // the tab has an iconset, draw it in the right mode | 589 | // the tab has an iconset, draw it in the right mode |
609 | QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; | 590 | QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; |
610 | if ( mode == QIconSet::Normal && has_focus ) | 591 | if ( mode == QIconSet::Normal && has_focus ) |
611 | mode = QIconSet::Active; | 592 | mode = QIconSet::Active; |
612 | QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); | 593 | QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); |
613 | int pixw = pixmap.width(); | 594 | int pixw = pixmap.width(); |
614 | int pixh = pixmap.height(); | 595 | int pixh = pixmap.height(); |
615 | p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); | 596 | p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); |
616 | r.setLeft( r.left() + pixw + 5 ); | 597 | r.setLeft( r.left() + pixw + 5 ); |
617 | } | 598 | } |
@@ -621,3 +602,3 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&, | |||
621 | if ( r.width() < 20 ) | 602 | if ( r.width() < 20 ) |
622 | return; | 603 | return; |
623 | 604 | ||
@@ -625,13 +606,13 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&, | |||
625 | #if defined(_WS_WIN32_) | 606 | #if defined(_WS_WIN32_) |
626 | if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) ) | 607 | if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) ) |
627 | p->setPen( colorGroup().buttonText() ); | 608 | p->setPen( colorGroup().buttonText() ); |
628 | else | 609 | else |
629 | p->setPen( colorGroup().foreground() ); | 610 | p->setPen( colorGroup().foreground() ); |
630 | #else | 611 | #else |
631 | p->setPen( colorGroup().foreground() ); | 612 | p->setPen( colorGroup().foreground() ); |
632 | #endif | 613 | #endif |
633 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); | 614 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); |
634 | } else { | 615 | } else { |
635 | p->setPen( palette().disabled().foreground() ); | 616 | p->setPen( palette().disabled().foreground() ); |
636 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); | 617 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); |
637 | } | 618 | } |
@@ -663,8 +644,7 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) | |||
663 | connect( tabs, SIGNAL(selected(const QString&)), | 644 | connect( tabs, SIGNAL(selected(const QString&)), |
664 | this, SLOT(viewSelected(const QString&)) ); | 645 | this, SLOT(viewSelected(const QString&)) ); |
665 | connect( tabs, SIGNAL(clicked(const AppLnk*)), | 646 | connect( tabs, SIGNAL(clicked(const AppLnk*)), |
666 | this, SLOT(select(const AppLnk*))); | 647 | this, SLOT(select(const AppLnk*))); |
667 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 648 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
668 | this, SLOT(properties(AppLnk*))); | 649 | this, SLOT(properties(AppLnk*))); |
669 | |||
670 | 650 | ||
@@ -702,4 +682,4 @@ static bool isVisibleWindow(int wid) | |||
702 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 682 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
703 | if ( w->winId() == wid ) | 683 | if ( w->winId() == wid ) |
704 | return !w->isFullyObscured(); | 684 | return !w->isFullyObscured(); |
705 | } | 685 | } |
@@ -712,5 +692,5 @@ void Launcher::showMaximized() | |||
712 | if ( isVisibleWindow( winId() ) ) | 692 | if ( isVisibleWindow( winId() ) ) |
713 | doMaximize(); | 693 | doMaximize(); |
714 | else | 694 | else |
715 | QTimer::singleShot( 20, this, SLOT(doMaximize()) ); | 695 | QTimer::singleShot( 20, this, SLOT(doMaximize()) ); |
716 | } | 696 | } |
@@ -732,8 +712,8 @@ void Launcher::updateMimeTypes(AppLnkSet* folder) | |||
732 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { | 712 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { |
733 | AppLnk *app = it.current(); | 713 | AppLnk *app = it.current(); |
734 | if ( app->type() == "Folder" ) // No tr | 714 | if ( app->type() == "Folder" ) // No tr |
735 | updateMimeTypes((AppLnkSet *)app); | 715 | updateMimeTypes((AppLnkSet *)app); |
736 | else { | 716 | else { |
737 | MimeType::registerApp(*app); | 717 | MimeType::registerApp(*app); |
738 | } | 718 | } |
739 | } | 719 | } |
@@ -754,114 +734,113 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
754 | { | 734 | { |
755 | OWait *owait = new OWait(); | 735 | |
756 | Global::statusMessage( tr( "Finding documents" ) ); | 736 | OWait *owait = new OWait(); |
757 | 737 | Global::statusMessage( tr( "Finding documents" ) ); | |
758 | owait->show(); | 738 | |
759 | qApp->processEvents(); | 739 | owait->show(); |
760 | if(docsFolder) delete docsFolder; | 740 | qApp->processEvents(); |
761 | docsFolder = new DocLnkSet; | 741 | |
762 | DocLnkSet *tmp = 0; | 742 | delete docsFolder; |
763 | QString home = QString(getenv("HOME")) + "/Documents"; | 743 | docsFolder = new DocLnkSet; |
764 | tmp = new DocLnkSet( home , QString::null); | 744 | |
765 | docsFolder->appendFrom( *tmp ); | 745 | DocLnkSet *tmp = 0; |
766 | delete tmp; | 746 | QString home = QString(getenv("HOME")) + "/Documents"; |
767 | 747 | tmp = new DocLnkSet( home , QString::null); | |
768 | // RAM documents | 748 | docsFolder->appendFrom( *tmp ); |
769 | StorageInfo storage; | 749 | delete tmp; |
770 | const QList<FileSystem> &fileSystems = storage.fileSystems(); | 750 | |
771 | QListIterator<FileSystem> it ( fileSystems ); | 751 | // RAM documents |
772 | 752 | StorageInfo storage; | |
773 | for ( ; it.current(); ++it ) { | 753 | const QList<FileSystem> &fileSystems = storage.fileSystems(); |
774 | if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { | 754 | QListIterator<FileSystem> it ( fileSystems ); |
775 | tmp = new DocLnkSet( (*it)->path(), QString::null ); | 755 | |
776 | docsFolder->appendFrom( *tmp ); | 756 | for ( ; it.current(); ++it ) { |
777 | delete tmp; | 757 | if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { |
778 | } | 758 | tmp = new DocLnkSet( (*it)->path(), QString::null ); |
779 | } | 759 | docsFolder->appendFrom( *tmp ); |
780 | 760 | delete tmp; | |
781 | Config mediumCfg( "medium"); | 761 | } |
782 | mediumCfg.setGroup("main"); | 762 | } |
783 | // a) -zecke we don't want to check | 763 | |
784 | if(!mediumCfg.readBoolEntry("use", true ) ) { | 764 | Config mediumCfg( "medium"); |
785 | owait->hide(); | 765 | mediumCfg.setGroup("main"); |
786 | delete owait; | 766 | // a) -zecke we don't want to check |
767 | if(!mediumCfg.readBoolEntry("use", true ) ) | ||
787 | return; | 768 | return; |
788 | } | ||
789 | // find out wich filesystems are new in this round | ||
790 | // We will do this by having a timestamp inside each mountpoint | ||
791 | // if the current timestamp doesn't match this is a new file system and | ||
792 | // come up with our MediumMountGui :) let the hacking begin | ||
793 | int stamp = uidgen.generate(); | ||
794 | 769 | ||
795 | QString newStamp = QString::number( stamp ); // generates newtime Stamp | 770 | // find out wich filesystems are new in this round |
771 | // We will do this by having a timestamp inside each mountpoint | ||
772 | // if the current timestamp doesn't match this is a new file system and | ||
773 | // come up with our MediumMountGui :) let the hacking begin | ||
774 | int stamp = uidgen.generate(); | ||
775 | |||
776 | QString newStamp = QString::number( stamp ); // generates newtime Stamp | ||
796 | 777 | ||
797 | // b) | 778 | // b) |
798 | if( mediumCfg.readBoolEntry("global", true ) ){ | 779 | if( mediumCfg.readBoolEntry("global", true ) ){ |
799 | QString mime = configToMime(&mediumCfg).join(";"); | 780 | QString mime = configToMime(&mediumCfg).join(";"); |
800 | for( it.toFirst(); it.current(); ++it ){ | 781 | for( it.toFirst(); it.current(); ++it ){ |
801 | if( (*it)->isRemovable() ){ | 782 | if( (*it)->isRemovable() ){ |
802 | tmp = new DocLnkSet( (*it)->path(), mime ); | 783 | tmp = new DocLnkSet( (*it)->path(), mime ); |
803 | docsFolder->appendFrom( *tmp ); | 784 | docsFolder->appendFrom( *tmp ); |
804 | delete tmp; | 785 | delete tmp; |
805 | } | 786 | } |
806 | } // done | 787 | } // done |
807 | owait->hide(); | ||
808 | delete owait; | ||
809 | return; // save the else | 788 | return; // save the else |
810 | } | 789 | } |
811 | // c) zecke | 790 | // c) zecke |
812 | for ( it.toFirst(); it.current(); ++it ) { | 791 | for ( it.toFirst(); it.current(); ++it ) { |
813 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it | 792 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it |
814 | Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); | 793 | Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); |
815 | cfg.setGroup("main"); | 794 | cfg.setGroup("main"); |
816 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); | 795 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); |
817 | /** This medium is uptodate | 796 | /** This medium is uptodate |
818 | */ | 797 | */ |
819 | if( stamp == m_timeStamp ){ // ok we know this card | 798 | if( stamp == m_timeStamp ){ // ok we know this card |
820 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp | 799 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp |
821 | // we need to scan the list now. Hopefully the cache will be there | 800 | // we need to scan the list now. Hopefully the cache will be there |
822 | // read the mimetypes from the config and search for documents | 801 | // read the mimetypes from the config and search for documents |
823 | QStringList mimetypes = configToMime( &cfg); | 802 | QStringList mimetypes = configToMime( &cfg); |
824 | //qApp->processEvents(); | 803 | //qApp->processEvents(); |
825 | Global::statusMessage( tr( "Searching documents" ) ); | ||
826 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); | ||
827 | docsFolder->appendFrom( *tmp ); | ||
828 | delete tmp; | ||
829 | |||
830 | } else { // come up with the gui cause this a new card | ||
831 | MediumMountGui medium(&cfg, (*it)->path() ); | ||
832 | if( medium.check() ){ // we did not ask before or ask again is off | ||
833 | /** c2) */ | ||
834 | if( medium.exec() ){ // he clicked yes so search it | ||
835 | // speicher | ||
836 | //cfg.read(); // cause of a race we need to reread - fixed | ||
837 | cfg.setGroup("main"); | ||
838 | cfg.writeEntry("timestamp", newStamp ); | ||
839 | cfg.write(); | ||
840 | |||
841 | //qApp->processEvents(); | ||
842 | tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); | ||
843 | docsFolder->appendFrom( *tmp ); | ||
844 | delete tmp; | ||
845 | }// no else | ||
846 | /** c1) */ | ||
847 | } else { // we checked | ||
848 | // do something different see what we need to do | ||
849 | // let's see if we should check the device | ||
850 | cfg.setGroup("main" ); | ||
851 | bool check = cfg.readBoolEntry("autocheck", true ); | ||
852 | if( check ){ // find the documents | ||
853 | |||
854 | //qApp->processEvents(); | ||
855 | Global::statusMessage( tr( "Searching documents" ) ); | 804 | Global::statusMessage( tr( "Searching documents" ) ); |
856 | tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); | 805 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); |
857 | docsFolder->appendFrom( *tmp ); | 806 | docsFolder->appendFrom( *tmp ); |
858 | delete tmp; | 807 | delete tmp; |
859 | } | 808 | |
860 | } | 809 | }else{ // come up with the gui cause this a new card |
861 | } | 810 | MediumMountGui medium(&cfg, (*it)->path() ); |
862 | } | 811 | if( medium.check() ){ // we did not ask before or ask again is off |
863 | } | 812 | /** c2) */ |
864 | m_timeStamp = newStamp; | 813 | if( medium.exec() ){ // he clicked yes so search it |
865 | owait->hide(); | 814 | // speicher |
866 | delete owait; | 815 | //cfg.read(); // cause of a race we need to reread - fixed |
816 | cfg.setGroup("main"); | ||
817 | cfg.writeEntry("timestamp", newStamp ); | ||
818 | cfg.write(); | ||
819 | |||
820 | //qApp->processEvents(); | ||
821 | tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); | ||
822 | docsFolder->appendFrom( *tmp ); | ||
823 | delete tmp; | ||
824 | }// no else | ||
825 | /** c1) */ | ||
826 | }else{ // we checked | ||
827 | // do something different see what we need to do | ||
828 | // let's see if we should check the device | ||
829 | cfg.setGroup("main" ); | ||
830 | bool check = cfg.readBoolEntry("autocheck", true ); | ||
831 | if( check ){ // find the documents | ||
832 | |||
833 | //qApp->processEvents(); | ||
834 | Global::statusMessage( tr( "Searching documents" ) ); | ||
835 | tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); | ||
836 | docsFolder->appendFrom( *tmp ); | ||
837 | delete tmp; | ||
838 | } | ||
839 | } | ||
840 | } | ||
841 | } | ||
842 | } | ||
843 | m_timeStamp = newStamp; | ||
844 | owait->hide(); | ||
845 | delete owait; | ||
867 | } | 846 | } |
@@ -871,2 +850,3 @@ void Launcher::updateTabs() | |||
871 | MimeType::updateApplications(); // ### reads all applnks twice | 850 | MimeType::updateApplications(); // ### reads all applnks twice |
851 | |||
872 | delete rootFolder; | 852 | delete rootFolder; |
@@ -881,4 +861,4 @@ void Launcher::updateDocs() | |||
881 | { | 861 | { |
882 | loadDocs(); | 862 | loadDocs(); |
883 | // tabs->updateDocs(docsFolder,storage->fileSystems()); | 863 | tabs->updateDocs(docsFolder,storage->fileSystems()); |
884 | } | 864 | } |
@@ -904,13 +884,13 @@ void Launcher::select( const AppLnk *appLnk ) | |||
904 | if ( appLnk->type() == "Folder" ) { // No tr | 884 | if ( appLnk->type() == "Folder" ) { // No tr |
905 | // Not supported: flat is simpler for the user | 885 | // Not supported: flat is simpler for the user |
906 | } else { | 886 | } else { |
907 | if ( appLnk->exec().isNull() ) { | 887 | if ( appLnk->exec().isNull() ) { |
908 | QMessageBox::information(this,tr("No application"), | 888 | QMessageBox::information(this,tr("No application"), |
909 | tr("<p>No application is defined for this document." | 889 | tr("<p>No application is defined for this document." |
910 | "<p>Type is %1.").arg(appLnk->type())); | 890 | "<p>Type is %1.").arg(appLnk->type())); |
911 | return; | 891 | return; |
912 | } | 892 | } |
913 | tabs->setBusy(TRUE); | 893 | tabs->setBusy(TRUE); |
914 | emit executing( appLnk ); | 894 | emit executing( appLnk ); |
915 | appLnk->execute(); | 895 | appLnk->execute(); |
916 | } | 896 | } |
@@ -927,14 +907,14 @@ void Launcher::properties( AppLnk *appLnk ) | |||
927 | if ( appLnk->type() == "Folder" ) { // No tr | 907 | if ( appLnk->type() == "Folder" ) { // No tr |
928 | // Not supported: flat is simpler for the user | 908 | // Not supported: flat is simpler for the user |
929 | } else { | 909 | } else { |
930 | in_lnk_props = TRUE; | 910 | in_lnk_props = TRUE; |
931 | got_lnk_change = FALSE; | 911 | got_lnk_change = FALSE; |
932 | LnkProperties prop(appLnk); | 912 | LnkProperties prop(appLnk); |
933 | connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 913 | connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
934 | prop.showMaximized(); | 914 | prop.showMaximized(); |
935 | prop.exec(); | 915 | prop.exec(); |
936 | in_lnk_props = FALSE; | 916 | in_lnk_props = FALSE; |
937 | if ( got_lnk_change ) { | 917 | if ( got_lnk_change ) { |
938 | updateLink(lnk_change); | 918 | updateLink(lnk_change); |
939 | } | 919 | } |
940 | } | 920 | } |
@@ -947,11 +927,11 @@ void Launcher::updateLink(const QString& link) | |||
947 | if (link.isNull()) { | 927 | if (link.isNull()) { |
948 | updateTabs(); | 928 | updateTabs(); |
949 | notify_sm = true; | 929 | notify_sm = true; |
950 | } | 930 | } |
951 | else if (link.isEmpty()) { | 931 | else if (link.isEmpty()) { |
952 | updateDocs(); | 932 | updateDocs(); |
953 | } | 933 | } |
954 | else { | 934 | else { |
955 | tabs->updateLink(link); | 935 | tabs->updateLink(link); |
956 | notify_sm = true; | 936 | notify_sm = true; |
957 | } | 937 | } |
@@ -959,3 +939,3 @@ void Launcher::updateLink(const QString& link) | |||
959 | if ( notify_sm ) | 939 | if ( notify_sm ) |
960 | QCopEnvelope e ( "QPE/TaskBar", "reloadApps()" ); | 940 | QCopEnvelope e ( "QPE/TaskBar", "reloadApps()" ); |
961 | } | 941 | } |
@@ -964,59 +944,59 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
964 | { | 944 | { |
965 | QDataStream stream( data, IO_ReadOnly ); | 945 | QDataStream stream( data, IO_ReadOnly ); |
966 | if ( msg == "linkChanged(QString)" ) { | 946 | if ( msg == "linkChanged(QString)" ) { |
967 | QString link; | 947 | QString link; |
968 | stream >> link; | 948 | stream >> link; |
969 | if ( in_lnk_props ) { | 949 | if ( in_lnk_props ) { |
970 | got_lnk_change = TRUE; | 950 | got_lnk_change = TRUE; |
971 | lnk_change = link; | 951 | lnk_change = link; |
972 | } else { | 952 | } else { |
973 | updateLink(link); | 953 | updateLink(link); |
974 | } | 954 | } |
975 | } else if ( msg == "busy()" ) { | 955 | } else if ( msg == "busy()" ) { |
976 | emit busy(); | 956 | emit busy(); |
977 | } else if ( msg == "notBusy(QString)" ) { | 957 | } else if ( msg == "notBusy(QString)" ) { |
978 | QString app; | 958 | QString app; |
979 | stream >> app; | 959 | stream >> app; |
980 | tabs->setBusy(FALSE); | 960 | tabs->setBusy(FALSE); |
981 | emit notBusy(app); | 961 | emit notBusy(app); |
982 | } else if ( msg == "mkdir(QString)" ) { | 962 | } else if ( msg == "mkdir(QString)" ) { |
983 | QString dir; | 963 | QString dir; |
984 | stream >> dir; | 964 | stream >> dir; |
985 | if ( !dir.isEmpty() ) | 965 | if ( !dir.isEmpty() ) |
986 | mkdir( dir ); | 966 | mkdir( dir ); |
987 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { | 967 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { |
988 | QString baseFile, sigFile; | 968 | QString baseFile, sigFile; |
989 | stream >> baseFile >> sigFile; | 969 | stream >> baseFile >> sigFile; |
990 | QRsync::generateSignature( baseFile, sigFile ); | 970 | QRsync::generateSignature( baseFile, sigFile ); |
991 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { | 971 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { |
992 | QString baseFile, sigFile, deltaFile; | 972 | QString baseFile, sigFile, deltaFile; |
993 | stream >> baseFile >> sigFile >> deltaFile; | 973 | stream >> baseFile >> sigFile >> deltaFile; |
994 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); | 974 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); |
995 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { | 975 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { |
996 | QString baseFile, deltaFile; | 976 | QString baseFile, deltaFile; |
997 | stream >> baseFile >> deltaFile; | 977 | stream >> baseFile >> deltaFile; |
998 | if ( !QFile::exists( baseFile ) ) { | 978 | if ( !QFile::exists( baseFile ) ) { |
999 | QFile f( baseFile ); | 979 | QFile f( baseFile ); |
1000 | f.open( IO_WriteOnly ); | 980 | f.open( IO_WriteOnly ); |
1001 | f.close(); | 981 | f.close(); |
1002 | } | 982 | } |
1003 | QRsync::applyDiff( baseFile, deltaFile ); | 983 | QRsync::applyDiff( baseFile, deltaFile ); |
1004 | #ifndef QT_NO_COP | 984 | #ifndef QT_NO_COP |
1005 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); | 985 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); |
1006 | e << baseFile; | 986 | e << baseFile; |
1007 | #endif | 987 | #endif |
1008 | } else if ( msg == "rdiffCleanup()" ) { | 988 | } else if ( msg == "rdiffCleanup()" ) { |
1009 | mkdir( "/tmp/rdiff" ); | 989 | mkdir( "/tmp/rdiff" ); |
1010 | QDir dir; | 990 | QDir dir; |
1011 | dir.setPath( "/tmp/rdiff" ); | 991 | dir.setPath( "/tmp/rdiff" ); |
1012 | QStringList entries = dir.entryList(); | 992 | QStringList entries = dir.entryList(); |
1013 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) | 993 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) |
1014 | dir.remove( *it ); | 994 | dir.remove( *it ); |
1015 | } else if ( msg == "sendHandshakeInfo()" ) { | 995 | } else if ( msg == "sendHandshakeInfo()" ) { |
1016 | QString home = getenv( "HOME" ); | 996 | QString home = getenv( "HOME" ); |
1017 | #ifndef QT_NO_COP | 997 | #ifndef QT_NO_COP |
1018 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); | 998 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); |
1019 | e << home; | 999 | e << home; |
1020 | int locked = (int) Desktop::screenLocked(); | 1000 | int locked = (int) Desktop::screenLocked(); |
1021 | e << locked; | 1001 | e << locked; |
1022 | #endif | 1002 | #endif |
@@ -1072,75 +1052,75 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
1072 | else if ( msg == "sendVersionInfo()" ) { | 1052 | else if ( msg == "sendVersionInfo()" ) { |
1073 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString)" ); | 1053 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString)" ); |
1074 | QString v2 = QString::fromLatin1("1.4"); | 1054 | QString v2 = QString::fromLatin1("1.4"); |
1075 | e << v2; | 1055 | e << v2; |
1076 | //qDebug("version %s\n", line.latin1()); | 1056 | //qDebug("version %s\n", line.latin1()); |
1077 | } else if ( msg == "sendCardInfo()" ) { | 1057 | } else if ( msg == "sendCardInfo()" ) { |
1078 | #ifndef QT_NO_COP | 1058 | #ifndef QT_NO_COP |
1079 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); | 1059 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); |
1080 | #endif | 1060 | #endif |
1081 | const QList<FileSystem> &fs = storage->fileSystems(); | 1061 | const QList<FileSystem> &fs = storage->fileSystems(); |
1082 | QListIterator<FileSystem> it ( fs ); | 1062 | QListIterator<FileSystem> it ( fs ); |
1083 | QString s; | 1063 | QString s; |
1084 | QString homeDir = getenv("HOME"); | 1064 | QString homeDir = getenv("HOME"); |
1085 | QString hardDiskHome, hardDiskHomePath; | 1065 | QString hardDiskHome, hardDiskHomePath; |
1086 | for ( ; it.current(); ++it ) { | 1066 | for ( ; it.current(); ++it ) { |
1087 | int k4 = (*it)->blockSize()/256; | 1067 | int k4 = (*it)->blockSize()/256; |
1088 | if ( (*it)->isRemovable() || (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs") { | 1068 | if ( (*it)->isRemovable() || (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs") { |
1089 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " | 1069 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " |
1090 | + QString::number( (*it)->availBlocks() * k4/4 ) | 1070 | + QString::number( (*it)->availBlocks() * k4/4 ) |
1091 | + "K " + (*it)->options() + ";"; | 1071 | + "K " + (*it)->options() + ";"; |
1092 | } else if ( (*it)->disk() == "/dev/mtdblock1" || | 1072 | } else if ( (*it)->disk() == "/dev/mtdblock1" || |
1093 | (*it)->disk() == "/dev/mtdblock/1" ) { | 1073 | (*it)->disk() == "/dev/mtdblock/1" ) { |
1094 | s += (*it)->name() + "=" + homeDir + "/Documents " | 1074 | s += (*it)->name() + "=" + homeDir + "/Documents " |
1095 | + QString::number( (*it)->availBlocks() * k4/4 ) | 1075 | + QString::number( (*it)->availBlocks() * k4/4 ) |
1096 | + "K " + (*it)->options() + ";"; | 1076 | + "K " + (*it)->options() + ";"; |
1097 | } else if ( (*it)->name().contains( "Hard Disk") && | 1077 | } else if ( (*it)->name().contains( "Hard Disk") && |
1098 | homeDir.contains( (*it)->path() ) && | 1078 | homeDir.contains( (*it)->path() ) && |
1099 | (*it)->path().length() > hardDiskHomePath.length() ) { | 1079 | (*it)->path().length() > hardDiskHomePath.length() ) { |
1100 | hardDiskHomePath = (*it)->path(); | 1080 | hardDiskHomePath = (*it)->path(); |
1101 | hardDiskHome = | 1081 | hardDiskHome = |
1102 | (*it)->name() + "=" + homeDir + "/Documents " | 1082 | (*it)->name() + "=" + homeDir + "/Documents " |
1103 | + QString::number( (*it)->availBlocks() * k4/4 ) | 1083 | + QString::number( (*it)->availBlocks() * k4/4 ) |
1104 | + "K " + (*it)->options() + ";"; | 1084 | + "K " + (*it)->options() + ";"; |
1105 | } | 1085 | } |
1106 | } | 1086 | } |
1107 | if ( !hardDiskHome.isEmpty() ) | 1087 | if ( !hardDiskHome.isEmpty() ) |
1108 | s += hardDiskHome; | 1088 | s += hardDiskHome; |
1109 | 1089 | ||
1110 | #ifndef QT_NO_COP | 1090 | #ifndef QT_NO_COP |
1111 | e << s; | 1091 | e << s; |
1112 | #endif | 1092 | #endif |
1113 | } else if ( msg == "sendSyncDate(QString)" ) { | 1093 | } else if ( msg == "sendSyncDate(QString)" ) { |
1114 | QString app; | 1094 | QString app; |
1115 | stream >> app; | 1095 | stream >> app; |
1116 | Config cfg( "qpe" ); | 1096 | Config cfg( "qpe" ); |
1117 | cfg.setGroup("SyncDate"); | 1097 | cfg.setGroup("SyncDate"); |
1118 | #ifndef QT_NO_COP | 1098 | #ifndef QT_NO_COP |
1119 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); | 1099 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); |
1120 | e << app << cfg.readEntry( app ); | 1100 | e << app << cfg.readEntry( app ); |
1121 | #endif | 1101 | #endif |
1122 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), | 1102 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), |
1123 | //cfg.readEntry( app ).latin1() ); | 1103 | //cfg.readEntry( app ).latin1() ); |
1124 | } else if ( msg == "setSyncDate(QString,QString)" ) { | 1104 | } else if ( msg == "setSyncDate(QString,QString)" ) { |
1125 | QString app, date; | 1105 | QString app, date; |
1126 | stream >> app >> date; | 1106 | stream >> app >> date; |
1127 | Config cfg( "qpe" ); | 1107 | Config cfg( "qpe" ); |
1128 | cfg.setGroup("SyncDate"); | 1108 | cfg.setGroup("SyncDate"); |
1129 | cfg.writeEntry( app, date ); | 1109 | cfg.writeEntry( app, date ); |
1130 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); | 1110 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); |
1131 | } else if ( msg == "startSync(QString)" ) { | 1111 | } else if ( msg == "startSync(QString)" ) { |
1132 | QString what; | 1112 | QString what; |
1133 | stream >> what; | 1113 | stream >> what; |
1134 | delete syncDialog; syncDialog = 0; | 1114 | delete syncDialog; syncDialog = 0; |
1135 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, | 1115 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, |
1136 | WStyle_Tool | WStyle_Customize | | 1116 | WStyle_Tool | WStyle_Customize | |
1137 | Qt::WStyle_StaysOnTop ); | 1117 | Qt::WStyle_StaysOnTop ); |
1138 | syncDialog->showMaximized(); | 1118 | syncDialog->showMaximized(); |
1139 | syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); | 1119 | syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); |
1140 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), | 1120 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), |
1141 | SLOT( cancelSync() ) ); | 1121 | SLOT( cancelSync() ) ); |
1142 | } else if ( msg == "stopSync()") { | 1122 | } else if ( msg == "stopSync()") { |
1143 | delete syncDialog; syncDialog = 0; | 1123 | delete syncDialog; syncDialog = 0; |
1144 | } else if ( msg == "getAllDocLinks()" ) { | 1124 | } else if ( msg == "getAllDocLinks()" ) { |
1145 | loadDocs(); | 1125 | loadDocs(); |
1146 | 1126 | ||
@@ -1151,54 +1131,54 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
1151 | 1131 | ||
1152 | // Categories cats; | 1132 | //Categories cats; |
1153 | for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { | 1133 | for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { |
1154 | DocLnk *doc = it.current(); | 1134 | DocLnk *doc = it.current(); |
1155 | QFileInfo fi( doc->file() ); | 1135 | QFileInfo fi( doc->file() ); |
1156 | if ( !fi.exists() ) | 1136 | if ( !fi.exists() ) |
1157 | continue; | 1137 | continue; |
1158 | 1138 | ||
1159 | bool fake = !doc->linkFileKnown(); | 1139 | bool fake = !doc->linkFileKnown(); |
1160 | if ( !fake ) { | 1140 | if ( !fake ) { |
1161 | QFile f( doc->linkFile() ); | 1141 | QFile f( doc->linkFile() ); |
1162 | if ( f.open( IO_ReadOnly ) ) { | 1142 | if ( f.open( IO_ReadOnly ) ) { |
1163 | QTextStream ts( &f ); | 1143 | QTextStream ts( &f ); |
1164 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | 1144 | ts.setEncoding( QTextStream::UnicodeUTF8 ); |
1165 | contents += ts.read(); | 1145 | contents += ts.read(); |
1166 | f.close(); | 1146 | f.close(); |
1167 | } else | 1147 | } else |
1168 | fake = TRUE; | 1148 | fake = TRUE; |
1169 | } | 1149 | } |
1170 | if (fake) { | 1150 | if (fake) { |
1171 | contents += "[Desktop Entry]\n"; | 1151 | contents += "[Desktop Entry]\n"; |
1172 | contents += "Categories = " + // No tr | 1152 | contents += "Categories = " + // No tr |
1173 | // cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr | 1153 | // cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr |
1174 | Qtopia::Record::idsToString( doc->categories() ) + "\n"; | 1154 | Qtopia::Record::idsToString( doc->categories() ) + "\n"; |
1175 | contents += "Name = "+doc->name()+"\n"; // No tr | 1155 | contents += "Name = "+doc->name()+"\n"; // No tr |
1176 | contents += "Type = "+doc->type()+"\n"; // No tr | 1156 | contents += "Type = "+doc->type()+"\n"; // No tr |
1177 | } | 1157 | } |
1178 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) | 1158 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) |
1179 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr | 1159 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr |
1180 | } | 1160 | } |
1181 | 1161 | ||
1182 | //qDebug( "sending length %d", contents.length() ); | 1162 | //qDebug( "sending length %d", contents.length() ); |
1183 | #ifndef QT_NO_COP | 1163 | #ifndef QT_NO_COP |
1184 | QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); | 1164 | QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); |
1185 | e << contents; | 1165 | e << contents; |
1186 | #endif | 1166 | #endif |
1187 | 1167 | ||
1188 | //qDebug( "================ \n\n%s\n\n===============", | 1168 | //qDebug( "================ \n\n%s\n\n===============", |
1189 | //contents.latin1() ); | 1169 | //contents.latin1() ); |
1190 | 1170 | ||
1191 | delete docsFolder; | 1171 | delete docsFolder; |
1192 | docsFolder = 0; | 1172 | docsFolder = 0; |
1193 | #ifdef QWS | 1173 | #ifdef QWS |
1194 | } else if ( msg == "setMouseProto(QString)" ) { | 1174 | } else if ( msg == "setMouseProto(QString)" ) { |
1195 | QString mice; | 1175 | QString mice; |
1196 | stream >> mice; | 1176 | stream >> mice; |
1197 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); | 1177 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); |
1198 | qwsServer->openMouse(); | 1178 | qwsServer->openMouse(); |
1199 | } else if ( msg == "setKeyboard(QString)" ) { | 1179 | } else if ( msg == "setKeyboard(QString)" ) { |
1200 | QString kb; | 1180 | QString kb; |
1201 | stream >> kb; | 1181 | stream >> kb; |
1202 | setenv("QWS_KEYBOARD",kb.latin1(),1); | 1182 | setenv("QWS_KEYBOARD",kb.latin1(),1); |
1203 | qwsServer->openKeyboard(); | 1183 | qwsServer->openKeyboard(); |
1204 | #endif | 1184 | #endif |
@@ -1216,54 +1196,54 @@ void Launcher::launcherMessage( const QCString &msg, const QByteArray &data) | |||
1216 | { | 1196 | { |
1217 | QDataStream stream( data, IO_ReadOnly ); | 1197 | QDataStream stream( data, IO_ReadOnly ); |
1218 | if ( msg == "setTabView(QString,int)" ) { | 1198 | if ( msg == "setTabView(QString,int)" ) { |
1219 | QString id; | 1199 | QString id; |
1220 | stream >> id; | 1200 | stream >> id; |
1221 | int mode; | 1201 | int mode; |
1222 | stream >> mode; | 1202 | stream >> mode; |
1223 | if ( tabs->view(id) ) | 1203 | if ( tabs->view(id) ) |
1224 | tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode ); | 1204 | tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode ); |
1225 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { | 1205 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { |
1226 | QString id; | 1206 | QString id; |
1227 | stream >> id; | 1207 | stream >> id; |
1228 | int mode; | 1208 | int mode; |
1229 | stream >> mode; | 1209 | stream >> mode; |
1230 | QString pixmapOrColor; | 1210 | QString pixmapOrColor; |
1231 | stream >> pixmapOrColor; | 1211 | stream >> pixmapOrColor; |
1232 | if ( tabs->view(id) ) | 1212 | if ( tabs->view(id) ) |
1233 | tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); | 1213 | tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); |
1234 | } else if ( msg == "setTextColor(QString,QString)" ) { | 1214 | } else if ( msg == "setTextColor(QString,QString)" ) { |
1235 | QString id; | 1215 | QString id; |
1236 | stream >> id; | 1216 | stream >> id; |
1237 | QString color; | 1217 | QString color; |
1238 | stream >> color; | 1218 | stream >> color; |
1239 | if ( tabs->view(id) ) | 1219 | if ( tabs->view(id) ) |
1240 | tabs->view(id)->setTextColor( QColor(color) ); | 1220 | tabs->view(id)->setTextColor( QColor(color) ); |
1241 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { | 1221 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { |
1242 | QString id; | 1222 | QString id; |
1243 | stream >> id; | 1223 | stream >> id; |
1244 | QString fam; | 1224 | QString fam; |
1245 | stream >> fam; | 1225 | stream >> fam; |
1246 | int size; | 1226 | int size; |
1247 | stream >> size; | 1227 | stream >> size; |
1248 | int weight; | 1228 | int weight; |
1249 | stream >> weight; | 1229 | stream >> weight; |
1250 | int italic; | 1230 | int italic; |
1251 | stream >> italic; | 1231 | stream >> italic; |
1252 | if ( tabs->view(id) ) | 1232 | if ( tabs->view(id) ) |
1253 | if ( !fam. isEmpty ( )) | 1233 | if ( !fam. isEmpty ( )) |
1254 | tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); | 1234 | tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); |
1255 | else | 1235 | else |
1256 | tabs->view(id)->unsetViewFont(); | 1236 | tabs->view(id)->unsetViewFont(); |
1257 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); | 1237 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); |
1258 | } | 1238 | } |
1259 | else if ( msg == "setBusyIndicatorType(QString)" ) { | 1239 | else if ( msg == "setBusyIndicatorType(QString)" ) { |
1260 | QString type; | 1240 | QString type; |
1261 | stream >> type; | 1241 | stream >> type; |
1262 | tabs->setBusyIndicatorType(type); | 1242 | tabs->setBusyIndicatorType(type); |
1263 | } | 1243 | } |
1264 | else if ( msg == "home()" ) { | 1244 | else if ( msg == "home()" ) { |
1265 | if ( isVisibleWindow( winId ( ))) | 1245 | if ( isVisibleWindow( winId ( ))) |
1266 | nextView ( ); | 1246 | nextView ( ); |
1267 | else | 1247 | else |
1268 | raise ( ); | 1248 | raise ( ); |
1269 | 1249 | ||
@@ -1275,6 +1255,6 @@ void Launcher::storageChanged() | |||
1275 | if ( in_lnk_props ) { | 1255 | if ( in_lnk_props ) { |
1276 | got_lnk_change = TRUE; | 1256 | got_lnk_change = TRUE; |
1277 | lnk_change = QString::null; | 1257 | lnk_change = QString::null; |
1278 | } else { | 1258 | } else { |
1279 | updateLink( QString::null ); | 1259 | updateLink( QString::null ); |
1280 | } | 1260 | } |
@@ -1287,3 +1267,3 @@ bool Launcher::mkdir(const QString &localPath) | |||
1287 | if (fullDir.exists()) | 1267 | if (fullDir.exists()) |
1288 | return true; | 1268 | return true; |
1289 | 1269 | ||
@@ -1299,4 +1279,4 @@ bool Launcher::mkdir(const QString &localPath) | |||
1299 | if (dirIndex == -1) { | 1279 | if (dirIndex == -1) { |
1300 | //qDebug("No seperators found in path %s", localPath.latin1()); | 1280 | //qDebug("No seperators found in path %s", localPath.latin1()); |
1301 | checkedPath = QDir::currentDirPath(); | 1281 | checkedPath = QDir::currentDirPath(); |
1302 | } | 1282 | } |
@@ -1304,21 +1284,21 @@ bool Launcher::mkdir(const QString &localPath) | |||
1304 | while (checkedPath != localPath) { | 1284 | while (checkedPath != localPath) { |
1305 | // no more seperators found, use the local path | 1285 | // no more seperators found, use the local path |
1306 | if (dirIndex == -1) | 1286 | if (dirIndex == -1) |
1307 | checkedPath = localPath; | 1287 | checkedPath = localPath; |
1308 | else { | 1288 | else { |
1309 | // the next directory to check | 1289 | // the next directory to check |
1310 | checkedPath = localPath.left(dirIndex) + "/"; | 1290 | checkedPath = localPath.left(dirIndex) + "/"; |
1311 | // advance the iterator; the next dir seperator | 1291 | // advance the iterator; the next dir seperator |
1312 | dirIndex = localPath.find(dirSeps, dirIndex+1); | 1292 | dirIndex = localPath.find(dirSeps, dirIndex+1); |
1313 | } | 1293 | } |
1314 | 1294 | ||
1315 | QDir checkDir(checkedPath); | 1295 | QDir checkDir(checkedPath); |
1316 | if (!checkDir.exists()) { | 1296 | if (!checkDir.exists()) { |
1317 | //qDebug("mkdir making dir %s", checkedPath.latin1()); | 1297 | //qDebug("mkdir making dir %s", checkedPath.latin1()); |
1318 | 1298 | ||
1319 | if (!checkDir.mkdir(checkedPath)) { | 1299 | if (!checkDir.mkdir(checkedPath)) { |
1320 | qDebug("Unable to make directory %s", checkedPath.latin1()); | 1300 | qDebug("Unable to make directory %s", checkedPath.latin1()); |
1321 | return FALSE; | 1301 | return FALSE; |
1322 | } | 1302 | } |
1323 | } | 1303 | } |
1324 | 1304 | ||
@@ -1335,3 +1315,3 @@ void Launcher::preloadApps() | |||
1335 | #ifndef QT_NO_COP | 1315 | #ifndef QT_NO_COP |
1336 | QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); | 1316 | QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); |
1337 | #endif | 1317 | #endif |
@@ -1339,17 +1319 @@ void Launcher::preloadApps() | |||
1339 | } | } | |
1340 | |||
1341 | DocumentTab::DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName) | ||
1342 | : OFileSelector(parent,mode,selector,dirName,fileName) | ||
1343 | { | ||
1344 | setYesCancelVisible(false); | ||
1345 | setToolbarVisible(false); | ||
1346 | setPermissionBarVisible(false); | ||
1347 | setLineEditVisible(false) ; | ||
1348 | //setChooserVisible( bool chooser ); | ||
1349 | |||
1350 | } | ||
1351 | |||
1352 | DocumentTab::~DocumentTab() { | ||
1353 | |||
1354 | } | ||
1355 | |||
diff --git a/core/obex/obex.cc b/core/obex/obex.cc index 595fed9..2a306de 100644 --- a/core/obex/obex.cc +++ b/core/obex/obex.cc | |||
@@ -13,2 +13,4 @@ using namespace OpieObex; | |||
13 | 13 | ||
14 | /* TRANSLATOR OpieObex::Obex */ | ||
15 | |||
14 | Obex::Obex( QObject *parent, const char* name ) | 16 | Obex::Obex( QObject *parent, const char* name ) |
@@ -111,7 +113,3 @@ void Obex::slotStdOut(OProcess* proc, char* buf, int len){ | |||
111 | if ( proc == m_rec ) { // only receive | 113 | if ( proc == m_rec ) { // only receive |
112 | for (int i = 0; i < len; i++ ) { | 114 | QByteArray ar( len ); |
113 | printf("%c", buf[i] ); | ||
114 | } | ||
115 | printf("\n"); | ||
116 | QByteArray ar( len ); | ||
117 | memcpy( ar.data(), buf, len ); | 115 | memcpy( ar.data(), buf, len ); |
@@ -127,9 +125,2 @@ void Obex::received() { | |||
127 | qWarning("ACHTUNG %s", filename.latin1() ); | 125 | qWarning("ACHTUNG %s", filename.latin1() ); |
128 | if (filename.contains( 'ö' ) || filename.contains( 'ä' ) || filename.contains('ü' ) ) { | ||
129 | qWarning("renaming!!!!"); | ||
130 | QFileInfo inf( filename ); | ||
131 | QString newName = "/tmp/opie-obex." + inf.extension(); | ||
132 | ::rename( QFile::encodeName( filename ).data(), newName ); | ||
133 | qWarning("name is %s", QFile::encodeName( filename ).data() ); | ||
134 | } | ||
135 | emit receivedFile( filename ); | 126 | emit receivedFile( filename ); |
diff --git a/core/obex/obexhandler.cpp b/core/obex/obexhandler.cpp index 6509d12..5aaf63c 100644 --- a/core/obex/obexhandler.cpp +++ b/core/obex/obexhandler.cpp | |||
@@ -10,2 +10,4 @@ using namespace OpieObex; | |||
10 | 10 | ||
11 | /* TRANSLATOR OpieObex::ObexHandler */ | ||
12 | |||
11 | ObexHandler::ObexHandler() { | 13 | ObexHandler::ObexHandler() { |
diff --git a/core/obex/obeximpl.cpp b/core/obex/obeximpl.cpp index 12a078f..5bfc779 100644 --- a/core/obex/obeximpl.cpp +++ b/core/obex/obeximpl.cpp | |||
@@ -5,2 +5,4 @@ using namespace OpieObex; | |||
5 | 5 | ||
6 | /* TRANSLATOR OpieObex::ObexImpl */ | ||
7 | |||
6 | ObexImpl::ObexImpl() { | 8 | ObexImpl::ObexImpl() { |
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp index 2931cf7..cf5d958 100644 --- a/core/obex/obexsend.cpp +++ b/core/obex/obexsend.cpp | |||
@@ -17,2 +17,4 @@ using namespace OpieObex; | |||
17 | 17 | ||
18 | /* TRANSLATOR OpieObex::SendWidget */ | ||
19 | |||
18 | 20 | ||
diff --git a/core/obex/receiver.cpp b/core/obex/receiver.cpp index 31c6afe..bf9e30c 100644 --- a/core/obex/receiver.cpp +++ b/core/obex/receiver.cpp | |||
@@ -3,2 +3,3 @@ | |||
3 | #include <sys/mman.h> | 3 | #include <sys/mman.h> |
4 | #include <stdlib.h> // int system | ||
4 | #include <unistd.h> | 5 | #include <unistd.h> |
@@ -11,2 +12,3 @@ | |||
11 | #include <qhbox.h> | 12 | #include <qhbox.h> |
13 | #include <qregexp.h> | ||
12 | #include <qtextview.h> | 14 | #include <qtextview.h> |
@@ -17,2 +19,3 @@ | |||
17 | #include <qpe/qcopenvelope_qws.h> | 19 | #include <qpe/qcopenvelope_qws.h> |
20 | #include <qpe/global.h> | ||
18 | 21 | ||
@@ -23,2 +26,4 @@ using namespace OpieObex; | |||
23 | 26 | ||
27 | /* TRANSLATOR OpieObex::Receiver */ | ||
28 | |||
24 | Receiver::Receiver() { | 29 | Receiver::Receiver() { |
@@ -33,3 +38,4 @@ Receiver::~Receiver() { | |||
33 | } | 38 | } |
34 | void Receiver::slotReceived( const QString& file ) { | 39 | void Receiver::slotReceived( const QString& _file ) { |
40 | QString file = _file; | ||
35 | int check = checkFile(file); | 41 | int check = checkFile(file); |
@@ -61,9 +67,33 @@ void Receiver::handleOther( const QString& other ) { | |||
61 | } | 67 | } |
62 | int Receiver::checkFile( const QString& file ) { | 68 | void Receiver::tidyUp( QString& _file, const QString& ending) { |
69 | /* libversit fails on BASE64 encoding we try to sed it away */ | ||
70 | QString file = _file; | ||
71 | char foo[24]; // big enough | ||
72 | (void)::strcpy(foo, "/tmp/opie-XXXXXX"); | ||
73 | |||
74 | int fd = ::mkstemp(foo); | ||
75 | |||
76 | if ( fd == -1 ) | ||
77 | return; | ||
78 | |||
79 | (void)::strncat( foo, ending.latin1(), 4 ); | ||
80 | _file = QString::fromLatin1( foo ); | ||
81 | QString cmd = QString("sed -e \"s/^\\(X-MICROSOFT-BODYINK\\)\\;/\\1:/;\" < %2 > %2 ").arg( Global::shellQuote(file)).arg( Global::shellQuote(_file) ); | ||
82 | qWarning("Executing: %s", cmd.latin1() ); | ||
83 | (void)::system( cmd.latin1() ); | ||
84 | |||
85 | cmd = QString("rm %1").arg( Global::shellQuote(file) ); | ||
86 | (void)::system( cmd.latin1() ); | ||
87 | } | ||
88 | int Receiver::checkFile( QString& file ) { | ||
63 | qWarning("check file!! %s", file.latin1() ); | 89 | qWarning("check file!! %s", file.latin1() ); |
64 | int ret; | 90 | int ret; |
91 | QString ending; | ||
92 | |||
65 | if (file.right(4) == ".vcs" ) { | 93 | if (file.right(4) == ".vcs" ) { |
66 | ret = Datebook; | 94 | ret = Datebook; |
95 | ending = QString::fromLatin1(".vcs"); | ||
67 | }else if ( file.right(4) == ".vcf") { | 96 | }else if ( file.right(4) == ".vcf") { |
68 | ret = AddressBook; | 97 | ret = AddressBook; |
98 | ending = QString::fromLatin1(".vcf"); | ||
69 | }else | 99 | }else |
@@ -72,2 +102,13 @@ int Receiver::checkFile( const QString& file ) { | |||
72 | 102 | ||
103 | if (ending.isEmpty() ) | ||
104 | return ret; | ||
105 | |||
106 | /** | ||
107 | * currently the parser is broken in regard of BASE64 encoding | ||
108 | * and M$ likes to send that. So we will executed a small | ||
109 | * tidy up system sed script | ||
110 | * At this point we can also remove umlaute from the filename | ||
111 | */ | ||
112 | tidyUp( file, ending ); | ||
113 | |||
73 | qWarning("check it now %d", ret ); | 114 | qWarning("check it now %d", ret ); |
@@ -76,2 +117,4 @@ int Receiver::checkFile( const QString& file ) { | |||
76 | 117 | ||
118 | /* TRANSLATOR OpieObex::OtherHandler */ | ||
119 | |||
77 | OtherHandler::OtherHandler() | 120 | OtherHandler::OtherHandler() |
@@ -135,2 +178,6 @@ QString OtherHandler::targetName( const QString& file ) { | |||
135 | QFileInfo info( file ); | 178 | QFileInfo info( file ); |
179 | |||
180 | /* $HOME needs to be set!!!! */ | ||
181 | Global::createDocDir(); | ||
182 | |||
136 | QString newFile = QPEApplication::documentDir()+ "/"+ info.baseName(); | 183 | QString newFile = QPEApplication::documentDir()+ "/"+ info.baseName(); |
@@ -151,21 +198,5 @@ void OtherHandler::copy(const QString& src, const QString& file) { | |||
151 | qWarning("src %s, dest %s", src.latin1(),file.latin1() ); | 198 | qWarning("src %s, dest %s", src.latin1(),file.latin1() ); |
152 | int src_fd = ::open( QFile::encodeName( src ), O_RDONLY ); | 199 | QString cmd = QString("mv %1 %2").arg( Global::shellQuote( src )). |
153 | int to_fd = ::open( QFile::encodeName( file), O_RDWR| O_CREAT| O_TRUNC, | 200 | arg( Global::shellQuote( file ) ); |
154 | S_IRUSR, S_IWUSR, S_IRGRP, S_IRGRP ); | 201 | ::system( cmd.latin1() ); |
155 | |||
156 | struct stat stater; | ||
157 | ::fstat(src_fd, &stater ); | ||
158 | ::lseek(to_fd, stater.st_size-1, SEEK_SET ); | ||
159 | ::write(to_fd, "", 1 ); | ||
160 | |||
161 | void *src_addr, *dest_addr; | ||
162 | src_addr = ::mmap(0, stater.st_size, PROT_READ, | ||
163 | MAP_FILE | MAP_SHARED, src_fd, 0 ); | ||
164 | dest_addr= ::mmap(0, stater.st_size, PROT_READ | PROT_WRITE, | ||
165 | MAP_FILE | MAP_PRIVATE, to_fd, 0 ); | ||
166 | |||
167 | ::memcpy(dest_addr , src_addr, stater.st_size ); | ||
168 | ::munmap(src_addr , stater.st_size ); | ||
169 | ::munmap(dest_addr, stater.st_size ); | ||
170 | |||
171 | // done | 202 | // done |
diff --git a/core/obex/receiver.h b/core/obex/receiver.h index 5b20146..e1d54df 100644 --- a/core/obex/receiver.h +++ b/core/obex/receiver.h | |||
@@ -23,5 +23,8 @@ namespace OpieObex { | |||
23 | void handleOther(const QString& ); | 23 | void handleOther(const QString& ); |
24 | int checkFile( const QString& file ); | 24 | /* will alter the file name */ |
25 | int checkFile( QString& file ); | ||
25 | bool testDateTodo(const QString& file); | 26 | bool testDateTodo(const QString& file); |
26 | bool testAddressbook(const QString& file); | 27 | bool testAddressbook(const QString& file); |
28 | /* called by checkFile */ | ||
29 | void tidyUp( QString& file, const QString& ending ); | ||
27 | 30 | ||