summaryrefslogtreecommitdiff
authorzecke <zecke>2002-05-16 15:56:24 (UTC)
committer zecke <zecke>2002-05-16 15:56:24 (UTC)
commitb94bd6003bf7c2024b0f254805f54ff4e52ead6e (patch) (unidiff)
tree8e137366438872bbd2ca03256678c9a2d10d7517
parent0292492b1c9570a896ac4b9acfe168724e8439f9 (diff)
downloadopie-b94bd6003bf7c2024b0f254805f54ff4e52ead6e.zip
opie-b94bd6003bf7c2024b0f254805f54ff4e52ead6e.tar.gz
opie-b94bd6003bf7c2024b0f254805f54ff4e52ead6e.tar.bz2
Some ole docu and search for jpgs too in Resource PNG, JPG, XPM
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/global.cpp14
-rw-r--r--library/resource.cpp8
2 files changed, 20 insertions, 2 deletions
diff --git a/library/global.cpp b/library/global.cpp
index 4f1cc38..edb7b85 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -467,246 +467,260 @@ void Global::terminate( const AppLnk* app )
467 467
468 QCString channel = "QPE/Application/" + app->exec().utf8(); 468 QCString channel = "QPE/Application/" + app->exec().utf8();
469 if ( QCopChannel::isRegistered(channel) ) { 469 if ( QCopChannel::isRegistered(channel) ) {
470 QCopEnvelope e(channel, "quit()"); 470 QCopEnvelope e(channel, "quit()");
471 } 471 }
472} 472}
473 473
474/*! 474/*!
475 Low-level function to run command \a c. Not recommended. 475 Low-level function to run command \a c. Not recommended.
476*/ 476*/
477void Global::invoke(const QString &c) 477void Global::invoke(const QString &c)
478{ 478{
479 // Convert the command line in to a list of arguments 479 // Convert the command line in to a list of arguments
480 QStringList list = QStringList::split(QRegExp(" *"),c); 480 QStringList list = QStringList::split(QRegExp(" *"),c);
481 481
482#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 482#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
483 QString ap=list[0]; 483 QString ap=list[0];
484 // see if the application is already running 484 // see if the application is already running
485 // XXX should lock file /tmp/qcop-msg-ap 485 // XXX should lock file /tmp/qcop-msg-ap
486 if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) { 486 if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) {
487 QCopEnvelope e("QPE/System", "notBusy(QString)" ); 487 QCopEnvelope e("QPE/System", "notBusy(QString)" );
488 e << ap; 488 e << ap;
489 return; 489 return;
490 } 490 }
491 // XXX should unlock file /tmp/qcop-msg-ap 491 // XXX should unlock file /tmp/qcop-msg-ap
492 //see if it is being started 492 //see if it is being started
493 if ( StartingAppList::isStarting( ap ) ) { 493 if ( StartingAppList::isStarting( ap ) ) {
494 QCopEnvelope e("QPE/System", "notBusy(QString)" ); 494 QCopEnvelope e("QPE/System", "notBusy(QString)" );
495 e << ap; 495 e << ap;
496 return; 496 return;
497 } 497 }
498 498
499#endif 499#endif
500 500
501#ifdef QT_NO_QWS_MULTIPROCESS 501#ifdef QT_NO_QWS_MULTIPROCESS
502 QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 ); 502 QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 );
503#else 503#else
504 504
505 QStrList slist; 505 QStrList slist;
506 unsigned int j; 506 unsigned int j;
507 for ( j = 0; j < list.count(); j++ ) 507 for ( j = 0; j < list.count(); j++ )
508 slist.append( list[j].utf8() ); 508 slist.append( list[j].utf8() );
509 509
510 const char **args = new (const char *)[slist.count() + 1]; 510 const char **args = new (const char *)[slist.count() + 1];
511 for ( j = 0; j < slist.count(); j++ ) 511 for ( j = 0; j < slist.count(); j++ )
512 args[j] = slist.at(j); 512 args[j] = slist.at(j);
513 args[j] = NULL; 513 args[j] = NULL;
514 514
515#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 515#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
516 // an attempt to show a wait... 516 // an attempt to show a wait...
517 // more logic should be used, but this will be fine for the moment... 517 // more logic should be used, but this will be fine for the moment...
518 QCopEnvelope ( "QPE/System", "busy()" ); 518 QCopEnvelope ( "QPE/System", "busy()" );
519#endif 519#endif
520 520
521#ifdef HAVE_QUICKEXEC 521#ifdef HAVE_QUICKEXEC
522 QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; 522 QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so";
523 qDebug("libfile = %s", libexe.latin1() ); 523 qDebug("libfile = %s", libexe.latin1() );
524 if ( QFile::exists( libexe ) ) { 524 if ( QFile::exists( libexe ) ) {
525 qDebug("calling quickexec %s", libexe.latin1() ); 525 qDebug("calling quickexec %s", libexe.latin1() );
526 quickexecv( libexe.utf8().data(), (const char **)args ); 526 quickexecv( libexe.utf8().data(), (const char **)args );
527 } else 527 } else
528#endif 528#endif
529 { 529 {
530 if ( !::vfork() ) { 530 if ( !::vfork() ) {
531 for ( int fd = 3; fd < 100; fd++ ) 531 for ( int fd = 3; fd < 100; fd++ )
532 ::close( fd ); 532 ::close( fd );
533 ::setpgid( ::getpid(), ::getppid() ); 533 ::setpgid( ::getpid(), ::getppid() );
534 // Try bindir first, so that foo/bar works too 534 // Try bindir first, so that foo/bar works too
535 ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args ); 535 ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args );
536 ::execvp( args[0], (char * const *)args ); 536 ::execvp( args[0], (char * const *)args );
537 _exit( -1 ); 537 _exit( -1 );
538 } 538 }
539 } 539 }
540 StartingAppList::add( list[0] ); 540 StartingAppList::add( list[0] );
541#endif //QT_NO_QWS_MULTIPROCESS 541#endif //QT_NO_QWS_MULTIPROCESS
542} 542}
543 543
544/*! 544/*!
545 Executes application identfied by \a c, passing \a document. 545 Executes application identfied by \a c, passing \a document.
546 546
547 Note that you might be better off sending a QCop message to 547 Note that you might be better off sending a QCop message to
548 the application's QPE/Application/<i>appname</i> channel. 548 the application's QPE/Application/<i>appname</i> channel.
549*/ 549*/
550void Global::execute( const QString &c, const QString& document ) 550void Global::execute( const QString &c, const QString& document )
551{ 551{
552 if ( qApp->type() != QApplication::GuiServer ) { 552 if ( qApp->type() != QApplication::GuiServer ) {
553 // ask the server to do the work 553 // ask the server to do the work
554#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 554#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
555 if ( document.isNull() ) { 555 if ( document.isNull() ) {
556 QCopEnvelope e( "QPE/System", "execute(QString)" ); 556 QCopEnvelope e( "QPE/System", "execute(QString)" );
557 e << c; 557 e << c;
558 } else { 558 } else {
559 QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); 559 QCopEnvelope e( "QPE/System", "execute(QString,QString)" );
560 e << c << document; 560 e << c << document;
561 } 561 }
562#endif 562#endif
563 return; 563 return;
564 } 564 }
565 565
566 // Attempt to execute the app using a builtin class for the app first 566 // Attempt to execute the app using a builtin class for the app first
567 // else try and find it in the bin directory 567 // else try and find it in the bin directory
568 if (builtin) { 568 if (builtin) {
569 for (int i = 0; builtin[i].file; i++) { 569 for (int i = 0; builtin[i].file; i++) {
570 if ( builtin[i].file == c ) { 570 if ( builtin[i].file == c ) {
571 if ( running[i] ) { 571 if ( running[i] ) {
572 if ( !document.isNull() && builtin[i].documentary ) 572 if ( !document.isNull() && builtin[i].documentary )
573 setDocument(running[i], document); 573 setDocument(running[i], document);
574 running[i]->raise(); 574 running[i]->raise();
575 running[i]->show(); 575 running[i]->show();
576 running[i]->setActiveWindow(); 576 running[i]->setActiveWindow();
577 } else { 577 } else {
578 running[i] = builtin[i].func( builtin[i].maximized ); 578 running[i] = builtin[i].func( builtin[i].maximized );
579 } 579 }
580 QCopEnvelope e("QPE/System", "notBusy(QString)" ); 580 QCopEnvelope e("QPE/System", "notBusy(QString)" );
581 e << c; // that was quick ;-) 581 e << c; // that was quick ;-)
582 return; 582 return;
583 } 583 }
584 } 584 }
585 } 585 }
586 586
587 //Global::invoke(c, document); 587 //Global::invoke(c, document);
588 588
589 // Convert the command line in to a list of arguments 589 // Convert the command line in to a list of arguments
590 QStringList list = QStringList::split(QRegExp(" *"),c); 590 QStringList list = QStringList::split(QRegExp(" *"),c);
591 591
592#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 592#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
593 QString ap=list[0]; 593 QString ap=list[0];
594 594
595 qDebug("executing %s", ap.latin1() ); 595 qDebug("executing %s", ap.latin1() );
596 if ( ap == "suspend" ) { 596 if ( ap == "suspend" ) {
597 QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); 597 QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE );
598 return; 598 return;
599 } 599 }
600 600
601 /* if need be, sending a qcop message will result in an invoke, see 601 /* if need be, sending a qcop message will result in an invoke, see
602 preceeding function */ 602 preceeding function */
603 { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } 603 { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); }
604 if ( !document.isEmpty() ) { 604 if ( !document.isEmpty() ) {
605 QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "setDocument(QString)" ); 605 QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "setDocument(QString)" );
606 env << document; 606 env << document;
607 } 607 }
608#endif 608#endif
609} 609}
610 610
611/*! 611/*!
612 Returns the string \a s with the characters backslash, ", and $ 612 Returns the string \a s with the characters backslash, ", and $
613 quoted by a preceeding backslash. 613 quoted by a preceeding backslash.
614*/ 614*/
615QString Global::shellQuote(const QString& s) 615QString Global::shellQuote(const QString& s)
616{ 616{
617 QString r="\""; 617 QString r="\"";
618 for (int i=0; i<(int)s.length(); i++) { 618 for (int i=0; i<(int)s.length(); i++) {
619 char c = s[i].latin1(); 619 char c = s[i].latin1();
620 switch (c) { 620 switch (c) {
621 case '\\': case '"': case '$': 621 case '\\': case '"': case '$':
622 r+="\\"; 622 r+="\\";
623 } 623 }
624 r += s[i]; 624 r += s[i];
625 } 625 }
626 r += "\""; 626 r += "\"";
627 return r; 627 return r;
628} 628}
629 629
630/*! 630/*!
631 Returns the string \a s with the characters backslash and " 631 Returns the string \a s with the characters backslash and "
632 quoted by a preceeding backslash. 632 quoted by a preceeding backslash.
633*/ 633*/
634QString Global::stringQuote(const QString& s) 634QString Global::stringQuote(const QString& s)
635{ 635{
636 QString r="\""; 636 QString r="\"";
637 for (int i=0; i<(int)s.length(); i++) { 637 for (int i=0; i<(int)s.length(); i++) {
638 char c = s[i].latin1(); 638 char c = s[i].latin1();
639 switch (c) { 639 switch (c) {
640 case '\\': case '"': 640 case '\\': case '"':
641 r+="\\"; 641 r+="\\";
642 } 642 }
643 r += s[i]; 643 r += s[i];
644 } 644 }
645 r += "\""; 645 r += "\"";
646 return r; 646 return r;
647} 647}
648 648
649/*! 649/*!
650 Finds all documents on the system's document directories which 650 Finds all documents on the system's document directories which
651 match the filter \a mimefilter, and appends the resulting DocLnk 651 match the filter \a mimefilter, and appends the resulting DocLnk
652 objects to \a folder. 652 objects to \a folder.
653*/ 653*/
654void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) 654void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter)
655{ 655{
656 QString homedocs = QString(getenv("HOME")) + "/Documents"; 656 QString homedocs = QString(getenv("HOME")) + "/Documents";
657 DocLnkSet d(homedocs,mimefilter); 657 DocLnkSet d(homedocs,mimefilter);
658 folder->appendFrom(d); 658 folder->appendFrom(d);
659 /** let's do intellegint way of searching these files
660 * a) the user don't want to check mediums global
661 * b) the user wants to check but use the global options for it
662 * c) the user wants to check it but not this medium
663 * d) the user wants to check and this medium as well
664 *
665 * In all cases we need to apply a different mimefilter to
666 * the medium.
667 * a) mimefilter.isEmpty() we need to apply the responding filter
668 * either the global or the one on the medium
669 *
670 * b) mimefilter is set to an application we need to find out if the
671 * mimetypes are included in the mime mask of the medium
672 */
659 StorageInfo storage; 673 StorageInfo storage;
660 const QList<FileSystem> &fs = storage.fileSystems(); 674 const QList<FileSystem> &fs = storage.fileSystems();
661 QListIterator<FileSystem> it ( fs ); 675 QListIterator<FileSystem> it ( fs );
662 for ( ; it.current(); ++it ) { 676 for ( ; it.current(); ++it ) {
663 if ( (*it)->isRemovable() ) { // let's find out if we should search on it 677 if ( (*it)->isRemovable() ) { // let's find out if we should search on it
664 // this is a candidate look at the cf and see if we should search on it 678 // this is a candidate look at the cf and see if we should search on it
665 QString path = (*it)->path(); 679 QString path = (*it)->path();
666 if( !checkStorage((*it)->path() + "/.opiestorage.cf" ) ) 680 if( !checkStorage((*it)->path() + "/.opiestorage.cf" ) )
667 continue; 681 continue;
668 DocLnkSet ide( path, mimefilter ); 682 DocLnkSet ide( path, mimefilter );
669 folder->appendFrom(ide); 683 folder->appendFrom(ide);
670 } 684 }
671 } 685 }
672} 686}
673 687
674QStringList Global::languageList() 688QStringList Global::languageList()
675{ 689{
676 QString lang = getenv("LANG"); 690 QString lang = getenv("LANG");
677 QStringList langs; 691 QStringList langs;
678 langs.append(lang); 692 langs.append(lang);
679 int i = lang.find("."); 693 int i = lang.find(".");
680 if ( i > 0 ) 694 if ( i > 0 )
681 lang = lang.left( i ); 695 lang = lang.left( i );
682 i = lang.find( "_" ); 696 i = lang.find( "_" );
683 if ( i > 0 ) 697 if ( i > 0 )
684 langs.append(lang.left(i)); 698 langs.append(lang.left(i));
685 return langs; 699 return langs;
686} 700}
687 701
688QStringList Global::helpPath() 702QStringList Global::helpPath()
689{ 703{
690 QStringList path; 704 QStringList path;
691 QStringList langs = Global::languageList(); 705 QStringList langs = Global::languageList();
692 for (QStringList::ConstIterator it = langs.fromLast(); it!=langs.end(); --it) { 706 for (QStringList::ConstIterator it = langs.fromLast(); it!=langs.end(); --it) {
693 QString lang = *it; 707 QString lang = *it;
694 if ( !lang.isEmpty() ) 708 if ( !lang.isEmpty() )
695 path += QPEApplication::qpeDir() + "/help/" + lang + "/html"; 709 path += QPEApplication::qpeDir() + "/help/" + lang + "/html";
696 } 710 }
697 path += QPEApplication::qpeDir() + "/pics"; 711 path += QPEApplication::qpeDir() + "/pics";
698 path += QPEApplication::qpeDir() + "/help/en/html"; 712 path += QPEApplication::qpeDir() + "/help/en/html";
699 path += QPEApplication::qpeDir() + "/docs"; 713 path += QPEApplication::qpeDir() + "/docs";
700 QString dir = QDir::current().canonicalPath(); 714 QString dir = QDir::current().canonicalPath();
701 if ( dir == "/" ) 715 if ( dir == "/" )
702 dir += "/docs"; 716 dir += "/docs";
703 else { 717 else {
704 path += dir + "/../pics"; 718 path += dir + "/../pics";
705 dir += "/../docs"; 719 dir += "/../docs";
706 path += dir; 720 path += dir;
707 } 721 }
708 return path; 722 return path;
709} 723}
710 724
711 725
712#include "global.moc" 726#include "global.moc"
diff --git a/library/resource.cpp b/library/resource.cpp
index dc19880..0915c45 100644
--- a/library/resource.cpp
+++ b/library/resource.cpp
@@ -1,136 +1,140 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "qpeapplication.h" 21#include "qpeapplication.h"
22#include "resource.h" 22#include "resource.h"
23#include <qdir.h> 23#include <qdir.h>
24#include <qfile.h> 24#include <qfile.h>
25#include <qregexp.h> 25#include <qregexp.h>
26#include <qpixmapcache.h> 26#include <qpixmapcache.h>
27#include <qpainter.h> 27#include <qpainter.h>
28 28
29#include "inlinepics_p.h" 29#include "inlinepics_p.h"
30 30
31/*! 31/*!
32 \class Resource resource.h 32 \class Resource resource.h
33 \brief The Resource class provides access to named resources. 33 \brief The Resource class provides access to named resources.
34 34
35 The resources may be provided from files or other sources. 35 The resources may be provided from files or other sources.
36*/ 36*/
37 37
38/*! 38/*!
39 \fn Resource::Resource() 39 \fn Resource::Resource()
40 \internal 40 \internal
41*/ 41*/
42 42
43/*! 43/*!
44 Returns the QPixmap named \a pix. You should avoid including 44 Returns the QPixmap named \a pix. You should avoid including
45 any filename type extension (eg. .png, .xpm). 45 any filename type extension (eg. .png, .xpm).
46*/ 46*/
47QPixmap Resource::loadPixmap( const QString &pix ) 47QPixmap Resource::loadPixmap( const QString &pix )
48{ 48{
49 QPixmap pm; 49 QPixmap pm;
50 QString key="QPE_"+pix; 50 QString key="QPE_"+pix;
51 if ( !QPixmapCache::find(key,pm) ) { 51 if ( !QPixmapCache::find(key,pm) ) {
52 pm.convertFromImage(loadImage(pix)); 52 pm.convertFromImage(loadImage(pix));
53 QPixmapCache::insert(key,pm); 53 QPixmapCache::insert(key,pm);
54 } 54 }
55 return pm; 55 return pm;
56} 56}
57 57
58/*! 58/*!
59 Returns the QBitmap named \a pix. You should avoid including 59 Returns the QBitmap named \a pix. You should avoid including
60 any filename type extension (eg. .png, .xpm). 60 any filename type extension (eg. .png, .xpm).
61*/ 61*/
62QBitmap Resource::loadBitmap( const QString &pix ) 62QBitmap Resource::loadBitmap( const QString &pix )
63{ 63{
64 QBitmap bm; 64 QBitmap bm;
65 bm = loadPixmap(pix); 65 bm = loadPixmap(pix);
66 return bm; 66 return bm;
67} 67}
68 68
69/*! 69/*!
70 Returns the filename of a pixmap named \a pix. You should avoid including 70 Returns the filename of a pixmap named \a pix. You should avoid including
71 any filename type extension (eg. .png, .xpm). 71 any filename type extension (eg. .png, .xpm .jpg .jpeg).
72 72
73 Normally you will use loadPixmap() rather than this function. 73 Normally you will use loadPixmap() rather than this function.
74*/ 74*/
75QString Resource::findPixmap( const QString &pix ) 75QString Resource::findPixmap( const QString &pix )
76{ 76{
77 QString picsPath = QPEApplication::qpeDir() + "pics/"; 77 QString picsPath = QPEApplication::qpeDir() + "pics/";
78 78
79 if ( QFile( picsPath + pix + ".png").exists() ) 79 if ( QFile( picsPath + pix + ".png").exists() )
80 return picsPath + pix + ".png"; 80 return picsPath + pix + ".png";
81 else if ( QFile( picsPath + pix + ".jpeg").exists() )
82 return picsPath + pix + ".jpeg";
83 else if ( QFile( picsPath + pix + ".jpg").exists() )
84 return picsPath + pix + ".jpg";
81 else if ( QFile( picsPath + pix + ".xpm").exists() ) 85 else if ( QFile( picsPath + pix + ".xpm").exists() )
82 return picsPath + pix + ".xpm"; 86 return picsPath + pix + ".xpm";
83 else if ( QFile( picsPath + pix ).exists() ) 87 else if ( QFile( picsPath + pix ).exists() )
84 return picsPath + pix; 88 return picsPath + pix;
85 89
86 //qDebug("Cannot find pixmap: %s", pix.latin1()); 90 //qDebug("Cannot find pixmap: %s", pix.latin1());
87 return QString(); 91 return QString();
88} 92}
89 93
90/*! 94/*!
91 Returns a sound file for a sound named \a name. 95 Returns a sound file for a sound named \a name.
92 You should avoid including any filename type extension (eg. .wav, .au, .mp3). 96 You should avoid including any filename type extension (eg. .wav, .au, .mp3).
93*/ 97*/
94QString Resource::findSound( const QString &name ) 98QString Resource::findSound( const QString &name )
95{ 99{
96 QString picsPath = QPEApplication::qpeDir() + "sounds/"; 100 QString picsPath = QPEApplication::qpeDir() + "sounds/";
97 101
98 QString result; 102 QString result;
99 if ( QFile( (result = picsPath + name + ".wav") ).exists() ) 103 if ( QFile( (result = picsPath + name + ".wav") ).exists() )
100 return result; 104 return result;
101 105
102 return QString(); 106 return QString();
103} 107}
104 108
105/*! 109/*!
106 Returns a list of all sound names. 110 Returns a list of all sound names.
107*/ 111*/
108QStringList Resource::allSounds() 112QStringList Resource::allSounds()
109{ 113{
110 QDir resourcedir( QPEApplication::qpeDir() + "sounds/", "*.wav" ); 114 QDir resourcedir( QPEApplication::qpeDir() + "sounds/", "*.wav" );
111 QStringList entries = resourcedir.entryList(); 115 QStringList entries = resourcedir.entryList();
112 QStringList result; 116 QStringList result;
113 for (QStringList::Iterator i=entries.begin(); i != entries.end(); ++i) 117 for (QStringList::Iterator i=entries.begin(); i != entries.end(); ++i)
114 result.append((*i).replace(QRegExp("\\.wav"),"")); 118 result.append((*i).replace(QRegExp("\\.wav"),""));
115 return result; 119 return result;
116} 120}
117 121
118/*! 122/*!
119 Returns the QImage named \a name. You should avoid including 123 Returns the QImage named \a name. You should avoid including
120 any filename type extension (eg. .png, .xpm). 124 any filename type extension (eg. .png, .xpm .jpg).
121*/ 125*/
122QImage Resource::loadImage( const QString &name) 126QImage Resource::loadImage( const QString &name)
123{ 127{
124 QImage img = qembed_findImage(name.latin1()); 128 QImage img = qembed_findImage(name.latin1());
125 if ( img.isNull() ) 129 if ( img.isNull() )
126 return QImage(findPixmap(name)); 130 return QImage(findPixmap(name));
127 return img; 131 return img;
128} 132}
129 133
130/*! 134/*!
131 \fn QIconSet Resource::loadIconSet( const QString &name ) 135 \fn QIconSet Resource::loadIconSet( const QString &name )
132 136
133 Returns a QIconSet for the pixmap named \a name. A disabled icon is 137 Returns a QIconSet for the pixmap named \a name. A disabled icon is
134 generated that conforms to the Qtopia look & feel. You should avoid 138 generated that conforms to the Qtopia look & feel. You should avoid
135 including any filename type extension (eg. .png, .xpm). 139 including any filename type extension (eg. .png, .xpm).
136*/ 140*/