summaryrefslogtreecommitdiff
path: root/library/global.cpp
authorzecke <zecke>2002-05-16 15:56:24 (UTC)
committer zecke <zecke>2002-05-16 15:56:24 (UTC)
commitb94bd6003bf7c2024b0f254805f54ff4e52ead6e (patch) (unidiff)
tree8e137366438872bbd2ca03256678c9a2d10d7517 /library/global.cpp
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 (limited to 'library/global.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/global.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/library/global.cpp b/library/global.cpp
index 4f1cc38..edb7b85 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -627,64 +627,78 @@ QString Global::shellQuote(const QString& s)
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;