summaryrefslogtreecommitdiff
path: root/core/launcher/launcher.cpp
Unidiff
Diffstat (limited to 'core/launcher/launcher.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp664
1 files changed, 332 insertions, 332 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 0573330..8fe41f7 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -80,5 +80,5 @@ void CategoryTabWidget::prevTab()
80 if ( categoryBar ) { 80 if ( categoryBar ) {
81 int n = categoryBar->count(); 81 int n = categoryBar->count();
82 int tab = categoryBar->currentTab(); 82 int tab = categoryBar->currentTab();
83 if ( tab >= 0 ) 83 if ( tab >= 0 )
84 categoryBar->setCurrentTab( (tab - 1 + n)%n ); 84 categoryBar->setCurrentTab( (tab - 1 + n)%n );
@@ -90,5 +90,5 @@ void CategoryTabWidget::nextTab()
90 if ( categoryBar ) { 90 if ( categoryBar ) {
91 int n = categoryBar->count(); 91 int n = categoryBar->count();
92 int tab = categoryBar->currentTab(); 92 int tab = categoryBar->currentTab();
93 categoryBar->setCurrentTab( (tab + 1)%n ); 93 categoryBar->setCurrentTab( (tab + 1)%n );
94 } 94 }
@@ -101,21 +101,21 @@ void CategoryTabWidget::addItem( const QString& linkfile )
101 if ( !app->isValid() ) { 101 if ( !app->isValid() ) {
102 delete app; 102 delete app;
103 return; 103 return;
104 } 104 }
105 if ( !app->file().isEmpty() ) { 105 if ( !app->file().isEmpty() ) {
106 // A document 106 // A document
107 delete app; 107 delete app;
108 app = new DocLnk(linkfile); 108 app = new DocLnk(linkfile);
109 ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); 109 ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app);
110 return; 110 return;
111 } 111 }
112 for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { 112 for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) {
113 if ( !(*it).isEmpty() ) { 113 if ( !(*it).isEmpty() ) {
114 QRegExp tf(*it,FALSE,TRUE); 114 QRegExp tf(*it,FALSE,TRUE);
115 if ( tf.match(app->type()) >= 0 ) { 115 if ( tf.match(app->type()) >= 0 ) {
116 ((LauncherView*)stack->widget(i))->addItem(app); 116 ((LauncherView*)stack->widget(i))->addItem(app);
117 return; 117 return;
118 } 118 }
119 i++; 119 i++;
120 } 120 }
121 } 121 }
@@ -124,3 +124,3 @@ void CategoryTabWidget::addItem( const QString& linkfile )
124void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, 124void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
125 AppLnkSet* docFolder, const QList<FileSystem> &fs) 125 AppLnkSet* docFolder, const QList<FileSystem> &fs)
126{ 126{
@@ -141,5 +141,5 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
141 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { 141 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) {
142 if ( !(*it).isEmpty() ) { 142 if ( !(*it).isEmpty() ) {
143 newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); 143 newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it));
144 } 144 }
145 } 145 }
@@ -148,14 +148,14 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
148 while ( (l=it.current()) ) { 148 while ( (l=it.current()) ) {
149 if ( l->type() == "Separator" ) { 149 if ( l->type() == "Separator" ) {
150 rootFolder->remove(l); 150 rootFolder->remove(l);
151 delete l; 151 delete l;
152 } else { 152 } else {
153 int i=0; 153 int i=0;
154 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { 154 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) {
155 if ( *it == l->type() ) 155 if ( *it == l->type() )
156 ((LauncherView*)stack->widget(i))->addItem(l,FALSE); 156 ((LauncherView*)stack->widget(i))->addItem(l,FALSE);
157 i++; 157 i++;
158 } 158 }
159 } 159 }
160 ++it; 160 ++it;
161 } 161 }
@@ -163,3 +163,3 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
163 for (int i=0; i<tabs; i++) 163 for (int i=0; i<tabs; i++)
164 ((LauncherView*)stack->widget(i))->sort(); 164 ((LauncherView*)stack->widget(i))->sort();
165 165
@@ -192,5 +192,5 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm,
192 connect( view, SIGNAL(clicked(const AppLnk*)), 192 connect( view, SIGNAL(clicked(const AppLnk*)),
193 this, SIGNAL(clicked(const AppLnk*))); 193 this, SIGNAL(clicked(const AppLnk*)));
194 connect( view, SIGNAL(rightPressed(AppLnk*)), 194 connect( view, SIGNAL(rightPressed(AppLnk*)),
195 this, SIGNAL(rightPressed(AppLnk*))); 195 this, SIGNAL(rightPressed(AppLnk*)));
196 ids.append(id); 196 ids.append(id);
@@ -206,4 +206,4 @@ void CategoryTabWidget::updateLink(const QString& linkfile)
206 while ((view = (LauncherView*)stack->widget(i++))) { 206 while ((view = (LauncherView*)stack->widget(i++))) {
207 if ( view->removeLink(linkfile) ) 207 if ( view->removeLink(linkfile) )
208 break; 208 break;
209 } 209 }
@@ -226,6 +226,6 @@ void CategoryTabWidget::setBusy(bool on)
226 if ( on ) 226 if ( on )
227 ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); 227 ((LauncherView*)stack->visibleWidget())->setBusy(TRUE);
228 else 228 else
229 for (int i=0; i<tabs; i++) 229 for (int i=0; i<tabs; i++)
230 ((LauncherView*)stack->widget(i))->setBusy(FALSE); 230 ((LauncherView*)stack->widget(i))->setBusy(FALSE);
231} 231}
@@ -247,3 +247,3 @@ void CategoryTabBar::layoutTabs()
247 if ( !count() ) 247 if ( !count() )
248 return; 248 return;
249 249
@@ -261,52 +261,52 @@ void CategoryTabBar::layoutTabs()
261 for ( int i = 0; i < count(); i++ ) { 261 for ( int i = 0; i < count(); i++ ) {
262 t = tab(i); 262 t = tab(i);
263 // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) { 263 // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) {
264 if ( i != middleTab ) { 264 if ( i != middleTab ) {
265 // required += hiddenTabWidth + hframe - overlap; 265 // required += hiddenTabWidth + hframe - overlap;
266 available -= hiddenTabWidth + hframe - overlap; 266 available -= hiddenTabWidth + hframe - overlap;
267 if ( t->iconSet() != 0 ) 267 if ( t->iconSet() != 0 )
268 available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 268 available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
269 } else { 269 } else {
270 required += fm.width( t->text() ) + hframe - overlap; 270 required += fm.width( t->text() ) + hframe - overlap;
271 if ( t->iconSet() != 0 ) 271 if ( t->iconSet() != 0 )
272 required += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 272 required += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
273 } 273 }
274 } 274 }
275 for ( int i = 0; i < count(); i++ ) { 275 for ( int i = 0; i < count(); i++ ) {
276 t = tab(i); 276 t = tab(i);
277 // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) { 277 // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) {
278 if ( i != middleTab ) { 278 if ( i != middleTab ) {
279 int w = hiddenTabWidth; 279 int w = hiddenTabWidth;
280 int ih = 0; 280 int ih = 0;
281 if ( t->iconSet() != 0 ) { 281 if ( t->iconSet() != 0 ) {
282 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 282 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
283 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 283 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
284 } 284 }
285 int h = QMAX( fm.height(), ih ); 285 int h = QMAX( fm.height(), ih );
286 h = QMAX( h, QApplication::globalStrut().height() ); 286 h = QMAX( h, QApplication::globalStrut().height() );
287 287
288 h += vframe; 288 h += vframe;
289 w += hframe; 289 w += hframe;
290 290
291 t->setRect( QRect(x, 0, w, h) ); 291 t->setRect( QRect(x, 0, w, h) );
292 x += t->rect().width() - overlap; 292 x += t->rect().width() - overlap;
293 r = r.unite( t->rect() ); 293 r = r.unite( t->rect() );
294 } else { 294 } else {
295 int w = fm.width( t->text() ); 295 int w = fm.width( t->text() );
296 int ih = 0; 296 int ih = 0;
297 if ( t->iconSet() != 0 ) { 297 if ( t->iconSet() != 0 ) {
298 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 298 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
299 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 299 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
300 } 300 }
301 int h = QMAX( fm.height(), ih ); 301 int h = QMAX( fm.height(), ih );
302 h = QMAX( h, QApplication::globalStrut().height() ); 302 h = QMAX( h, QApplication::globalStrut().height() );
303 303
304 h += vframe; 304 h += vframe;
305 w += hframe; 305 w += hframe;
306 306
307 // t->setRect( QRect(x, 0, w * available/required, h) ); 307 // t->setRect( QRect(x, 0, w * available/required, h) );
308 t->setRect( QRect(x, 0, available, h) ); 308 t->setRect( QRect(x, 0, available, h) );
309 x += t->rect().width() - overlap; 309 x += t->rect().width() - overlap;
310 r = r.unite( t->rect() ); 310 r = r.unite( t->rect() );
311 } 311 }
312 } 312 }
@@ -342,3 +342,3 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const
342 if ( selected ) 342 if ( selected )
343 f.setBold( TRUE ); 343 f.setBold( TRUE );
344 p->setFont( f ); 344 p->setFont( f );
@@ -348,4 +348,4 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const
348 if ( t->iconSet() != 0 ) { 348 if ( t->iconSet() != 0 ) {
349 iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; 349 iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2;
350 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); 350 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
351 } 351 }
@@ -354,9 +354,9 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const
354 paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, 354 paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3,
355 r.top() + (r.height()-h)/2, w, h ), t, 355 r.top() + (r.height()-h)/2, w, h ), t,
356#if QT_VERSION >= 300 356#if QT_VERSION >= 300
357 t->identifier() == keyboardFocusTab() 357 t->identifier() == keyboardFocusTab()
358#else 358#else
359 t->identitifer() == keyboardFocusTab() 359 t->identitifer() == keyboardFocusTab()
360#endif 360#endif
361 ); 361 );
362} 362}
@@ -365,3 +365,3 @@ void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const
365void CategoryTabBar::paintLabel( QPainter* p, const QRect&, 365void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
366 QTab* t, bool has_focus ) const 366 QTab* t, bool has_focus ) const
367{ 367{
@@ -372,11 +372,11 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
372 if ( t->iconSet() ) { 372 if ( t->iconSet() ) {
373 // the tab has an iconset, draw it in the right mode 373 // the tab has an iconset, draw it in the right mode
374 QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; 374 QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled;
375 if ( mode == QIconSet::Normal && has_focus ) 375 if ( mode == QIconSet::Normal && has_focus )
376 mode = QIconSet::Active; 376 mode = QIconSet::Active;
377 QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); 377 QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode );
378 int pixw = pixmap.width(); 378 int pixw = pixmap.width();
379 int pixh = pixmap.height(); 379 int pixh = pixmap.height();
380 p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); 380 p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap );
381 r.setLeft( r.left() + pixw + 5 ); 381 r.setLeft( r.left() + pixw + 5 );
382 } 382 }
@@ -386,3 +386,3 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
386 if ( r.width() < 20 ) 386 if ( r.width() < 20 )
387 return; 387 return;
388 388
@@ -390,13 +390,13 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
390#if defined(_WS_WIN32_) 390#if defined(_WS_WIN32_)
391 if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) ) 391 if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) )
392 p->setPen( colorGroup().buttonText() ); 392 p->setPen( colorGroup().buttonText() );
393 else 393 else
394 p->setPen( colorGroup().foreground() ); 394 p->setPen( colorGroup().foreground() );
395#else 395#else
396 p->setPen( colorGroup().foreground() ); 396 p->setPen( colorGroup().foreground() );
397#endif 397#endif
398 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); 398 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
399 } else { 399 } else {
400 p->setPen( palette().disabled().foreground() ); 400 p->setPen( palette().disabled().foreground() );
401 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); 401 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
402 } 402 }
@@ -425,7 +425,7 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
425 connect( tabs, SIGNAL(selected(const QString&)), 425 connect( tabs, SIGNAL(selected(const QString&)),
426 this, SLOT(viewSelected(const QString&)) ); 426 this, SLOT(viewSelected(const QString&)) );
427 connect( tabs, SIGNAL(clicked(const AppLnk*)), 427 connect( tabs, SIGNAL(clicked(const AppLnk*)),
428 this, SLOT(select(const AppLnk*))); 428 this, SLOT(select(const AppLnk*)));
429 connect( tabs, SIGNAL(rightPressed(AppLnk*)), 429 connect( tabs, SIGNAL(rightPressed(AppLnk*)),
430 this, SLOT(properties(AppLnk*))); 430 this, SLOT(properties(AppLnk*)));
431 431
@@ -457,4 +457,4 @@ static bool isVisibleWindow(int wid)
457 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 457 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
458 if ( w->winId() == wid ) 458 if ( w->winId() == wid )
459 return !w->isFullyObscured(); 459 return !w->isFullyObscured();
460 } 460 }
@@ -466,5 +466,5 @@ void Launcher::showMaximized()
466 if ( isVisibleWindow( winId() ) ) 466 if ( isVisibleWindow( winId() ) )
467 doMaximize(); 467 doMaximize();
468 else 468 else
469 QTimer::singleShot( 20, this, SLOT(doMaximize()) ); 469 QTimer::singleShot( 20, this, SLOT(doMaximize()) );
470} 470}
@@ -485,8 +485,8 @@ void Launcher::updateMimeTypes(AppLnkSet* folder)
485 for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { 485 for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) {
486 AppLnk *app = it.current(); 486 AppLnk *app = it.current();
487 if ( app->type() == "Folder" ) 487 if ( app->type() == "Folder" )
488 updateMimeTypes((AppLnkSet *)app); 488 updateMimeTypes((AppLnkSet *)app);
489 else { 489 else {
490 MimeType::registerApp(*app); 490 MimeType::registerApp(*app);
491 } 491 }
492 } 492 }
@@ -533,13 +533,13 @@ void Launcher::select( const AppLnk *appLnk )
533 if ( appLnk->type() == "Folder" ) { 533 if ( appLnk->type() == "Folder" ) {
534 // Not supported: flat is simpler for the user 534 // Not supported: flat is simpler for the user
535 } else { 535 } else {
536 if ( appLnk->exec().isNull() ) { 536 if ( appLnk->exec().isNull() ) {
537 QMessageBox::information(this,tr("No application"), 537 QMessageBox::information(this,tr("No application"),
538 tr("<p>No application is defined for this document." 538 tr("<p>No application is defined for this document."
539 "<p>Type is %1.").arg(appLnk->type())); 539 "<p>Type is %1.").arg(appLnk->type()));
540 return; 540 return;
541 } 541 }
542 tabs->setBusy(TRUE); 542 tabs->setBusy(TRUE);
543 emit executing( appLnk ); 543 emit executing( appLnk );
544 appLnk->execute(); 544 appLnk->execute();
545 } 545 }
@@ -556,14 +556,14 @@ void Launcher::properties( AppLnk *appLnk )
556 if ( appLnk->type() == "Folder" ) { 556 if ( appLnk->type() == "Folder" ) {
557 // Not supported: flat is simpler for the user 557 // Not supported: flat is simpler for the user
558 } else { 558 } else {
559 in_lnk_props = TRUE; 559 in_lnk_props = TRUE;
560 got_lnk_change = FALSE; 560 got_lnk_change = FALSE;
561 LnkProperties prop(appLnk); 561 LnkProperties prop(appLnk);
562 connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 562 connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
563 prop.showMaximized(); 563 prop.showMaximized();
564 prop.exec(); 564 prop.exec();
565 in_lnk_props = FALSE; 565 in_lnk_props = FALSE;
566 if ( got_lnk_change ) { 566 if ( got_lnk_change ) {
567 updateLink(lnk_change); 567 updateLink(lnk_change);
568 } 568 }
569 } 569 }
@@ -574,7 +574,7 @@ void Launcher::updateLink(const QString& link)
574 if (link.isNull()) 574 if (link.isNull())
575 updateTabs(); 575 updateTabs();
576 else if (link.isEmpty()) 576 else if (link.isEmpty())
577 updateDocs(); 577 updateDocs();
578 else 578 else
579 tabs->updateLink(link); 579 tabs->updateLink(link);
580} 580}
@@ -585,56 +585,56 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
585 if ( msg == "linkChanged(QString)" ) { 585 if ( msg == "linkChanged(QString)" ) {
586 QString link; 586 QString link;
587 stream >> link; 587 stream >> link;
588 if ( in_lnk_props ) { 588 if ( in_lnk_props ) {
589 got_lnk_change = TRUE; 589 got_lnk_change = TRUE;
590 lnk_change = link; 590 lnk_change = link;
591 } else { 591 } else {
592 updateLink(link); 592 updateLink(link);
593 } 593 }
594 } else if ( msg == "busy()" ) { 594 } else if ( msg == "busy()" ) {
595 emit busy(); 595 emit busy();
596 } else if ( msg == "notBusy(QString)" ) { 596 } else if ( msg == "notBusy(QString)" ) {
597 QString app; 597 QString app;
598 stream >> app; 598 stream >> app;
599 tabs->setBusy(FALSE); 599 tabs->setBusy(FALSE);
600 emit notBusy(app); 600 emit notBusy(app);
601 } else if ( msg == "mkdir(QString)" ) { 601 } else if ( msg == "mkdir(QString)" ) {
602 QString dir; 602 QString dir;
603 stream >> dir; 603 stream >> dir;
604 if ( !dir.isEmpty() ) 604 if ( !dir.isEmpty() )
605 mkdir( dir ); 605 mkdir( dir );
606 } else if ( msg == "rdiffGenSig(QString,QString)" ) { 606 } else if ( msg == "rdiffGenSig(QString,QString)" ) {
607 QString baseFile, sigFile; 607 QString baseFile, sigFile;
608 stream >> baseFile >> sigFile; 608 stream >> baseFile >> sigFile;
609 QRsync::generateSignature( baseFile, sigFile ); 609 QRsync::generateSignature( baseFile, sigFile );
610 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { 610 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
611 QString baseFile, sigFile, deltaFile; 611 QString baseFile, sigFile, deltaFile;
612 stream >> baseFile >> sigFile >> deltaFile; 612 stream >> baseFile >> sigFile >> deltaFile;
613 QRsync::generateDiff( baseFile, sigFile, deltaFile ); 613 QRsync::generateDiff( baseFile, sigFile, deltaFile );
614 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { 614 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) {
615 QString baseFile, deltaFile; 615 QString baseFile, deltaFile;
616 stream >> baseFile >> deltaFile; 616 stream >> baseFile >> deltaFile;
617 if ( !QFile::exists( baseFile ) ) { 617 if ( !QFile::exists( baseFile ) ) {
618 QFile f( baseFile ); 618 QFile f( baseFile );
619 f.open( IO_WriteOnly ); 619 f.open( IO_WriteOnly );
620 f.close(); 620 f.close();
621 } 621 }
622 QRsync::applyDiff( baseFile, deltaFile ); 622 QRsync::applyDiff( baseFile, deltaFile );
623 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); 623 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
624 e << baseFile; 624 e << baseFile;
625 } else if ( msg == "rdiffCleanup()" ) { 625 } else if ( msg == "rdiffCleanup()" ) {
626 mkdir( "/tmp/rdiff" ); 626 mkdir( "/tmp/rdiff" );
627 QDir dir; 627 QDir dir;
628 dir.setPath( "/tmp/rdiff" ); 628 dir.setPath( "/tmp/rdiff" );
629 QStringList entries = dir.entryList(); 629 QStringList entries = dir.entryList();
630 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) 630 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
631 dir.remove( *it ); 631 dir.remove( *it );
632 } else if ( msg == "sendHandshakeInfo()" ) { 632 } else if ( msg == "sendHandshakeInfo()" ) {
633 QString home = getenv( "HOME" ); 633 QString home = getenv( "HOME" );
634 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); 634 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
635 e << home; 635 e << home;
636 int locked = (int) Desktop::screenLocked(); 636 int locked = (int) Desktop::screenLocked();
637 e << locked; 637 e << locked;
638 // register an app for autostart 638 // register an app for autostart
639 // if clear is send the list is cleared. 639 // if clear is send the list is cleared.
640 } else if ( msg == "autoStart(QString)" ) { 640 } else if ( msg == "autoStart(QString)" ) {
@@ -645,3 +645,3 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
645 if ( appName.compare("clear") == 0){ 645 if ( appName.compare("clear") == 0){
646 cfg.writeEntry("Apps", ""); 646 cfg.writeEntry("Apps", "");
647 } 647 }
@@ -653,15 +653,15 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
653 if ( modifier.compare("add") == 0 ){ 653 if ( modifier.compare("add") == 0 ){
654 // only add it appname is entered 654 // only add it appname is entered
655 if (!appName.isEmpty()) { 655 if (!appName.isEmpty()) {
656 cfg.writeEntry("Apps", appName); 656 cfg.writeEntry("Apps", appName);
657 } 657 }
658 } else if (modifier.compare("remove") == 0 ) { 658 } else if (modifier.compare("remove") == 0 ) {
659 // need to change for multiple entries 659 // need to change for multiple entries
660 // actually remove is right now simular to clear, but in future there 660 // actually remove is right now simular to clear, but in future there
661 // should be multiple apps in autostart possible. 661 // should be multiple apps in autostart possible.
662 QString checkName; 662 QString checkName;
663 checkName = cfg.readEntry("Apps", ""); 663 checkName = cfg.readEntry("Apps", "");
664 if (checkName == appName) { 664 if (checkName == appName) {
665 cfg.writeEntry("Apps", ""); 665 cfg.writeEntry("Apps", "");
666 } 666 }
667 } 667 }
@@ -670,99 +670,99 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
670 const QList<FileSystem> &fs = storage->fileSystems(); 670 const QList<FileSystem> &fs = storage->fileSystems();
671 QListIterator<FileSystem> it ( fs ); 671 QListIterator<FileSystem> it ( fs );
672 QString s; 672 QString s;
673 QString homeDir = getenv("HOME"); 673 QString homeDir = getenv("HOME");
674 QString hardDiskHome; 674 QString hardDiskHome;
675 for ( ; it.current(); ++it ) { 675 for ( ; it.current(); ++it ) {
676 if ( (*it)->isRemovable() ) 676 if ( (*it)->isRemovable() )
677 s += (*it)->name() + "=" + (*it)->path() + "/Documents " 677 s += (*it)->name() + "=" + (*it)->path() + "/Documents "
678 + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) 678 + QString::number( (*it)->availBlocks() * (*it)->blockSize() )
679 + " " + (*it)->options() + ";"; 679 + " " + (*it)->options() + ";";
680 else if ( (*it)->disk() == "/dev/mtdblock1" || 680 else if ( (*it)->disk() == "/dev/mtdblock1" ||
681 (*it)->disk() == "/dev/mtdblock/1" ) 681 (*it)->disk() == "/dev/mtdblock/1" )
682 s += (*it)->name() + "=" + homeDir + "/Documents " 682 s += (*it)->name() + "=" + homeDir + "/Documents "
683 + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) 683 + QString::number( (*it)->availBlocks() * (*it)->blockSize() )
684 + " " + (*it)->options() + ";"; 684 + " " + (*it)->options() + ";";
685 else if ( (*it)->name().contains( "Hard Disk") && 685 else if ( (*it)->name().contains( "Hard Disk") &&
686 homeDir.contains( (*it)->path() ) && 686 homeDir.contains( (*it)->path() ) &&
687 (*it)->path().length() > hardDiskHome.length() ) 687 (*it)->path().length() > hardDiskHome.length() )
688 hardDiskHome = 688 hardDiskHome =
689 (*it)->name() + "=" + homeDir + "/Documents " 689 (*it)->name() + "=" + homeDir + "/Documents "
690 + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) 690 + QString::number( (*it)->availBlocks() * (*it)->blockSize() )
691 + " " + (*it)->options() + ";"; 691 + " " + (*it)->options() + ";";
692 } 692 }
693 if ( !hardDiskHome.isEmpty() ) 693 if ( !hardDiskHome.isEmpty() )
694 s += hardDiskHome; 694 s += hardDiskHome;
695 695
696 e << s; 696 e << s;
697 } else if ( msg == "sendSyncDate(QString)" ) { 697 } else if ( msg == "sendSyncDate(QString)" ) {
698 QString app; 698 QString app;
699 stream >> app; 699 stream >> app;
700 Config cfg( "qpe" ); 700 Config cfg( "qpe" );
701 cfg.setGroup("SyncDate"); 701 cfg.setGroup("SyncDate");
702 QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); 702 QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" );
703 e << app << cfg.readEntry( app ); 703 e << app << cfg.readEntry( app );
704 //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), 704 //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(),
705 //cfg.readEntry( app ).latin1() ); 705 //cfg.readEntry( app ).latin1() );
706 } else if ( msg == "setSyncDate(QString,QString)" ) { 706 } else if ( msg == "setSyncDate(QString,QString)" ) {
707 QString app, date; 707 QString app, date;
708 stream >> app >> date; 708 stream >> app >> date;
709 Config cfg( "qpe" ); 709 Config cfg( "qpe" );
710 cfg.setGroup("SyncDate"); 710 cfg.setGroup("SyncDate");
711 cfg.writeEntry( app, date ); 711 cfg.writeEntry( app, date );
712 //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); 712 //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1());
713 } else if ( msg == "startSync(QString)" ) { 713 } else if ( msg == "startSync(QString)" ) {
714 QString what; 714 QString what;
715 stream >> what; 715 stream >> what;
716 delete syncDialog; syncDialog = 0; 716 delete syncDialog; syncDialog = 0;
717 syncDialog = new SyncDialog( this, "syncProgress", FALSE, 717 syncDialog = new SyncDialog( this, "syncProgress", FALSE,
718 WStyle_Tool | WStyle_Customize | 718 WStyle_Tool | WStyle_Customize |
719 Qt::WStyle_StaysOnTop ); 719 Qt::WStyle_StaysOnTop );
720 syncDialog->showMaximized(); 720 syncDialog->showMaximized();
721 syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); 721 syncDialog->whatLabel->setText( "<b>" + what + "</b>" );
722 connect( syncDialog->buttonCancel, SIGNAL( clicked() ), 722 connect( syncDialog->buttonCancel, SIGNAL( clicked() ),
723 SLOT( cancelSync() ) ); 723 SLOT( cancelSync() ) );
724 } 724 }
725 else if ( msg == "stopSync()") { 725 else if ( msg == "stopSync()") {
726 delete syncDialog; syncDialog = 0; 726 delete syncDialog; syncDialog = 0;
727 } else if ( msg == "getAllDocLinks()" ) { 727 } else if ( msg == "getAllDocLinks()" ) {
728 loadDocs(); 728 loadDocs();
729 729
730 QString contents; 730 QString contents;
731 731
732 for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { 732 for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) {
733 DocLnk *doc = it.current(); 733 DocLnk *doc = it.current();
734 QFileInfo fi( doc->file() ); 734 QFileInfo fi( doc->file() );
735 if ( !fi.exists() ) 735 if ( !fi.exists() )
736 continue; 736 continue;
737 737
738 bool fake = !doc->linkFileKnown(); 738 bool fake = !doc->linkFileKnown();
739 if ( !fake ) { 739 if ( !fake ) {
740 QFile f( doc->linkFile() ); 740 QFile f( doc->linkFile() );
741 if ( f.open( IO_ReadOnly ) ) { 741 if ( f.open( IO_ReadOnly ) ) {
742 QTextStream ts( &f ); 742 QTextStream ts( &f );
743 ts.setEncoding( QTextStream::UnicodeUTF8 ); 743 ts.setEncoding( QTextStream::UnicodeUTF8 );
744 contents += ts.read(); 744 contents += ts.read();
745 f.close(); 745 f.close();
746 } else 746 } else
747 fake = TRUE; 747 fake = TRUE;
748 } 748 }
749 if (fake) { 749 if (fake) {
750 contents += "[Desktop Entry]\n"; 750 contents += "[Desktop Entry]\n";
751 contents += "Categories = " + Qtopia::Record::idsToString( doc->categories() ) + "\n"; 751 contents += "Categories = " + Qtopia::Record::idsToString( doc->categories() ) + "\n";
752 contents += "File = "+doc->file()+"\n"; 752 contents += "File = "+doc->file()+"\n";
753 contents += "Name = "+doc->name()+"\n"; 753 contents += "Name = "+doc->name()+"\n";
754 contents += "Type = "+doc->type()+"\n"; 754 contents += "Type = "+doc->type()+"\n";
755 } 755 }
756 contents += QString("Size = %1\n").arg( fi.size() ); 756 contents += QString("Size = %1\n").arg( fi.size() );
757 } 757 }
758 758
759 //qDebug( "sending length %d", contents.length() ); 759 //qDebug( "sending length %d", contents.length() );
760 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); 760 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
761 e << contents; 761 e << contents;
762 762
763 //qDebug( "================ \n\n%s\n\n===============", 763 qDebug( "================ \n\n%s\n\n===============",
764 //contents.latin1() ); 764 contents.latin1() );
765 765
766 delete docsFolder; 766 delete docsFolder;
767 docsFolder = 0; 767 docsFolder = 0;
768 } 768 }
@@ -778,6 +778,6 @@ void Launcher::storageChanged()
778 if ( in_lnk_props ) { 778 if ( in_lnk_props ) {
779 got_lnk_change = TRUE; 779 got_lnk_change = TRUE;
780 lnk_change = ""; 780 lnk_change = "";
781 } else { 781 } else {
782 updateDocs(); 782 updateDocs();
783 } 783 }
@@ -790,3 +790,3 @@ bool Launcher::mkdir(const QString &localPath)
790 if (fullDir.exists()) 790 if (fullDir.exists())
791 return true; 791 return true;
792 792
@@ -802,4 +802,4 @@ bool Launcher::mkdir(const QString &localPath)
802 if (dirIndex == -1) { 802 if (dirIndex == -1) {
803 //qDebug("No seperators found in path %s", localPath.latin1()); 803 //qDebug("No seperators found in path %s", localPath.latin1());
804 checkedPath = QDir::currentDirPath(); 804 checkedPath = QDir::currentDirPath();
805 } 805 }
@@ -807,21 +807,21 @@ bool Launcher::mkdir(const QString &localPath)
807 while (checkedPath != localPath) { 807 while (checkedPath != localPath) {
808 // no more seperators found, use the local path 808 // no more seperators found, use the local path
809 if (dirIndex == -1) 809 if (dirIndex == -1)
810 checkedPath = localPath; 810 checkedPath = localPath;
811 else { 811 else {
812 // the next directory to check 812 // the next directory to check
813 checkedPath = localPath.left(dirIndex) + "/"; 813 checkedPath = localPath.left(dirIndex) + "/";
814 // advance the iterator; the next dir seperator 814 // advance the iterator; the next dir seperator
815 dirIndex = localPath.find(dirSeps, dirIndex+1); 815 dirIndex = localPath.find(dirSeps, dirIndex+1);
816 } 816 }
817 817
818 QDir checkDir(checkedPath); 818 QDir checkDir(checkedPath);
819 if (!checkDir.exists()) { 819 if (!checkDir.exists()) {
820 //qDebug("mkdir making dir %s", checkedPath.latin1()); 820 //qDebug("mkdir making dir %s", checkedPath.latin1());
821 821
822 if (!checkDir.mkdir(checkedPath)) { 822 if (!checkDir.mkdir(checkedPath)) {
823 qDebug("Unable to make directory %s", checkedPath.latin1()); 823 qDebug("Unable to make directory %s", checkedPath.latin1());
824 return FALSE; 824 return FALSE;
825 } 825 }
826 } 826 }
827 827
@@ -837,3 +837,3 @@ void Launcher::preloadApps()
837 for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { 837 for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) {
838 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); 838 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()");
839 } 839 }