summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2002-09-25 16:10:02 (UTC)
committer zecke <zecke>2002-09-25 16:10:02 (UTC)
commita546a6ea143da9244a06f1e40829254e8bf4dc8f (patch) (unidiff)
tree6e9e2a5606e9eec5f6ac751dd99ddedf1e42fb29 /library
parent5b7e930de7cc42f14b078072b8d23b977001e7b6 (diff)
downloadopie-a546a6ea143da9244a06f1e40829254e8bf4dc8f.zip
opie-a546a6ea143da9244a06f1e40829254e8bf4dc8f.tar.gz
opie-a546a6ea143da9244a06f1e40829254e8bf4dc8f.tar.bz2
Fix bigPixmaps BUG.
instead of returning the bigPixmap from the d->mPixmaps[1] I returned the deprecated variable which was null
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/applnk.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp
index 1f053f3..44f3f58 100644
--- a/library/applnk.cpp
+++ b/library/applnk.cpp
@@ -238,513 +238,513 @@ void AppLnk::setSmallIconSize(int small)
238*/ 238*/
239int AppLnk::smallIconSize() 239int AppLnk::smallIconSize()
240{ 240{
241 return smallSize; 241 return smallSize;
242} 242}
243 243
244 244
245/*! 245/*!
246 Sets the size used for large icons to \a big pixels. 246 Sets the size used for large icons to \a big pixels.
247 Only affects AppLnk objects created after the call. 247 Only affects AppLnk objects created after the call.
248 248
249 \sa bigIconSize() setIcon() 249 \sa bigIconSize() setIcon()
250*/ 250*/
251void AppLnk::setBigIconSize(int big) 251void AppLnk::setBigIconSize(int big)
252{ 252{
253 bigSize = big; 253 bigSize = big;
254} 254}
255 255
256/*! 256/*!
257 Returns the size used for large icons. 257 Returns the size used for large icons.
258 258
259 \sa setBigIconSize() setIcon() 259 \sa setBigIconSize() setIcon()
260*/ 260*/
261int AppLnk::bigIconSize() 261int AppLnk::bigIconSize()
262{ 262{
263 return bigSize; 263 return bigSize;
264} 264}
265 265
266 266
267/*! 267/*!
268 \fn QString AppLnk::name() const 268 \fn QString AppLnk::name() const
269 269
270 Returns the Name property. This is the user-visible name for the 270 Returns the Name property. This is the user-visible name for the
271 document or application, not the filename. 271 document or application, not the filename.
272 272
273 See \link #files-and-links Files and Links\endlink. 273 See \link #files-and-links Files and Links\endlink.
274 274
275 \sa setName() 275 \sa setName()
276*/ 276*/
277/*! 277/*!
278 \fn QString AppLnk::exec() const 278 \fn QString AppLnk::exec() const
279 279
280 Returns the Exec property. This is the name of the executable 280 Returns the Exec property. This is the name of the executable
281 program associated with the AppLnk. 281 program associated with the AppLnk.
282 282
283 \sa setExec() 283 \sa setExec()
284*/ 284*/
285/*! 285/*!
286 \fn QString AppLnk::rotation() const 286 \fn QString AppLnk::rotation() const
287 287
288 Returns the Rotation property. The value is 0, 90, 180 or 270 288 Returns the Rotation property. The value is 0, 90, 180 or 270
289 degrees. 289 degrees.
290*/ 290*/
291/*! 291/*!
292 \fn QString AppLnk::comment() const 292 \fn QString AppLnk::comment() const
293 293
294 Returns the Comment property. 294 Returns the Comment property.
295 295
296 \sa setComment() 296 \sa setComment()
297*/ 297*/
298/*! 298/*!
299 \fn QStringList AppLnk::mimeTypes() const 299 \fn QStringList AppLnk::mimeTypes() const
300 300
301 Returns the MimeTypes property. This is the list of MIME types 301 Returns the MimeTypes property. This is the list of MIME types
302 that the application can view or edit. 302 that the application can view or edit.
303*/ 303*/
304/*! 304/*!
305 \fn const QArray<int>& AppLnk::categories() const 305 \fn const QArray<int>& AppLnk::categories() const
306 306
307 Returns the Categories property. 307 Returns the Categories property.
308 308
309 See the CategoryWidget for more details. 309 See the CategoryWidget for more details.
310 310
311 \sa setCategories() 311 \sa setCategories()
312*/ 312*/
313 313
314const QArray<int>& AppLnk::categories() const 314const QArray<int>& AppLnk::categories() const
315{ 315{
316 d->ensureCatArray(); 316 d->ensureCatArray();
317 return d->mCat; 317 return d->mCat;
318} 318}
319 319
320/*! 320/*!
321 \fn int AppLnk::id() const 321 \fn int AppLnk::id() const
322 322
323 Returns the id of the AppLnk. If the AppLnk is not in an AppLnkSet, 323 Returns the id of the AppLnk. If the AppLnk is not in an AppLnkSet,
324 this value is 0, otherwise it is a value that is unique for the 324 this value is 0, otherwise it is a value that is unique for the
325 duration of the current process. 325 duration of the current process.
326 326
327 \sa AppLnkSet::find() 327 \sa AppLnkSet::find()
328*/ 328*/
329 329
330/*! 330/*!
331 \fn bool AppLnk::isValid() const 331 \fn bool AppLnk::isValid() const
332 332
333 Returns TRUE if this AppLnk is valid; otherwise returns FALSE. 333 Returns TRUE if this AppLnk is valid; otherwise returns FALSE.
334*/ 334*/
335 335
336/*! 336/*!
337 Creates an invalid AppLnk. 337 Creates an invalid AppLnk.
338 338
339 \sa isValid() 339 \sa isValid()
340*/ 340*/
341AppLnk::AppLnk() 341AppLnk::AppLnk()
342{ 342{
343 mId = 0; 343 mId = 0;
344 d = new AppLnkPrivate(); 344 d = new AppLnkPrivate();
345} 345}
346 346
347/*! 347/*!
348 Loads \a file (e.g. \e app.desktop) as an AppLnk. 348 Loads \a file (e.g. \e app.desktop) as an AppLnk.
349 349
350 \sa writeLink() 350 \sa writeLink()
351*/ 351*/
352AppLnk::AppLnk( const QString &file ) 352AppLnk::AppLnk( const QString &file )
353{ 353{
354 QStringList sl; 354 QStringList sl;
355 d = new AppLnkPrivate(); 355 d = new AppLnkPrivate();
356 if ( !file.isNull() ) { 356 if ( !file.isNull() ) {
357 Config config( file, Config::File ); 357 Config config( file, Config::File );
358 358
359 if ( config.isValid() ) { 359 if ( config.isValid() ) {
360 config.setGroup( "Desktop Entry" ); 360 config.setGroup( "Desktop Entry" );
361 361
362 mName = config.readEntry( "Name", file ); 362 mName = config.readEntry( "Name", file );
363 mExec = config.readEntry( "Exec" ); 363 mExec = config.readEntry( "Exec" );
364 mType = config.readEntry( "Type", QString::null ); 364 mType = config.readEntry( "Type", QString::null );
365 mIconFile = config.readEntry( "Icon", QString::null ); 365 mIconFile = config.readEntry( "Icon", QString::null );
366 mRotation = config.readEntry( "Rotation", "" ); 366 mRotation = config.readEntry( "Rotation", "" );
367 mComment = config.readEntry( "Comment", QString::null ); 367 mComment = config.readEntry( "Comment", QString::null );
368 // MIME types are case-insensitive. 368 // MIME types are case-insensitive.
369 mMimeTypes = config.readListEntry( "MimeType", ';' ); 369 mMimeTypes = config.readListEntry( "MimeType", ';' );
370 for (QStringList::Iterator it=mMimeTypes.begin(); it!=mMimeTypes.end(); ++it) 370 for (QStringList::Iterator it=mMimeTypes.begin(); it!=mMimeTypes.end(); ++it)
371 *it = (*it).lower(); 371 *it = (*it).lower();
372 mMimeTypeIcons = config.readListEntry( "MimeTypeIcons", ';' ); 372 mMimeTypeIcons = config.readListEntry( "MimeTypeIcons", ';' );
373 mLinkFile = file; 373 mLinkFile = file;
374 mFile = config.readEntry("File", QString::null); 374 mFile = config.readEntry("File", QString::null);
375 if ( mFile[0] != '/' ) { 375 if ( mFile[0] != '/' ) {
376 int slash = file.findRev('/'); 376 int slash = file.findRev('/');
377 if ( slash >= 0 ) { 377 if ( slash >= 0 ) {
378 mFile = file.left(slash) + '/' + mFile; 378 mFile = file.left(slash) + '/' + mFile;
379 } 379 }
380 } 380 }
381 d->mCatList = config.readListEntry("Categories", ';'); 381 d->mCatList = config.readListEntry("Categories", ';');
382 if ( d->mCatList[0].toInt() < -1 ) { 382 if ( d->mCatList[0].toInt() < -1 ) {
383 // numeric cats in file! convert to text 383 // numeric cats in file! convert to text
384 Categories cat( 0 ); 384 Categories cat( 0 );
385 cat.load( categoryFileName() ); 385 cat.load( categoryFileName() );
386 d->mCat.resize( d->mCatList.count() ); 386 d->mCat.resize( d->mCatList.count() );
387 int i; 387 int i;
388 QStringList::ConstIterator it; 388 QStringList::ConstIterator it;
389 for ( i = 0, it = d->mCatList.begin(); it != d->mCatList.end(); 389 for ( i = 0, it = d->mCatList.begin(); it != d->mCatList.end();
390 ++it, i++ ) { 390 ++it, i++ ) {
391 bool number; 391 bool number;
392 int id = (*it).toInt( &number ); 392 int id = (*it).toInt( &number );
393 if ( !number ) { 393 if ( !number ) {
394 // convert from text 394 // convert from text
395 id = cat.id( "Document View", *it ); 395 id = cat.id( "Document View", *it );
396 if ( id == 0 ) 396 if ( id == 0 )
397 id = cat.addCategory( "Document View", *it ); 397 id = cat.addCategory( "Document View", *it );
398 } 398 }
399 d->mCat[i] = id; 399 d->mCat[i] = id;
400 } 400 }
401 d->updateCatListFromArray(); 401 d->updateCatListFromArray();
402 } 402 }
403 } 403 }
404 } 404 }
405 mId = 0; 405 mId = 0;
406} 406}
407 407
408AppLnk& AppLnk::operator=(const AppLnk &copy) 408AppLnk& AppLnk::operator=(const AppLnk &copy)
409{ 409{
410 if ( mId ) 410 if ( mId )
411 qWarning("Deleting AppLnk that is in an AppLnkSet"); 411 qWarning("Deleting AppLnk that is in an AppLnkSet");
412 if ( d ) 412 if ( d )
413 delete d; 413 delete d;
414 414
415 415
416 mName = copy.mName; 416 mName = copy.mName;
417 417
418 /* remove for Qtopia 3.0 -zecke */ 418 /* remove for Qtopia 3.0 -zecke */
419 mPixmap = copy.mPixmap; 419 mPixmap = copy.mPixmap;
420 mBigPixmap = copy.mBigPixmap; 420 mBigPixmap = copy.mBigPixmap;
421 421
422 mExec = copy.mExec; 422 mExec = copy.mExec;
423 mType = copy.mType; 423 mType = copy.mType;
424 mRotation = copy.mRotation; 424 mRotation = copy.mRotation;
425 mComment = copy.mComment; 425 mComment = copy.mComment;
426 mFile = copy.mFile; 426 mFile = copy.mFile;
427 mLinkFile = copy.mLinkFile; 427 mLinkFile = copy.mLinkFile;
428 mIconFile = copy.mIconFile; 428 mIconFile = copy.mIconFile;
429 mMimeTypes = copy.mMimeTypes; 429 mMimeTypes = copy.mMimeTypes;
430 mMimeTypeIcons = copy.mMimeTypeIcons; 430 mMimeTypeIcons = copy.mMimeTypeIcons;
431 mId = 0; 431 mId = 0;
432 d = new AppLnkPrivate(); 432 d = new AppLnkPrivate();
433 d->mCat = copy.d->mCat; 433 d->mCat = copy.d->mCat;
434 d->mCatList = copy.d->mCatList; 434 d->mCatList = copy.d->mCatList;
435 d->mPixmaps = copy.d->mPixmaps; 435 d->mPixmaps = copy.d->mPixmaps;
436 436
437 return *this; 437 return *this;
438} 438}
439/*! 439/*!
440 protected internally to share code 440 protected internally to share code
441 should I document that at all? 441 should I document that at all?
442 I don't know the TT style for that 442 I don't know the TT style for that
443*/ 443*/
444const QPixmap& AppLnk::pixmap( int pos, int size ) const { 444const QPixmap& AppLnk::pixmap( int pos, int size ) const {
445 if ( d->mPixmaps[pos].isNull() ) { 445 if ( d->mPixmaps[pos].isNull() ) {
446 AppLnk* that = (AppLnk*)this; 446 AppLnk* that = (AppLnk*)this;
447 if ( mIconFile.isEmpty() ) { 447 if ( mIconFile.isEmpty() ) {
448 MimeType mt(type()); 448 MimeType mt(type());
449 that->d->mPixmaps[pos] = mt.pixmap(); 449 that->d->mPixmaps[pos] = mt.pixmap();
450 if ( that->d->mPixmaps[pos].isNull() ) 450 if ( that->d->mPixmaps[pos].isNull() )
451 that->d->mPixmaps[pos].convertFromImage( 451 that->d->mPixmaps[pos].convertFromImage(
452 Resource::loadImage("UnknownDocument") 452 Resource::loadImage("UnknownDocument")
453 .smoothScale( size, size ) ); 453 .smoothScale( size, size ) );
454 return that->d->mPixmaps[pos]; 454 return that->d->mPixmaps[pos];
455 } 455 }
456 QImage unscaledIcon = Resource::loadImage( that->mIconFile ); 456 QImage unscaledIcon = Resource::loadImage( that->mIconFile );
457 if ( unscaledIcon.isNull() ) { 457 if ( unscaledIcon.isNull() ) {
458 qDebug( "Cannot find icon: %s", that->mIconFile.latin1() ); 458 qDebug( "Cannot find icon: %s", that->mIconFile.latin1() );
459 that->d->mPixmaps[pos].convertFromImage( 459 that->d->mPixmaps[pos].convertFromImage(
460 Resource::loadImage("UnknownDocument") 460 Resource::loadImage("UnknownDocument")
461 .smoothScale( size, size ) ); 461 .smoothScale( size, size ) );
462 } else { 462 } else {
463 that->d->mPixmaps[0].convertFromImage( unscaledIcon.smoothScale( smallSize, smallSize ) ); 463 that->d->mPixmaps[0].convertFromImage( unscaledIcon.smoothScale( smallSize, smallSize ) );
464 that->d->mPixmaps[1].convertFromImage( unscaledIcon.smoothScale( bigSize, bigSize ) ); 464 that->d->mPixmaps[1].convertFromImage( unscaledIcon.smoothScale( bigSize, bigSize ) );
465 } 465 }
466 return that->d->mPixmaps[pos]; 466 return that->d->mPixmaps[pos];
467 } 467 }
468 return d->mPixmaps[pos]; 468 return d->mPixmaps[pos];
469} 469}
470 470
471/*! 471/*!
472 Returns a small pixmap associated with the application. 472 Returns a small pixmap associated with the application.
473 473
474 \sa bigPixmap() setIcon() 474 \sa bigPixmap() setIcon()
475*/ 475*/
476const QPixmap& AppLnk::pixmap() const 476const QPixmap& AppLnk::pixmap() const
477{ 477{
478 if ( d->mPixmaps[0].isNull() ) { 478 if ( d->mPixmaps[0].isNull() ) {
479 return pixmap(AppLnkPrivate::Normal, smallSize ); 479 return pixmap(AppLnkPrivate::Normal, smallSize );
480 } 480 }
481 return d->mPixmaps[0]; 481 return d->mPixmaps[0];
482} 482}
483 483
484/*! 484/*!
485 Returns a large pixmap associated with the application. 485 Returns a large pixmap associated with the application.
486 486
487 \sa pixmap() setIcon() 487 \sa pixmap() setIcon()
488*/ 488*/
489const QPixmap& AppLnk::bigPixmap() const 489const QPixmap& AppLnk::bigPixmap() const
490{ 490{
491 if ( d->mPixmaps[1].isNull() ) { 491 if ( d->mPixmaps[1].isNull() ) {
492 return pixmap( AppLnkPrivate::Big, bigSize ); 492 return pixmap( AppLnkPrivate::Big, bigSize );
493 } 493 }
494 return mBigPixmap; 494 return d->mPixmaps[1];
495} 495}
496 496
497/*! 497/*!
498 Returns the type of the AppLnk. For applications, games and 498 Returns the type of the AppLnk. For applications, games and
499 settings the type is \c Application; for documents the type is the 499 settings the type is \c Application; for documents the type is the
500 document's MIME type. 500 document's MIME type.
501*/ 501*/
502QString AppLnk::type() const 502QString AppLnk::type() const
503{ 503{
504 if ( mType.isNull() ) { 504 if ( mType.isNull() ) {
505 AppLnk* that = (AppLnk*)this; 505 AppLnk* that = (AppLnk*)this;
506 QString f = file(); 506 QString f = file();
507 if ( !f.isNull() ) { 507 if ( !f.isNull() ) {
508 MimeType mt(f); 508 MimeType mt(f);
509 that->mType = mt.id(); 509 that->mType = mt.id();
510 return that->mType; 510 return that->mType;
511 } 511 }
512 } 512 }
513 return mType; 513 return mType;
514} 514}
515 515
516/*! 516/*!
517 Returns the file associated with the AppLnk. 517 Returns the file associated with the AppLnk.
518 518
519 \sa exec() name() 519 \sa exec() name()
520*/ 520*/
521QString AppLnk::file() const 521QString AppLnk::file() const
522{ 522{
523 if ( mFile.isNull() ) { 523 if ( mFile.isNull() ) {
524 AppLnk* that = (AppLnk*)this; 524 AppLnk* that = (AppLnk*)this;
525 QString ext = MimeType(mType).extension(); 525 QString ext = MimeType(mType).extension();
526 if ( !ext.isEmpty() ) 526 if ( !ext.isEmpty() )
527 ext = "." + ext; 527 ext = "." + ext;
528 if ( !mLinkFile.isEmpty() ) { 528 if ( !mLinkFile.isEmpty() ) {
529 that->mFile = 529 that->mFile =
530 mLinkFile.right(8)==".desktop" // 8 = strlen(".desktop") 530 mLinkFile.right(8)==".desktop" // 8 = strlen(".desktop")
531 ? mLinkFile.left(mLinkFile.length()-8) : mLinkFile; 531 ? mLinkFile.left(mLinkFile.length()-8) : mLinkFile;
532 } else if ( mType.contains('/') ) { 532 } else if ( mType.contains('/') ) {
533 that->mFile = 533 that->mFile =
534 QString(getenv("HOME"))+"/Documents/"+mType+"/"+safeFileName(that->mName); 534 QString(getenv("HOME"))+"/Documents/"+mType+"/"+safeFileName(that->mName);
535 /* 535 /*
536 * A file with the same name or a .desktop file already exists 536 * A file with the same name or a .desktop file already exists
537 */ 537 */
538 if ( QFile::exists(that->mFile+ext) || QFile::exists(that->mFile+".desktop") ) { 538 if ( QFile::exists(that->mFile+ext) || QFile::exists(that->mFile+".desktop") ) {
539 int n=1; 539 int n=1;
540 QString nn; 540 QString nn;
541 while (QFile::exists((nn=(that->mFile+"_"+QString::number(n)))+ext) 541 while (QFile::exists((nn=(that->mFile+"_"+QString::number(n)))+ext)
542 || QFile::exists(nn+".desktop")) 542 || QFile::exists(nn+".desktop"))
543 n++; 543 n++;
544 that->mFile = nn; 544 that->mFile = nn;
545 } 545 }
546 that->mLinkFile = that->mFile+".desktop"; 546 that->mLinkFile = that->mFile+".desktop";
547 that->mFile += ext; 547 that->mFile += ext;
548 } 548 }
549 prepareDirectories(that->mFile); 549 prepareDirectories(that->mFile);
550 if ( !that->mFile.isEmpty() ) { 550 if ( !that->mFile.isEmpty() ) {
551 QFile f(that->mFile); 551 QFile f(that->mFile);
552 if ( !f.open(IO_WriteOnly) ) 552 if ( !f.open(IO_WriteOnly) )
553 that->mFile = QString::null; 553 that->mFile = QString::null;
554 return that->mFile; 554 return that->mFile;
555 } 555 }
556 } 556 }
557 return mFile; 557 return mFile;
558} 558}
559 559
560/*! 560/*!
561 Returns the desktop file corresponding to this AppLnk. 561 Returns the desktop file corresponding to this AppLnk.
562 562
563 \sa file() exec() name() 563 \sa file() exec() name()
564*/ 564*/
565QString AppLnk::linkFile() const 565QString AppLnk::linkFile() const
566{ 566{
567 if ( mLinkFile.isNull() ) { 567 if ( mLinkFile.isNull() ) {
568 AppLnk* that = (AppLnk*)this; 568 AppLnk* that = (AppLnk*)this;
569 if ( type().contains('/') ) { 569 if ( type().contains('/') ) {
570 StorageInfo storage; 570 StorageInfo storage;
571 const FileSystem *fs = storage.fileSystemOf( that->mFile ); 571 const FileSystem *fs = storage.fileSystemOf( that->mFile );
572 /* tmpfs + and ramfs are available too but not removable 572 /* tmpfs + and ramfs are available too but not removable
573 * either we fix storage or add this 573 * either we fix storage or add this
574 */ 574 */
575 if ( fs && ( fs->isRemovable() || fs->disk() == "/dev/mtdblock6" || fs->disk() == "tmpfs") ) { 575 if ( fs && ( fs->isRemovable() || fs->disk() == "/dev/mtdblock6" || fs->disk() == "tmpfs") ) {
576 that->mLinkFile = fs->path(); 576 that->mLinkFile = fs->path();
577 } else 577 } else
578 that->mLinkFile = getenv( "HOME" ); 578 that->mLinkFile = getenv( "HOME" );
579 that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName); 579 that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName);
580 580
581 /* the desktop file exists make sure we don't point to the same file */ 581 /* the desktop file exists make sure we don't point to the same file */
582 if ( QFile::exists(that->mLinkFile+".desktop") ) { 582 if ( QFile::exists(that->mLinkFile+".desktop") ) {
583 AppLnk lnk( that->mLinkFile + ".desktop" ); 583 AppLnk lnk( that->mLinkFile + ".desktop" );
584 584
585 /* the linked is different */ 585 /* the linked is different */
586 if(that->file() != lnk.file() ) { 586 if(that->file() != lnk.file() ) {
587 int n = 1; 587 int n = 1;
588 QString nn; 588 QString nn;
589 while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")) { 589 while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")) {
590 n++; 590 n++;
591 /* just to be sure */ 591 /* just to be sure */
592 AppLnk lnk(nn ); 592 AppLnk lnk(nn );
593 if (lnk.file() == that->file() ) 593 if (lnk.file() == that->file() )
594 break; 594 break;
595 } 595 }
596 that->mLinkFile = nn; 596 that->mLinkFile = nn;
597 } 597 }
598 } 598 }
599 that->mLinkFile += ".desktop"; 599 that->mLinkFile += ".desktop";
600 storeLink(); 600 storeLink();
601 } 601 }
602 return that->mLinkFile; 602 return that->mLinkFile;
603 } 603 }
604 return mLinkFile; 604 return mLinkFile;
605} 605}
606 606
607/*! 607/*!
608 Copies \a copy. 608 Copies \a copy.
609*/ 609*/
610AppLnk::AppLnk( const AppLnk &copy ) 610AppLnk::AppLnk( const AppLnk &copy )
611{ 611{
612 mName = copy.mName; 612 mName = copy.mName;
613 mPixmap = copy.mPixmap; 613 mPixmap = copy.mPixmap;
614 mBigPixmap = copy.mBigPixmap; 614 mBigPixmap = copy.mBigPixmap;
615 mExec = copy.mExec; 615 mExec = copy.mExec;
616 mType = copy.mType; 616 mType = copy.mType;
617 mRotation = copy.mRotation; 617 mRotation = copy.mRotation;
618 mComment = copy.mComment; 618 mComment = copy.mComment;
619 mFile = copy.mFile; 619 mFile = copy.mFile;
620 mLinkFile = copy.mLinkFile; 620 mLinkFile = copy.mLinkFile;
621 mIconFile = copy.mIconFile; 621 mIconFile = copy.mIconFile;
622 mMimeTypes = copy.mMimeTypes; 622 mMimeTypes = copy.mMimeTypes;
623 mMimeTypeIcons = copy.mMimeTypeIcons; 623 mMimeTypeIcons = copy.mMimeTypeIcons;
624 mId = 0; 624 mId = 0;
625 d = new AppLnkPrivate(); 625 d = new AppLnkPrivate();
626 d->mCat = copy.d->mCat; 626 d->mCat = copy.d->mCat;
627 d->mCatList = copy.d->mCatList; 627 d->mCatList = copy.d->mCatList;
628 d->mPixmaps = copy.d->mPixmaps; 628 d->mPixmaps = copy.d->mPixmaps;
629} 629}
630 630
631/*! 631/*!
632 Destroys the AppLnk. Note that if the AppLnk is currently a member 632 Destroys the AppLnk. Note that if the AppLnk is currently a member
633 of an AppLnkSet, this will produce a run-time warning. 633 of an AppLnkSet, this will produce a run-time warning.
634 634
635 \sa AppLnkSet::add() AppLnkSet::remove() 635 \sa AppLnkSet::add() AppLnkSet::remove()
636*/ 636*/
637AppLnk::~AppLnk() 637AppLnk::~AppLnk()
638{ 638{
639 if ( mId ) 639 if ( mId )
640 qWarning("Deleting AppLnk that is in an AppLnkSet"); 640 qWarning("Deleting AppLnk that is in an AppLnkSet");
641 if ( d ) 641 if ( d )
642 delete d; 642 delete d;
643} 643}
644 644
645/*! 645/*!
646 \overload 646 \overload
647 Executes the application associated with this AppLnk. 647 Executes the application associated with this AppLnk.
648 648
649 \sa exec() 649 \sa exec()
650*/ 650*/
651void AppLnk::execute() const 651void AppLnk::execute() const
652{ 652{
653 execute(QStringList()); 653 execute(QStringList());
654} 654}
655 655
656/*! 656/*!
657 Executes the application associated with this AppLnk, with 657 Executes the application associated with this AppLnk, with
658 \a args as arguments. 658 \a args as arguments.
659 659
660 \sa exec() 660 \sa exec()
661*/ 661*/
662void AppLnk::execute(const QStringList& args) const 662void AppLnk::execute(const QStringList& args) const
663{ 663{
664#ifdef Q_WS_QWS 664#ifdef Q_WS_QWS
665 if ( !mRotation.isEmpty() ) { 665 if ( !mRotation.isEmpty() ) {
666 // ######## this will only work in the server 666 // ######## this will only work in the server
667 int rot = QPEApplication::defaultRotation(); 667 int rot = QPEApplication::defaultRotation();
668 rot = (rot+mRotation.toInt())%360; 668 rot = (rot+mRotation.toInt())%360;
669 QCString old = getenv("QWS_DISPLAY"); 669 QCString old = getenv("QWS_DISPLAY");
670 setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); 670 setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1);
671 invoke(args); 671 invoke(args);
672 setenv("QWS_DISPLAY", old.data(), 1); 672 setenv("QWS_DISPLAY", old.data(), 1);
673 } else 673 } else
674#endif 674#endif
675 invoke(args); 675 invoke(args);
676} 676}
677 677
678/*! 678/*!
679 Invokes the application associated with this AppLnk, with 679 Invokes the application associated with this AppLnk, with
680 \a args as arguments. Rotation is not taken into account by 680 \a args as arguments. Rotation is not taken into account by
681 this function, so you should not call it directly. 681 this function, so you should not call it directly.
682 682
683 \sa execute() 683 \sa execute()
684*/ 684*/
685void AppLnk::invoke(const QStringList& args) const 685void AppLnk::invoke(const QStringList& args) const
686{ 686{
687 Global::execute( exec(), args[0] ); 687 Global::execute( exec(), args[0] );
688} 688}
689 689
690/*! 690/*!
691 Sets the Exec property to \a exec. 691 Sets the Exec property to \a exec.
692 692
693 \sa exec() name() 693 \sa exec() name()
694*/ 694*/
695void AppLnk::setExec( const QString& exec ) 695void AppLnk::setExec( const QString& exec )
696{ 696{
697 mExec = exec; 697 mExec = exec;
698} 698}
699 699
700/*! 700/*!
701 Sets the Name property to \a docname. 701 Sets the Name property to \a docname.
702 702
703 \sa name() 703 \sa name()
704*/ 704*/
705void AppLnk::setName( const QString& docname ) 705void AppLnk::setName( const QString& docname )
706{ 706{
707 mName = docname; 707 mName = docname;
708} 708}
709 709
710/*! 710/*!
711 Sets the File property to \a filename. 711 Sets the File property to \a filename.
712 712
713 \sa file() name() 713 \sa file() name()
714*/ 714*/
715void AppLnk::setFile( const QString& filename ) 715void AppLnk::setFile( const QString& filename )
716{ 716{
717 mFile = filename; 717 mFile = filename;
718} 718}
719 719
720/*! 720/*!
721 Sets the LinkFile property to \a filename. 721 Sets the LinkFile property to \a filename.
722 722
723 \sa linkFile() 723 \sa linkFile()
724*/ 724*/
725void AppLnk::setLinkFile( const QString& filename ) 725void AppLnk::setLinkFile( const QString& filename )
726{ 726{
727 mLinkFile = filename; 727 mLinkFile = filename;
728} 728}
729 729
730/*! 730/*!
731 Sets the Comment property to \a comment. 731 Sets the Comment property to \a comment.
732 732
733 This text is displayed in the 'Details Dialog', for example if the 733 This text is displayed in the 'Details Dialog', for example if the
734 user uses the 'press-and-hold' gesture. 734 user uses the 'press-and-hold' gesture.
735 735
736 \sa comment() 736 \sa comment()
737*/ 737*/
738void AppLnk::setComment( const QString& comment ) 738void AppLnk::setComment( const QString& comment )
739{ 739{
740 mComment = comment; 740 mComment = comment;
741} 741}
742 742
743/*! 743/*!
744 Sets the Type property to \a type. 744 Sets the Type property to \a type.
745 745
746 For applications, games and settings the type should be \c 746 For applications, games and settings the type should be \c
747 Application; for documents the type should be the document's MIME 747 Application; for documents the type should be the document's MIME
748 type. 748 type.
749 749
750 \sa type() 750 \sa type()