author | kergoth <kergoth> | 2002-06-07 18:53:14 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-06-07 18:53:14 (UTC) |
commit | 640d964cfdc7467f6cacb513087cd3acda2c04f0 (patch) (side-by-side diff) | |
tree | 9a784686c1795f8b1f81eb344598f3b549d43467 /library | |
parent | dfb9c76738bb68e235114c5ad43dbd26a59b98ab (diff) | |
download | opie-640d964cfdc7467f6cacb513087cd3acda2c04f0.zip opie-640d964cfdc7467f6cacb513087cd3acda2c04f0.tar.gz opie-640d964cfdc7467f6cacb513087cd3acda2c04f0.tar.bz2 |
Backing out unintentional merge from TT branch.
-rw-r--r-- | library/alarmserver.h | 3 | ||||
-rw-r--r-- | library/applnk.h | 3 | ||||
-rw-r--r-- | library/backend/categories.cpp | 146 | ||||
-rw-r--r-- | library/backend/categories.h | 12 | ||||
-rw-r--r-- | library/backend/contact.cpp | 107 | ||||
-rw-r--r-- | library/backend/contact.h | 7 | ||||
-rw-r--r-- | library/backend/event.h | 5 | ||||
-rw-r--r-- | library/backend/recordfields.h | 46 | ||||
-rw-r--r-- | library/backend/task.h | 4 | ||||
-rw-r--r-- | library/backend/vobject.cpp | 9 | ||||
-rw-r--r-- | library/backend/vobject_p.h | 3 | ||||
-rw-r--r-- | library/categoryedit_p.cpp | 6 | ||||
-rw-r--r-- | library/categoryselect.cpp | 185 | ||||
-rw-r--r-- | library/categoryselect.h | 26 | ||||
-rw-r--r-- | library/config.cpp | 13 | ||||
-rw-r--r-- | library/custom-linux-sharp-g++.h | 147 | ||||
-rw-r--r-- | library/datebookmonth.h | 1 | ||||
-rw-r--r-- | library/fileselector.h | 32 | ||||
-rw-r--r-- | library/finddialog.cpp | 4 | ||||
-rw-r--r-- | library/finddialog.h | 11 | ||||
-rw-r--r-- | library/mimetype.cpp | 19 | ||||
-rw-r--r-- | library/mimetype.h | 5 | ||||
-rw-r--r-- | library/network.cpp | 19 | ||||
-rw-r--r-- | library/power.cpp | 2 | ||||
-rw-r--r-- | library/qcopmessage_qws.h | 99 | ||||
-rw-r--r-- | library/qpedecoration_qws.cpp | 9 |
26 files changed, 432 insertions, 491 deletions
diff --git a/library/alarmserver.h b/library/alarmserver.h index 665c3ae..f12a63d 100644 --- a/library/alarmserver.h +++ b/library/alarmserver.h @@ -30,2 +30,5 @@ public: static void deleteAlarm (QDateTime when, const QCString& channel, const QCString& msg, int data=0); + +private: + friend int initApplication(int, char **); static void initialize(); diff --git a/library/applnk.h b/library/applnk.h index c6f92a3..18e20b6 100644 --- a/library/applnk.h +++ b/library/applnk.h @@ -60,2 +60,4 @@ public: + bool linkFileKnown() const { return !mLinkFile.isNull(); } + void execute() const; @@ -98,2 +100,3 @@ protected: bool ensureLinkExists() const; + void storeLink() const; }; diff --git a/library/backend/categories.cpp b/library/backend/categories.cpp index 91331db..6e011c4 100644 --- a/library/backend/categories.cpp +++ b/library/backend/categories.cpp @@ -173,32 +173,2 @@ QStringList CategoryGroup::labels(const QArray<int> &catids ) const -QArray<int> CategoryGroup::ids( const QStringList &cats ) const -{ - QArray<int> results; - - for ( QStringList::ConstIterator catIt = cats.begin(); - catIt != cats.end(); ++catIt ) { - if ( *catIt == QObject::tr("All") || *catIt == QObject::tr("Unfiled") ) - continue; - int value = id( *catIt ); - if ( value != 0 ) { - int tmp = results.size(); - results.resize( tmp + 1 ); - results[ tmp ] = value; - } - } - - return results; -} - -QArray<int> CategoryGroup::ids() const -{ - QArray<int> results( mIdLabelMap.count() ); - int i = 0; - for ( QMap<int, QString>::ConstIterator it = mIdLabelMap.begin(); - it != mIdLabelMap.end(); ++it ) - results[i++] = it.key(); - - return results; -} - /*********************************************************** @@ -345,2 +315,10 @@ QStringList Categories::labels( const QString &app, QStringList cats; + + if ( appIt != mAppCats.end() ) + cats += (*appIt).labels(); + else qDebug("Categories::labels didn't find app %s", app.latin1() ); + if ( includeGlobal ) + cats += mGlobalCats.labels(); + + cats.sort(); switch ( extra ) { @@ -358,10 +336,3 @@ QStringList Categories::labels( const QString &app, } - if ( appIt != mAppCats.end() ) - cats += (*appIt).labels(); - else qDebug("Categories::labels didn't find app %s", app.latin1() ); - if ( includeGlobal ) - cats += mGlobalCats.labels(); - // I don't think a sorted list is useful, the user might find prefer - // it in the original order. -// cats.sort(); + return cats; @@ -380,10 +351,2 @@ QString Categories::label( const QString &app, int id ) const -QStringList Categories::labels( const QString & app, - const QArray<int> &catids ) const -{ - QStringList strs = mGlobalCats.labels( catids ); - strs += mAppCats[app].labels( catids ); - return strs; -} - /** Returns a single string associated with the cat ids for display in @@ -419,29 +382,17 @@ QString Categories::displaySingle( const QString &app, -QArray<int> Categories::ids( const QString &app ) const -{ - QArray<int> allIds = mGlobalCats.ids(); - QArray<int> appIds = mAppCats[app].ids(); - - // we should make the guarentee that the ids are in the - // same order as the labels, (i.e. app cats then global) - // otherwise there is no point in having these two separate functions. - uint appSize = appIds.size(); - appIds.resize( appSize + allIds.size() ); - for ( uint i = appSize; i < appIds.size(); ++i ) - appIds[int(i)] = allIds[int(i - appSize)]; - - return appIds; -} - -QArray<int> Categories::ids( const QString &app, const QStringList &cats ) const +QArray<int> Categories::ids( const QString &app, const QStringList &labels) const { - QArray<int> allIds = mGlobalCats.ids( cats ); - QArray<int> appIds = mAppCats[app].ids( cats ); - - uint appSize = appIds.size(); - appIds.resize( appSize + allIds.size() ); - for ( uint i = appSize; i < appIds.size(); ++i ) - appIds[int(i)] = allIds[int(i - appSize)]; - - return appIds; + QArray<int> results; + QStringList::ConstIterator it; + int i; + + for ( i=0, it=labels.begin(); it!=labels.end(); i++, ++it ) { + int value = id( app, *it ); + if ( value != 0 ) { + int tmp = results.size(); + results.resize( tmp + 1 ); + results[ tmp ] = value; + } + } + return results; } @@ -541,6 +492,11 @@ bool Categories::exists( const QString &appname, + bool Categories::save( const QString &fname ) const { - QFile file( fname ); - if ( !file.open( IO_WriteOnly ) ) { + QString strNewFile = fname + ".new"; + QFile f( strNewFile ); + QString out; + int total_written; + + if ( !f.open( IO_WriteOnly|IO_Raw ) ) { qWarning("Unable to write to %s", fname.latin1()); @@ -549,11 +505,11 @@ bool Categories::save( const QString &fname ) const - QTextStream ts( &file ); - ts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; - ts << "<!DOCTYPE CategoryList>" << endl; + out = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; + out += "<!DOCTYPE CategoryList>\n"; + + out += "<Categories>\n"; - ts << "<Categories>" << endl; for ( QMap<int, QString>::ConstIterator git = mGlobalCats.idMap().begin(); git != mGlobalCats.idMap().end(); ++git ) - ts << "<Category id=\"" << git.key() << "\"" - << " name=\"" << escapeString(*git) << "\" />" << endl; + out += "<Category id=\"" + QString::number(git.key()) + "\"" + + " name=\"" + escapeString(*git) + "\" />\n"; @@ -565,9 +521,24 @@ bool Categories::save( const QString &fname ) const appcatit != appcats.end(); ++appcatit ) - ts << "<Category id=\"" << appcatit.key() << "\"" - << " app=\"" << escapeString(app) << "\"" - << " name=\"" << escapeString(*appcatit) << "\" />" << endl; + out += "<Category id=\"" + QString::number(appcatit.key()) + "\"" + + " app=\"" + escapeString(app) + "\"" + + " name=\"" + escapeString(*appcatit) + "\" />\n"; + } + out += "</Categories>\n"; + + QCString cstr = out.utf8(); + total_written = f.writeBlock( cstr.data(), cstr.length() ); + if ( total_written != int(cstr.length()) ) { + f.close(); + QFile::remove( strNewFile ); + return FALSE; + } + f.close(); + + if ( ::rename( strNewFile.latin1(), fname.latin1() ) < 0 ) { + qWarning( "problem renaming file %s to %s", + strNewFile.latin1(), fname.latin1()); + // remove the tmp file... + QFile::remove( strNewFile ); } - ts << "</Categories>" << endl; - file.close(); return TRUE; @@ -580,2 +551,7 @@ bool Categories::load( const QString &fname ) qWarning("Unable to open %s", fname.latin1()); + + addGlobalCategory(tr("Business")); + addGlobalCategory(tr("Personal")); + save(fname); + return FALSE; diff --git a/library/backend/categories.h b/library/backend/categories.h index 82d765b..ba65ee3 100644 --- a/library/backend/categories.h +++ b/library/backend/categories.h @@ -73,4 +73,3 @@ public: QStringList labels() const; - QArray<int> ids( const QStringList &cats ) const; - QArray<int> ids() const; + QStringList labels( const QArray<int> &catids ) const; @@ -132,5 +131,4 @@ public: - QArray<int> ids( const QString &app ) const; - QArray<int> ids( const QString &app, - const QStringList &cats ) const; + QArray<int> ids( const QString &app, const QStringList &labels) const; + /** Returns the id associated with the app */ @@ -155,6 +153,2 @@ public: - /** Returns the labels of the categories associated with the uids */ - QStringList labels( const QString & app, - const QArray<int> &catids ) const; - enum DisplaySingle { ShowMulti, ShowAll, ShowFirst }; diff --git a/library/backend/contact.cpp b/library/backend/contact.cpp index a5f10ab..b10b19a 100644 --- a/library/backend/contact.cpp +++ b/library/backend/contact.cpp @@ -20,5 +20,7 @@ +#define QTOPIA_INTERNAL_CONTACT_MRE + #include "contact.h" -#include "vobject_p.h"
-#include "qfiledirect_p.h"
+#include "vobject_p.h" +#include "qfiledirect_p.h" @@ -388,2 +390,9 @@ QStringList Contact::fields() + list.append( "JobTitle" ); + list.append( "Department" ); + list.append( "Company" ); + list.append( "BusinessPhone" ); + list.append( "BusinessFax" ); + list.append( "BusinessMobile" ); + list.append( "DefaultEmail" ); @@ -391,7 +400,2 @@ QStringList Contact::fields() - list.append( "HomeStreet" ); - list.append( "HomeCity" ); - list.append( "HomeState" ); - list.append( "HomeZip" ); - list.append( "HomeCountry" ); list.append( "HomePhone" ); @@ -399,5 +403,3 @@ QStringList Contact::fields() list.append( "HomeMobile" ); - list.append( "HomeWebPage" ); - list.append( "Company" ); list.append( "BusinessStreet" ); @@ -407,10 +409,6 @@ QStringList Contact::fields() list.append( "BusinessCountry" ); + list.append( "BusinessPager" ); list.append( "BusinessWebPage" ); - list.append( "JobTitle" ); - list.append( "Department" ); + list.append( "Office" ); - list.append( "BusinessPhone" ); - list.append( "BusinessFax" ); - list.append( "BusinessMobile" ); - list.append( "BusinessPager" ); list.append( "Profession" ); @@ -419,2 +417,9 @@ QStringList Contact::fields() + list.append( "HomeStreet" ); + list.append( "HomeCity" ); + list.append( "HomeState" ); + list.append( "HomeZip" ); + list.append( "HomeCountry" ); + list.append( "HomeWebPage" ); + list.append( "Spouse" ); @@ -424,5 +429,6 @@ QStringList Contact::fields() list.append( "Nickname" ); - list.append( "Children" ); + list.append( "Notes" ); + list.append( "Groups" ); @@ -442,2 +448,9 @@ QStringList Contact::trfields() + list.append( QObject::tr( "Job Title" ) ); + list.append( QObject::tr( "Department" ) ); + list.append( QObject::tr( "Company" ) ); + list.append( QObject::tr( "Business Phone" ) ); + list.append( QObject::tr( "Business Fax" ) ); + list.append( QObject::tr( "Business Mobile" ) ); + list.append( QObject::tr( "Default Email" ) ); @@ -445,7 +458,2 @@ QStringList Contact::trfields() - list.append( QObject::tr( "Home Street" ) ); - list.append( QObject::tr( "Home City" ) ); - list.append( QObject::tr( "Home State" ) ); - list.append( QObject::tr( "Home Zip" ) ); - list.append( QObject::tr( "Home Country" ) ); list.append( QObject::tr( "Home Phone" ) ); @@ -453,5 +461,3 @@ QStringList Contact::trfields() list.append( QObject::tr( "Home Mobile" ) ); - list.append( QObject::tr( "Home Web Page" ) ); - list.append( QObject::tr( "Company" ) ); list.append( QObject::tr( "Business Street" ) ); @@ -461,10 +467,6 @@ QStringList Contact::trfields() list.append( QObject::tr( "Business Country" ) ); + list.append( QObject::tr( "Business Pager" ) ); list.append( QObject::tr( "Business WebPage" ) ); - list.append( QObject::tr( "Job Title" ) ); - list.append( QObject::tr( "Department" ) ); + list.append( QObject::tr( "Office" ) ); - list.append( QObject::tr( "Business Phone" ) ); - list.append( QObject::tr( "Business Fax" ) ); - list.append( QObject::tr( "Business Mobile" ) ); - list.append( QObject::tr( "Business Pager" ) ); list.append( QObject::tr( "Profession" ) ); @@ -473,2 +475,9 @@ QStringList Contact::trfields() + list.append( QObject::tr( "Home Street" ) ); + list.append( QObject::tr( "Home City" ) ); + list.append( QObject::tr( "Home State" ) ); + list.append( QObject::tr( "Home Zip" ) ); + list.append( QObject::tr( "Home Country" ) ); + list.append( QObject::tr( "Home Web Page" ) ); + list.append( QObject::tr( "Spouse" ) ); @@ -478,5 +487,6 @@ QStringList Contact::trfields() list.append( QObject::tr( "Nickname" ) ); - list.append( QObject::tr( "Children" ) ); + list.append( QObject::tr( "Notes" ) ); + list.append( QObject::tr( "Groups" ) ); @@ -631,3 +641,3 @@ static Contact parseVObject( VObject *obj ) VObject *o = nextVObject( &nit ); - QCString name = vObjectName( o ); + QCString name = vObjectTypeInfo( o ); QString value = vObjectStringZValue( o ); @@ -704,3 +714,3 @@ static Contact parseVObject( VObject *obj ) VObject *o = nextVObject( &nit ); - QCString name = vObjectName( o ); + QCString name = vObjectTypeInfo( o ); if ( name == VCHomeProp ) @@ -751,3 +761,3 @@ static Contact parseVObject( VObject *obj ) VObject *o = nextVObject( &nit ); - QCString name = vObjectName( o ); + QCString name = vObjectTypeInfo( o ); if ( name != VCInternetProp && name != VCHomeProp && @@ -774,3 +784,3 @@ static Contact parseVObject( VObject *obj ) VObject *o = nextVObject( &nit ); - QCString name = vObjectName( o ); + QCString name = vObjectTypeInfo( o ); if ( name == VCHomeProp ) @@ -844,8 +854,8 @@ static Contact parseVObject( VObject *obj ) void Contact::writeVCard( const QString &filename, const QValueList<Contact> &contacts) -{
- QFileDirect f( filename.utf8().data() );
- if ( !f.open( IO_WriteOnly ) ) {
- qWarning("Unable to open vcard write");
- return;
- }
+{ + QFileDirect f( filename.utf8().data() ); + if ( !f.open( IO_WriteOnly ) ) { + qWarning("Unable to open vcard write"); + return; + } @@ -861,8 +871,8 @@ void Contact::writeVCard( const QString &filename, const QValueList<Contact> &co void Contact::writeVCard( const QString &filename, const Contact &contact) -{
- QFileDirect f( filename.utf8().data() );
- if ( !f.open( IO_WriteOnly ) ) {
- qWarning("Unable to open vcard write");
- return;
- }
+{ + QFileDirect f( filename.utf8().data() ); + if ( !f.open( IO_WriteOnly ) ) { + qWarning("Unable to open vcard write"); + return; + } @@ -896,2 +906,7 @@ QValueList<Contact> Contact::readVCard( const QString &filename ) +bool Contact::match( const QString ®exp ) const +{ + return match(QRegExp(regexp)); +} + bool Contact::match( const QRegExp &r ) const diff --git a/library/backend/contact.h b/library/backend/contact.h index 6abdab6..a74cbbe 100644 --- a/library/backend/contact.h +++ b/library/backend/contact.h @@ -103,3 +103,8 @@ public: - bool match( const QRegExp &r ) const; + bool match( const QString ®exp ) const; + +// DON'T ATTEMPT TO USE THIS +#ifdef QTOPIA_INTERNAL_CONTACT_MRE + bool match( const QRegExp ®exp ) const; +#endif diff --git a/library/backend/event.h b/library/backend/event.h index 0ebe9ea..277aadd 100644 --- a/library/backend/event.h +++ b/library/backend/event.h @@ -142,3 +142,8 @@ private: QString note; + // ADDITION + int mRid; // Recode ID + int mRinfo; // Recode Info + // EventPrivate *d; + }; diff --git a/library/backend/recordfields.h b/library/backend/recordfields.h index 3cddde2..4196c8b 100644 --- a/library/backend/recordfields.h +++ b/library/backend/recordfields.h @@ -33,3 +33,5 @@ namespace Qtopia AddressCategory = CATEGORY_ID, - + + // NOTE: Order of fields dependency in backend/contact.cpp + Title, @@ -41,2 +43,9 @@ namespace Qtopia + JobTitle, + Department, + Company, + BusinessPhone, + BusinessFax, + BusinessMobile, + // email @@ -45,8 +54,2 @@ namespace Qtopia - // home - HomeStreet, - HomeCity, - HomeState, - HomeZip, - HomeCountry, HomePhone, @@ -54,6 +57,4 @@ namespace Qtopia HomeMobile, - HomeWebPage, // business - Company, BusinessStreet, @@ -63,10 +64,6 @@ namespace Qtopia BusinessCountry, + BusinessPager, BusinessWebPage, - JobTitle, - Department, + Office, - BusinessPhone, - BusinessFax, - BusinessMobile, - BusinessPager, Profession, @@ -75,2 +72,10 @@ namespace Qtopia + // home + HomeStreet, + HomeCity, + HomeState, + HomeZip, + HomeCountry, + HomeWebPage, + //personal @@ -86,2 +91,5 @@ namespace Qtopia Groups + + ,rid, + rinfo }; @@ -97,3 +105,6 @@ namespace Qtopia Priority, - Date + Date, + + TaskRid, + TaskRinfo }; @@ -130,2 +141,5 @@ namespace Qtopia RepeatPatternEndDate, + + DateBookRid, + DateBookRinfo }; diff --git a/library/backend/task.h b/library/backend/task.h index ffe26b0..6f383b8 100644 --- a/library/backend/task.h +++ b/library/backend/task.h @@ -74,2 +74,6 @@ private: TaskPrivate *d; + // ADDITION + int recordId; + int recordInfo; + // }; diff --git a/library/backend/vobject.cpp b/library/backend/vobject.cpp index af112a7..9c2ba3b 100644 --- a/library/backend/vobject.cpp +++ b/library/backend/vobject.cpp @@ -1209,2 +1209,11 @@ DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list) +DLLEXPORT(const char *) vObjectTypeInfo(VObject *o)
+{
+ const char *type = vObjectName( o );
+ if ( strcmp( type, "TYPE" ) == 0 )
+ type = vObjectStringZValue( o );
+ return type;
+}
+
+
// end of source file vobject.c
diff --git a/library/backend/vobject_p.h b/library/backend/vobject_p.h index b6a2c0a..a0d921e 100644 --- a/library/backend/vobject_p.h +++ b/library/backend/vobject_p.h @@ -398,2 +398,5 @@ extern VObject* Parse_MIME_FromFile(FILE *file); +extern DLLEXPORT(const char *) vObjectTypeInfo(VObject *o);
+
+
#endif /* __VOBJECT_H__ */
diff --git a/library/categoryedit_p.cpp b/library/categoryedit_p.cpp index 06e5fec..07e707e 100644 --- a/library/categoryedit_p.cpp +++ b/library/categoryedit_p.cpp @@ -77,5 +77,7 @@ void CategoryEdit::setCategories( const QArray<int> &recCats, d->mVisible = visibleName; - QArray<int> cats = d->mCategories.ids( d->mStrApp ); - lvView->clear(); + QStringList appCats = d->mCategories.labels( d->mStrApp ); + QArray<int> cats = d->mCategories.ids(d->mStrApp, appCats); + lvView->clear(); + QStringList::ConstIterator it; diff --git a/library/categoryselect.cpp b/library/categoryselect.cpp index dc5d1fa..21b3f91 100644 --- a/library/categoryselect.cpp +++ b/library/categoryselect.cpp @@ -21,6 +21,8 @@ #include <qpe/categories.h> +#include <qpe/palmtoprecord.h> -#include <qdialog.h> +#include <qmessagebox.h> #include <qlayout.h> #include <qtoolbutton.h> +#include <qfile.h> @@ -29,2 +31,10 @@ +#include <stdlib.h> + +static QString categoryEdittingFileName() +{ + QString str = getenv("HOME"); + str +="/.cateditting"; + return str; +} @@ -59,3 +69,3 @@ public: -CategoryCombo::CategoryCombo( QWidget *parent, const char *name ) +CategoryCombo::CategoryCombo( QWidget *parent, const char *name , int width) : QComboBox( parent, name ) @@ -63,2 +73,4 @@ CategoryCombo::CategoryCombo( QWidget *parent, const char *name ) d = new CategoryComboPrivate(this); + if (width) + setFixedWidth(width); } @@ -80,2 +92,5 @@ void CategoryCombo::initCombo( const QArray<int> &recCats, + QObject::disconnect( this, SIGNAL(activated(int)), + this, SLOT(slotValueChanged(int)) ); + QObject::connect( this, SIGNAL(activated(int)), @@ -84,3 +99,4 @@ void CategoryCombo::initCombo( const QArray<int> &recCats, slApp = d->mCat.labels( d->mStrAppName, TRUE, Categories::UnfiledLabel ); - d->mAppCats = d->mCat.ids( d->mStrAppName ); + + d->mAppCats = d->mCat.ids( d->mStrAppName, slApp); @@ -96,5 +112,3 @@ void CategoryCombo::initCombo( const QArray<int> &recCats, it = slApp.begin(); - insertItem( *it ); - ++it; - for ( j = 0; it != slApp.end(); ++it, j++ ) { + for ( j = 0; j< (int)(slApp.count()-1); ++it, j++ ) { // grr... we have to go through and compare... @@ -113,2 +127,3 @@ void CategoryCombo::initCombo( const QArray<int> &recCats, } + insertItem( *it ); } else @@ -119,3 +134,95 @@ void CategoryCombo::initCombo( const QArray<int> &recCats, if ( d->mAppCats[i] == recCats[0] ) { - setCurrentItem( i + 1 ); + setCurrentItem( i ); + break; + } + } + } else + { + setCurrentItem( slApp.count()-1 ); // unfiled + } +} + +// this is a new function by SHARP instead of initCombo() +QArray<int> CategoryCombo::initComboWithRefind( const QArray<int> &recCats, + const QString &appName) +{ + QString visibleName = appName; + d->mStrAppName = appName; + d->mStrVisibleName = visibleName; + clear(); + QStringList slApp; + QArray<int> results; + + QObject::disconnect( this, SIGNAL(activated(int)), + this, SLOT(slotValueChanged(int)) ); + + QObject::connect( this, SIGNAL(activated(int)), + this, SLOT(slotValueChanged(int)) ); + bool loadOk = d->mCat.load( categoryFileName() ); + slApp = d->mCat.labels( d->mStrAppName, TRUE, Categories::UnfiledLabel ); + + d->mAppCats = d->mCat.ids( d->mStrAppName, slApp); + + // addition part + // make new recCats + if (loadOk){ + int i,j; + int value; + int rCount = recCats.count(); + int mCount = d->mAppCats.count(); + + for (i=0; i<rCount; i++){ + value = 0; + for (j=0; j<mCount; j++){ + if (recCats[i] == d->mAppCats[j]){ + value = recCats[i]; + break; + } + } + if (value != 0){ + int tmp = results.size(); + results.resize( tmp + 1 ); + results[ tmp ] = value; + } + } + } + else{ + results = recCats; + } + // addition end + + int i, + j, + saveMe, + recCount; + QStringList::Iterator it; + // now add in all the items... + recCount = results.count(); + saveMe = -1; + if ( recCount > 1 && loadOk ) { + it = slApp.begin(); + for ( j = 0; j< (int)(slApp.count()-1); ++it, j++ ) { + + // grr... we have to go through and compare... + if ( j < int(d->mAppCats.size()) ) { + for ( i = 0; i < recCount; i++ ) { + if ( results[i] == d->mAppCats[j] ) { + (*it).append( tr(" (Multi.)") ); + if ( saveMe < 0 ) + saveMe = j; + // no need to continue through the list. + break; + } + } + } + insertItem( *it ); + } + insertItem( *it ); + } else + insertStringList( slApp ); + + if ( recCount > 0 && loadOk ) { + for ( i = 0; i < int(d->mAppCats.size()); i++ ) { + if ( d->mAppCats[i] == results[0] ) { + setCurrentItem( i ); break; @@ -124,7 +231,13 @@ void CategoryCombo::initCombo( const QArray<int> &recCats, } else - setCurrentItem( 0 ); // unfiled + { + setCurrentItem( slApp.count()-1 ); // unfiled + } +/* QObject::connect( this, SIGNAL(activated(int)), this, SLOT(slotValueChanged(int)) ); +*/ + return results; } + CategoryCombo::~CategoryCombo() @@ -138,4 +251,4 @@ int CategoryCombo::currentCategory() const returnMe = currentItem(); - // unfiled is now 0... - if ( returnMe == 0 ) + + if ( returnMe == (int)d->mAppCats.count() ) returnMe = -1; @@ -144,3 +257,3 @@ int CategoryCombo::currentCategory() const else - returnMe = d->mAppCats[returnMe - 1]; + returnMe = d->mAppCats[returnMe]; return returnMe; @@ -175,3 +288,3 @@ void CategoryCombo::slotValueChanged( int ) -CategorySelect::CategorySelect( QWidget *parent, const char *name ) +CategorySelect::CategorySelect( QWidget *parent, const char *name,int width) : QHBox( parent, name ), @@ -182,3 +295,3 @@ CategorySelect::CategorySelect( QWidget *parent, const char *name ) d = new CategorySelectPrivate(); - init(); + init(width); } @@ -187,3 +300,3 @@ CategorySelect::CategorySelect( const QArray<int> &vl, const QString &appName, QWidget *parent, - const char *name ) + const char *name ,int width) : QHBox( parent, name ) @@ -191,3 +304,5 @@ CategorySelect::CategorySelect( const QArray<int> &vl, d = new CategorySelectPrivate( vl ); - init(); + + init(width); + setCategories( vl, appName, appName ); @@ -198,3 +313,3 @@ CategorySelect::CategorySelect( const QArray<int> &vl, const QString &visibleName, - QWidget *parent, const char *name ) + QWidget *parent, const char *name , int width) : QHBox( parent, name ) @@ -202,3 +317,3 @@ CategorySelect::CategorySelect( const QArray<int> &vl, d = new CategorySelectPrivate( vl ); - init(); + init(width); setCategories( vl, appName, visibleName ); @@ -213,2 +328,13 @@ void CategorySelect::slotDialog() { + if (QFile::exists( categoryEdittingFileName() )){ + QMessageBox::warning(this,tr("Error"), + tr("Sorry, another application is\nediting categories.") ); + return; + } + + QFile f( categoryEdittingFileName() ); + if ( !f.open( IO_WriteOnly) ){ + return; + } + QDialog editDlg( this, 0, TRUE ); @@ -228,2 +354,5 @@ void CategorySelect::slotDialog() } + + f.close(); + QFile::remove( categoryEdittingFileName() ); } @@ -249,9 +378,9 @@ void CategorySelect::slotNewCat( int newUid ) -void CategorySelect::setCategories( const QArray<int> &rec, +QString CategorySelect::setCategories( const QArray<int> &rec, const QString &appName ) { - setCategories( rec, appName, appName ); + return setCategories( rec, appName, appName ); } -void CategorySelect::setCategories( const QArray<int> &rec, +QString CategorySelect::setCategories( const QArray<int> &rec, const QString &appName, @@ -259,11 +388,12 @@ void CategorySelect::setCategories( const QArray<int> &rec, { - d->mRec = rec; d->mVisibleName = visibleName; mStrAppName = appName; - cmbCat->initCombo( rec, appName ); + d->mRec = cmbCat->initComboWithRefind( rec, appName ); + return Qtopia::Record::idsToString(d->mRec); } -void CategorySelect::init() +void CategorySelect::init(int width) { - cmbCat = new CategoryCombo( this ); + cmbCat = new CategoryCombo( this, 0, width); + QObject::connect( cmbCat, SIGNAL(sigCatChanged(int)), @@ -315 +445,8 @@ void CategorySelect::setAllCategories( bool add ) } + +// 01.12.21 added +void CategorySelect::setFixedWidth(int width) +{ + width -= cmdCat->width(); + cmbCat->setFixedWidth(width); +} diff --git a/library/categoryselect.h b/library/categoryselect.h index 5c6b565..7a8e491 100644 --- a/library/categoryselect.h +++ b/library/categoryselect.h @@ -38,3 +38,4 @@ class CategoryCombo : public QComboBox public: - CategoryCombo( QWidget *parent, const char* name = 0 ); + CategoryCombo( QWidget *parent, const char* name = 0, int width=0); + ~CategoryCombo(); @@ -48,2 +49,4 @@ public: + QArray<int> initComboWithRefind( const QArray<int> &recCats, const QString &appName ); + signals: @@ -67,9 +70,12 @@ public: // we need two constructors, the first gets around designer limitations - CategorySelect( QWidget *parent = 0, const char *name = 0 ); + + CategorySelect( QWidget *parent = 0, const char *name = 0, int width = 0 ); CategorySelect( const QArray<int> &vlCats, const QString &appName, - QWidget *parent = 0, const char *name = 0 ); + QWidget *parent = 0, const char *name = 0, + int width = 0); CategorySelect( const QArray<int> &vlCats, const QString &appName, const QString &visibleName, QWidget *parent = 0, - const char *name = 0 ); + const char *name = 0 , int width = 0); + ~CategorySelect(); @@ -82,7 +88,6 @@ public: // however this call is depreciated... - void setCategories( const QArray<int> &vlCats, const QString &appName ); - // use this one instead (for translating ) - void setCategories( const QArray<int> &vlCats, const QString &appName, - const QString &visibleName ); + QString setCategories( const QArray<int> &vlCats, const QString &appName ); + QString setCategories( const QArray<int> &vlCats, const QString &appName, + const QString &visibleName ); // these were added for find dialog. @@ -91,2 +96,3 @@ public: + void setFixedWidth(int width); signals: @@ -96,2 +102,4 @@ private slots: void slotDialog(); + +public slots: void slotNewCat( int id ); @@ -99,3 +107,3 @@ private slots: private: - void init(); + void init(int width=0); QString mStrAppName; diff --git a/library/config.cpp b/library/config.cpp index 9634571..e07eecb 100644 --- a/library/config.cpp +++ b/library/config.cpp @@ -35,3 +35,5 @@ +#define QTOPIA_INTERNAL_LANGLIST #include "config.h" +#include "global.h" @@ -97,10 +99,5 @@ Config::Config( const QString &name, Domain domain ) read(); - - lang = getenv("LANG"); - int i = lang.find("."); - if ( i > 0 ) - lang = lang.left( i ); - i = lang.find( "_" ); - if ( i > 0 ) - glang = lang.left(i); + QStringList l = Global::languageList(); + lang = l[0]; + glang = l[1]; } diff --git a/library/custom-linux-sharp-g++.h b/library/custom-linux-sharp-g++.h deleted file mode 100644 index f65d474..0000000 --- a/library/custom-linux-sharp-g++.h +++ b/dev/null @@ -1,147 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. -** -** This file is part of the Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - -#define QPE_OWNAPM -#define QPE_HAVE_TOGGLELIGHT -#define QPE_NOCIBAUD -#define QPE_STARTMENU -#include <asm/sharp_apm.h> -#ifndef APM_IOC_BATTERY_BACK_CHK -#define APM_IOC_BATTERY_BACK_CHK _IO(APM_IOC_MAGIC, 32) -#endif -#ifndef APM_IOC_BATTERY_MAIN_CHK -#define APM_IOC_BATTERY_MAIN_CHK _IO(APM_IOC_MAGIC, 33) -#endif - -#include <unistd.h> -#include <stdio.h> -#include <signal.h> -#include <fcntl.h> -#include <sys/ioctl.h> - -#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 - -/* --- for SHARP_BUZZER device --- */ -#define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) -#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) -#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) -#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) -#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) -#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) -#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) - -#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ -#define SHARP_BUZ_KEYSOUND 2 /* key sound */ -#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ -#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ -#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ -#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ -#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ -#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ -#define SHARP_PDA_APPSTART 9 /* application start */ -#define SHARP_PDA_APPQUIT 10 /* application ends */ -#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ -#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ -#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ -#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ - - -#define CUSTOM_BUZZER( sound ) \ -{ \ - static int fd = open( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); \ - ioctl( fd, SHARP_BUZZER_MAKESOUND, sound ); \ -} - -#define CUSTOM_SOUND_ALARM CUSTOM_BUZZER( SHARP_BUZ_SCHEDULE_ALARM ) - -#include <sys/ioctl.h> -#include <asm/sharp_char.h> - -// a bit awkward, as this value is defined in emailclient.cpp aswell... -#define LED_MAIL 0 -#define SHARP_LED_MAIL 9 - -#define CUSTOM_LEDS( led, status ) \ -{ \ - if ( led == LED_MAIL ) \ - led = SHARP_LED_MAIL; \ - static int fd = open( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); \ - sharp_led_status leds; \ - memset(&leds, 0, sizeof(leds)); \ - leds.which = led; \ - leds.status = status; \ - ioctl( fd, SHARP_LED_SETSTATUS, (char*)&leds ); \ -} - -#define QPE_HAVE_MEMALERTER - -#define QPE_MEMALERTER_IMPL \ -static void sig_handler(int sig) \ -{ \ - switch (sig) { \ - case SIGHUP: \ - memstate = VeryLow; \ - break; \ - case SIGUSR1: \ - memstate = Normal; \ - break; \ - case SIGUSR2: \ - memstate = Low; \ - break; \ - } \ -} \ -static void initMemalerter() \ -{ \ - struct sigaction sa; \ - memset(&sa, '\0', sizeof sa); \ - sa.sa_handler = sig_handler; \ - sa.sa_flags = SA_RESTART; \ - if (sigaction(SIGHUP, &sa, NULL) < 0) { \ - return; \ - } \ - if (sigaction(SIGUSR1, &sa, NULL) < 0) { \ - return; \ - } \ - if (sigaction(SIGUSR2, &sa, NULL) < 0) { \ - return; \ - } \ - FILE *fo = fopen("/proc/sys/vm/freepg_signal_proc", "w"); \ - \ - if (!fo) \ - return; \ - fprintf(fo, "qpe\n"); \ - fclose(fo); \ -} - -#define QPE_INITIAL_NUMLOCK_STATE \ -{ \ - bool numLock = FALSE; \ - sharp_kbdctl_modifstat st; \ - int dev = ::open("/dev/sharp_kbdctl", O_RDWR); \ - if( dev >= 0 ) { \ - memset(&st, 0, sizeof(st)); \ - st.which = 3; \ - int ret = ioctl(dev, SHARP_KBDCTL_GETMODIFSTAT, (char*)&st); \ - if( !ret ) \ - numLock = (bool)st.stat; \ - ::close(dev); \ - } \ - return numLock; \ -} diff --git a/library/datebookmonth.h b/library/datebookmonth.h index 6cd1ac5..a7647ae 100644 --- a/library/datebookmonth.h +++ b/library/datebookmonth.h @@ -70,2 +70,3 @@ private: DateBookMonthHeaderPrivate *d; + int focus; }; diff --git a/library/fileselector.h b/library/fileselector.h index ef8efea..8cfdf13 100644 --- a/library/fileselector.h +++ b/library/fileselector.h @@ -24,4 +24,4 @@ #include <qvbox.h> -#include <qlistview.h> #include <qtoolbutton.h> +#include <qlistview.h> @@ -32,2 +32,3 @@ class QPopupMenu; class QPushButton; +class FileSelectorView; @@ -45,30 +46,2 @@ private: -class CategoryMenu; -class FileSelectorViewPrivate; -class FileSelectorView : public QListView -{ - Q_OBJECT - -public: - FileSelectorView( const QString &mimefilter, QWidget *parent, const char *name ); - ~FileSelectorView(); - void reread(); - int fileCount() { return count; } - - void setCategoryFilter(CategoryMenu *); -protected: - void keyPressEvent( QKeyEvent *e ); - -protected slots: - void cardMessage( const QCString &, const QByteArray &); - - void categoryChanged(); - -private: - QString filter; - FileManager *fileManager; - int count; - FileSelectorViewPrivate *d; -}; - class FileSelectorPrivate; @@ -83,3 +56,2 @@ public: void setCloseVisible( bool b ); - void setCategoriesVisible( bool b ); void reread(); diff --git a/library/finddialog.cpp b/library/finddialog.cpp index 7a9367b..904e952 100644 --- a/library/finddialog.cpp +++ b/library/finddialog.cpp @@ -20,2 +20,6 @@ +// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT +// have this class. +#define QTOPIA_INTERNAL_FD + #include "finddialog.h" diff --git a/library/finddialog.h b/library/finddialog.h index 265b5ae..00c7b45 100644 --- a/library/finddialog.h +++ b/library/finddialog.h @@ -20,2 +20,7 @@ + +// +// DO NOT ATTEMPT TO USE THIS CLASS +// + #ifndef __FINDDIALOG_H__ @@ -33,2 +38,7 @@ class FindDialog : public QDialog public: + +// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT +// have this class. +#ifdef QTOPIA_INTERNAL_FD + FindDialog( const QString &appName, @@ -36,2 +46,3 @@ public: ~FindDialog(); +#endif diff --git a/library/mimetype.cpp b/library/mimetype.cpp index c6a4453..9fab160 100644 --- a/library/mimetype.cpp +++ b/library/mimetype.cpp @@ -20,2 +20,3 @@ +#define QTOPIA_INTERNAL_MIMEEXT #include "mimetype.h" @@ -48,2 +49,3 @@ public: QString id; + QString extension; QString desc; @@ -61,2 +63,3 @@ MimeType::Dict* MimeType::d=0; static QMap<QString,QString> *typeFor = 0; +static QMap<QString,QString> *extFor = 0; @@ -98,2 +101,8 @@ QPixmap MimeType::pixmap() const +QString MimeType::extension() const +{ + loadExtensions(); + return *(*extFor).find(i); +} + QPixmap MimeType::bigPixmap() const @@ -130,2 +139,3 @@ void MimeType::loadExtensions() if ( !typeFor ) { + extFor = new QMap<QString,QString>; typeFor = new QMap<QString,QString>; @@ -147,5 +157,8 @@ void MimeType::loadExtensions(const QString& filename) QString id = *it; ++it; - while (it != tokens.end()) { - (*typeFor)[*it] = id; - ++it; + if ( it != tokens.end() ) { + (*extFor)[id] = *it; + while (it != tokens.end()) { + (*typeFor)[*it] = id; + ++it; + } } diff --git a/library/mimetype.h b/library/mimetype.h index 58725d7..b6cca95 100644 --- a/library/mimetype.h +++ b/library/mimetype.h @@ -42,2 +42,7 @@ public: +// DON'T define this yourself! +#ifdef QTOPIA_INTERNAL_MIMEEXT + QString extension() const; +#endif + const AppLnk* application() const; diff --git a/library/network.cpp b/library/network.cpp index 7d51016..e6d2781 100644 --- a/library/network.cpp +++ b/library/network.cpp @@ -20,2 +20,3 @@ +#define QTOPIA_INTERNAL_LANGLIST #include "qpe/network.h" @@ -420,10 +421,12 @@ NetworkInterface* Network::loadPlugin(const QString& type) ifaces->insert(type,iface); - QString lang = getenv( "LANG" ); - QTranslator * trans = new QTranslator(qApp); - QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/lib"+type+".qm"; - if ( trans->load( tfn )) - qApp->installTranslator( trans ); - else - delete trans; - + QStringList langs = Global::languageList(); + for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { + QString lang = *it; + QTranslator * trans = new QTranslator(qApp); + QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/lib"+type+".qm"; + if ( trans->load( tfn )) + qApp->installTranslator( trans ); + else + delete trans; + } } diff --git a/library/power.cpp b/library/power.cpp index 990ff62..12b52ed 100644 --- a/library/power.cpp +++ b/library/power.cpp @@ -104,2 +104,4 @@ bool PowerStatusManager::getProcApmStatus( int &ac, int &bs, int &bf, int &pc, i case 0x04: + case 0xff: // 0xff is Unknown but we map to NotPresent + default: ps->bs = PowerStatus::NotPresent; diff --git a/library/qcopmessage_qws.h b/library/qcopmessage_qws.h deleted file mode 100644 index c19f57d..0000000 --- a/library/qcopmessage_qws.h +++ b/dev/null @@ -1,99 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. -** -** This file is part of the Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - -#ifndef QCOP_MESSAGE_H -#define QCOP_MESSAGE_H - -#include <qdatastream.h> -#include <qbuffer.h> - -class QCopMessage : public QDataStream { - public: - QCopMessage(); - QCopMessage(const QCString& channel, const QCString& message); - QCopMessage(const QCopMessage& orig); - ~QCopMessage(); - - void setChannel(QCString& channel) { m_Channel = channel; } - QCString channel() const { return m_Channel; } - void setMessage(QCString& message) { m_Message = message; } - QCString message() const { return m_Message; } - const QByteArray data() const; - - QCopMessage& operator=(const QCopMessage& orig); - - private: - QCString m_Channel; - QCString m_Message; -}; - -// ### No need to inline, just maintaining binary compatability -inline QCopMessage::QCopMessage() : QDataStream(new QBuffer()) { - device()->open(IO_WriteOnly); -} - -inline QCopMessage::QCopMessage(const QCString& channel, const QCString& message) - : QDataStream(new QBuffer()), m_Channel(channel), m_Message(message) { - device()->open(IO_WriteOnly); -} - -inline QCopMessage::QCopMessage(const QCopMessage& orig) : QDataStream() { - // The QBuffer is going to share the byte array, so it will keep the - // data pointer even when this one goes out of scope. - QByteArray array(((QBuffer*)orig.device())->buffer()); - array.detach(); - setDevice(new QBuffer(array)); - device()->open(IO_Append); - - m_Channel = orig.channel(); - m_Message = orig.message(); -} - -inline QCopMessage& QCopMessage::operator=(const QCopMessage& orig) { - if (device()) { - delete device(); - unsetDevice(); - } - - // The QBuffer is going to share the byte array, so it will keep the - // data pointer even when this one goes out of scope. - QByteArray array(((QBuffer*)orig.device())->buffer()); - array.detach(); - setDevice(new QBuffer(array)); - device()->open(IO_Append); - - m_Channel = orig.channel(); - m_Message = orig.message(); - - return *this; -} - -inline const QByteArray QCopMessage::data() const { - return ((QBuffer*)device())->buffer(); -} - -inline QCopMessage::~QCopMessage() { - // If we still have our QBuffer, clean it up... - if (device()) - delete device(); - unsetDevice(); -} - -#endif diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp index b6085ef..e041945 100644 --- a/library/qpedecoration_qws.cpp +++ b/library/qpedecoration_qws.cpp @@ -19,2 +19,3 @@ **********************************************************************/ +#define QTOPIA_INTERNAL_LANGLIST #include <qapplication.h> @@ -246,6 +247,6 @@ QPEDecoration::QPEDecoration() helpFile = QString(qApp->argv()[0]) + ".html"; - QString lang = getenv( "LANG" ); - helpExists = QFile::exists( QPEApplication::qpeDir() + "/help/" + lang + "/html/" + helpFile ); - if ( !helpExists ) - helpExists = QFile::exists( QPEApplication::qpeDir() + "/help/en/html/" + helpFile ); + QStringList path = Global::helpPath(); + helpExists = FALSE; + for (QStringList::ConstIterator it=path.begin(); it!=path.end() && !helpExists; ++it) + helpExists = QFile::exists( *it + "/" + helpFile ); #ifndef MINIMIZE_HELP_HACK |