summaryrefslogtreecommitdiff
path: root/library
authorkergoth <kergoth>2002-06-07 18:53:14 (UTC)
committer kergoth <kergoth>2002-06-07 18:53:14 (UTC)
commit640d964cfdc7467f6cacb513087cd3acda2c04f0 (patch) (side-by-side diff)
tree9a784686c1795f8b1f81eb344598f3b549d43467 /library
parentdfb9c76738bb68e235114c5ad43dbd26a59b98ab (diff)
downloadopie-640d964cfdc7467f6cacb513087cd3acda2c04f0.zip
opie-640d964cfdc7467f6cacb513087cd3acda2c04f0.tar.gz
opie-640d964cfdc7467f6cacb513087cd3acda2c04f0.tar.bz2
Backing out unintentional merge from TT branch.
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/alarmserver.h3
-rw-r--r--library/applnk.h3
-rw-r--r--library/backend/categories.cpp146
-rw-r--r--library/backend/categories.h12
-rw-r--r--library/backend/contact.cpp107
-rw-r--r--library/backend/contact.h7
-rw-r--r--library/backend/event.h5
-rw-r--r--library/backend/recordfields.h46
-rw-r--r--library/backend/task.h4
-rw-r--r--library/backend/vobject.cpp9
-rw-r--r--library/backend/vobject_p.h3
-rw-r--r--library/categoryedit_p.cpp6
-rw-r--r--library/categoryselect.cpp185
-rw-r--r--library/categoryselect.h26
-rw-r--r--library/config.cpp13
-rw-r--r--library/custom-linux-sharp-g++.h147
-rw-r--r--library/datebookmonth.h1
-rw-r--r--library/fileselector.h32
-rw-r--r--library/finddialog.cpp4
-rw-r--r--library/finddialog.h11
-rw-r--r--library/mimetype.cpp19
-rw-r--r--library/mimetype.h5
-rw-r--r--library/network.cpp19
-rw-r--r--library/power.cpp2
-rw-r--r--library/qcopmessage_qws.h99
-rw-r--r--library/qpedecoration_qws.cpp9
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
@@ -28,6 +28,9 @@ class AlarmServer
public:
static void addAlarm ( QDateTime when, const QCString& channel, const QCString& msg, int data=0);
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
@@ -58,6 +58,8 @@ public:
const QArray<int> &categories() const;
int id() const { return mId; }
+ bool linkFileKnown() const { return !mLinkFile.isNull(); }
+
void execute() const;
void execute(const QStringList& args) const;
void removeFiles();
@@ -96,6 +98,7 @@ protected:
virtual void invoke(const QStringList& args) const;
bool ensureLinkExists() const;
+ void storeLink() const;
};
class DocLnk : public AppLnk
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
@@ -171,36 +171,6 @@ QStringList CategoryGroup::labels(const QArray<int> &catids ) const
return labels;
}
-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;
-}
-
/***********************************************************
*
* Categories
@@ -343,6 +313,14 @@ QStringList Categories::labels( const QString &app,
QMap< QString, CategoryGroup >::ConstIterator
appIt = mAppCats.find( 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 ) {
case NoExtra: break;
case AllUnfiled:
@@ -356,14 +334,7 @@ QStringList Categories::labels( const QString &app,
cats.append( tr("Unfiled") );
break;
}
- 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;
}
@@ -378,14 +349,6 @@ QString Categories::label( const QString &app, int id ) const
return (*appIt).label( id );
}
-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
* a combobox or any area that requires one string. If catids are empty
* then "Unfiled" will be returned. If multiple categories are assigned
@@ -417,33 +380,21 @@ QString Categories::displaySingle( const QString &app,
return r;
}
-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;
}
int Categories::id( const QString &app, const QString &cat ) const
@@ -539,23 +490,28 @@ bool Categories::exists( const QString &appname,
return (*appIt).contains( catname );
}
+
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());
return FALSE;
}
- 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";
for ( QMap<QString, CategoryGroup>::ConstIterator appsIt=mAppCats.begin();
appsIt != mAppCats.end(); ++appsIt ) {
@@ -563,13 +519,28 @@ bool Categories::save( const QString &fname ) const
const QMap<int, QString> &appcats = (*appsIt).idMap();
for ( QMap<int, QString>::ConstIterator appcatit = appcats.begin();
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;
}
@@ -578,6 +549,11 @@ bool Categories::load( const QString &fname )
QFile file( fname );
if ( !file.open( IO_ReadOnly ) ) {
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
@@ -71,8 +71,7 @@ public:
/** Returns a sorted list of labels */
QStringList labels() const;
- QArray<int> ids( const QStringList &cats ) const;
- QArray<int> ids() const;
+
QStringList labels( const QArray<int> &catids ) const;
const QMap<int, QString> &idMap() const { return mIdLabelMap; }
@@ -130,9 +129,8 @@ public:
bool removeGlobalCategory( const QString &catName );
bool removeGlobalCategory( int uid );
- 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 */
int id( const QString &app, const QString &cat ) const;
/** Returns the label associated with the id */
@@ -153,10 +151,6 @@ public:
bool includeGlobal = TRUE,
ExtraLabels extra = NoExtra ) const;
- /** 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 };
/** Returns a single string associated with the cat ids for display in
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
@@ -18,9 +18,11 @@
**
**********************************************************************/
+#define QTOPIA_INTERNAL_CONTACT_MRE
+
#include "contact.h"
-#include "vobject_p.h"
-#include "qfiledirect_p.h"
+#include "vobject_p.h"
+#include "qfiledirect_p.h"
#include <qpe/stringutil.h>
#include <qpe/timeconversion.h>
@@ -386,45 +388,49 @@ QStringList Contact::fields()
list.append( "Suffix" );
list.append( "FileAs" );
+ list.append( "JobTitle" );
+ list.append( "Department" );
+ list.append( "Company" );
+ list.append( "BusinessPhone" );
+ list.append( "BusinessFax" );
+ list.append( "BusinessMobile" );
+
list.append( "DefaultEmail" );
list.append( "Emails" );
- list.append( "HomeStreet" );
- list.append( "HomeCity" );
- list.append( "HomeState" );
- list.append( "HomeZip" );
- list.append( "HomeCountry" );
list.append( "HomePhone" );
list.append( "HomeFax" );
list.append( "HomeMobile" );
- list.append( "HomeWebPage" );
- list.append( "Company" );
list.append( "BusinessStreet" );
list.append( "BusinessCity" );
list.append( "BusinessState" );
list.append( "BusinessZip" );
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" );
list.append( "Assistant" );
list.append( "Manager" );
+ list.append( "HomeStreet" );
+ list.append( "HomeCity" );
+ list.append( "HomeState" );
+ list.append( "HomeZip" );
+ list.append( "HomeCountry" );
+ list.append( "HomeWebPage" );
+
list.append( "Spouse" );
list.append( "Gender" );
list.append( "Birthday" );
list.append( "Anniversary" );
list.append( "Nickname" );
-
list.append( "Children" );
+
list.append( "Notes" );
+ list.append( "Groups" );
return list;
}
@@ -440,45 +446,49 @@ QStringList Contact::trfields()
list.append( QObject::tr( "Suffix" ) );
list.append( QObject::tr( "File As" ) );
+ 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" ) );
list.append( QObject::tr( "Emails" ) );
- 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" ) );
list.append( QObject::tr( "Home Fax" ) );
list.append( QObject::tr( "Home Mobile" ) );
- list.append( QObject::tr( "Home Web Page" ) );
- list.append( QObject::tr( "Company" ) );
list.append( QObject::tr( "Business Street" ) );
list.append( QObject::tr( "Business City" ) );
list.append( QObject::tr( "Business State" ) );
list.append( QObject::tr( "Business Zip" ) );
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" ) );
list.append( QObject::tr( "Assistant" ) );
list.append( QObject::tr( "Manager" ) );
+ 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" ) );
list.append( QObject::tr( "Gender" ) );
list.append( QObject::tr( "Birthday" ) );
list.append( QObject::tr( "Anniversary" ) );
list.append( QObject::tr( "Nickname" ) );
-
list.append( QObject::tr( "Children" ) );
+
list.append( QObject::tr( "Notes" ) );
+ list.append( QObject::tr( "Groups" ) );
return list;
}
@@ -629,7 +639,7 @@ static Contact parseVObject( VObject *obj )
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
- QCString name = vObjectName( o );
+ QCString name = vObjectTypeInfo( o );
QString value = vObjectStringZValue( o );
if ( name == VCNamePrefixesProp )
c.setTitle( value );
@@ -702,7 +712,7 @@ static Contact parseVObject( VObject *obj )
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
- QCString name = vObjectName( o );
+ QCString name = vObjectTypeInfo( o );
if ( name == VCHomeProp )
type |= HOME;
else if ( name == VCWorkProp )
@@ -749,7 +759,7 @@ static Contact parseVObject( VObject *obj )
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
- QCString name = vObjectName( o );
+ QCString name = vObjectTypeInfo( o );
if ( name != VCInternetProp && name != VCHomeProp &&
name != VCWorkProp &&
name != VCPreferredProp )
@@ -772,7 +782,7 @@ static Contact parseVObject( VObject *obj )
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
- QCString name = vObjectName( o );
+ QCString name = vObjectTypeInfo( o );
if ( name == VCHomeProp )
c.setHomeWebpage( value );
else if ( name == VCWorkProp )
@@ -842,12 +852,12 @@ 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;
+ }
QValueList<Contact>::ConstIterator it;
for( it = contacts.begin(); it != contacts.end(); ++it ) {
@@ -859,12 +869,12 @@ 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;
+ }
VObject *obj = createVObject( contact );
writeVObject( f.directHandle() , obj );
@@ -894,6 +904,11 @@ QValueList<Contact> Contact::readVCard( const QString &filename )
return contacts;
}
+bool Contact::match( const QString &regexp ) const
+{
+ return match(QRegExp(regexp));
+}
+
bool Contact::match( const QRegExp &r ) const
{
bool match;
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
@@ -101,7 +101,12 @@ public:
// other
void setNotes( const QString &v ) { replace( Qtopia::Notes, v); }
- bool match( const QRegExp &r ) const;
+ bool match( const QString &regexp ) const;
+
+// DON'T ATTEMPT TO USE THIS
+#ifdef QTOPIA_INTERNAL_CONTACT_MRE
+ bool match( const QRegExp &regexp ) const;
+#endif
// // custom
// void setCustomField( const QString &key, const QString &v )
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
@@ -140,7 +140,12 @@ private:
SoundTypeChoice aSound;
RepeatPattern pattern;
QString note;
+ // ADDITION
+ int mRid; // Recode ID
+ int mRinfo; // Recode Info
+ //
EventPrivate *d;
+
};
// Since an event spans multiple day, it is better to have this
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
@@ -31,7 +31,9 @@ namespace Qtopia
enum AddressBookFields {
AddressUid = UID_ID,
AddressCategory = CATEGORY_ID,
-
+
+ // NOTE: Order of fields dependency in backend/contact.cpp
+
Title,
FirstName,
MiddleName,
@@ -39,40 +41,43 @@ namespace Qtopia
Suffix,
FileAs,
+ JobTitle,
+ Department,
+ Company,
+ BusinessPhone,
+ BusinessFax,
+ BusinessMobile,
+
// email
DefaultEmail,
Emails,
- // home
- HomeStreet,
- HomeCity,
- HomeState,
- HomeZip,
- HomeCountry,
HomePhone,
HomeFax,
HomeMobile,
- HomeWebPage,
// business
- Company,
BusinessStreet,
BusinessCity,
BusinessState,
BusinessZip,
BusinessCountry,
+ BusinessPager,
BusinessWebPage,
- JobTitle,
- Department,
+
Office,
- BusinessPhone,
- BusinessFax,
- BusinessMobile,
- BusinessPager,
Profession,
Assistant,
Manager,
+ // home
+ HomeStreet,
+ HomeCity,
+ HomeState,
+ HomeZip,
+ HomeCountry,
+ HomeWebPage,
+
//personal
Spouse,
Gender,
@@ -84,6 +89,9 @@ namespace Qtopia
// other
Notes,
Groups
+
+ ,rid,
+ rinfo
};
// dataset = "todolist"
@@ -95,7 +103,10 @@ namespace Qtopia
Completed,
TaskDescription,
Priority,
- Date
+ Date,
+
+ TaskRid,
+ TaskRinfo
};
// dataset = "categories" for todos
@@ -128,6 +139,9 @@ namespace Qtopia
RepeatPatternDays,
RepeatPatternHasEndDate,
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
@@ -72,6 +72,10 @@ private:
int mPriority;
QString mDesc;
TaskPrivate *d;
+ // ADDITION
+ int recordId;
+ int recordInfo;
+ //
};
#endif
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
@@ -1207,4 +1207,13 @@ 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
@@ -396,6 +396,9 @@ extern VObject* Parse_MIME_FromFile(CFile *file);
extern VObject* Parse_MIME_FromFile(FILE *file);
#endif
+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
@@ -75,9 +75,11 @@ void CategoryEdit::setCategories( const QArray<int> &recCats,
d = new CategoryEditPrivate( (QWidget*)parent(), name() );
d->mStrApp = appName;
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;
int i, j;
for ( i = 0, it = appCats.begin(); it != appCats.end(); i++, ++it ) {
diff --git a/library/categoryselect.cpp b/library/categoryselect.cpp
index dc5d1fa..21b3f91 100644
--- a/library/categoryselect.cpp
+++ b/library/categoryselect.cpp
@@ -19,14 +19,24 @@
**********************************************************************/
#include <qpe/categories.h>
+#include <qpe/palmtoprecord.h>
-#include <qdialog.h>
+#include <qmessagebox.h>
#include <qlayout.h>
#include <qtoolbutton.h>
+#include <qfile.h>
#include "categorywidget.h"
#include "categoryselect.h"
+#include <stdlib.h>
+
+static QString categoryEdittingFileName()
+{
+ QString str = getenv("HOME");
+ str +="/.cateditting";
+ return str;
+}
class CategoryComboPrivate
{
@@ -57,10 +67,12 @@ public:
QString mVisibleName;
};
-CategoryCombo::CategoryCombo( QWidget *parent, const char *name )
+CategoryCombo::CategoryCombo( QWidget *parent, const char *name , int width)
: QComboBox( parent, name )
{
d = new CategoryComboPrivate(this);
+ if (width)
+ setFixedWidth(width);
}
void CategoryCombo::initCombo( const QArray<int> &recCats,
@@ -78,11 +90,15 @@ void CategoryCombo::initCombo( const QArray<int> &recCats,
clear();
QStringList slApp;
+ 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 );
+
+ d->mAppCats = d->mCat.ids( d->mStrAppName, slApp);
int i,
j,
@@ -94,9 +110,7 @@ void CategoryCombo::initCombo( const QArray<int> &recCats,
saveMe = -1;
if ( recCount > 1 && loadOk ) {
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...
if ( j < int(d->mAppCats.size()) ) {
for ( i = 0; i < recCount; i++ ) {
@@ -111,22 +125,121 @@ void CategoryCombo::initCombo( const QArray<int> &recCats,
}
insertItem( *it );
}
+ insertItem( *it );
} else
insertStringList( slApp );
if ( recCount > 0 && loadOk ) {
for ( i = 0; i < int(d->mAppCats.size()); i++ ) {
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;
}
}
} else
- setCurrentItem( 0 ); // unfiled
+ {
+ setCurrentItem( slApp.count()-1 ); // unfiled
+ }
+/*
QObject::connect( this, SIGNAL(activated(int)),
this, SLOT(slotValueChanged(int)) );
+*/
+ return results;
}
+
CategoryCombo::~CategoryCombo()
{
delete d;
@@ -136,13 +249,13 @@ int CategoryCombo::currentCategory() const
{
int returnMe;
returnMe = currentItem();
- // unfiled is now 0...
- if ( returnMe == 0 )
+
+ if ( returnMe == (int)d->mAppCats.count() )
returnMe = -1;
else if ( returnMe > (int)d->mAppCats.count() ) // only happen on "All"
returnMe = -2;
else
- returnMe = d->mAppCats[returnMe - 1];
+ returnMe = d->mAppCats[returnMe];
return returnMe;
}
@@ -173,34 +286,36 @@ void CategoryCombo::slotValueChanged( int )
emit sigCatChanged( currentCategory() );
}
-CategorySelect::CategorySelect( QWidget *parent, const char *name )
+CategorySelect::CategorySelect( QWidget *parent, const char *name,int width)
: QHBox( parent, name ),
cmbCat( 0 ),
cmdCat( 0 ),
d( 0 )
{
d = new CategorySelectPrivate();
- init();
+ init(width);
}
CategorySelect::CategorySelect( const QArray<int> &vl,
const QString &appName, QWidget *parent,
- const char *name )
+ const char *name ,int width)
: QHBox( parent, name )
{
d = new CategorySelectPrivate( vl );
- init();
+
+ init(width);
+
setCategories( vl, appName, appName );
}
CategorySelect::CategorySelect( const QArray<int> &vl,
const QString &appName,
const QString &visibleName,
- QWidget *parent, const char *name )
+ QWidget *parent, const char *name , int width)
: QHBox( parent, name )
{
d = new CategorySelectPrivate( vl );
- init();
+ init(width);
setCategories( vl, appName, visibleName );
}
@@ -211,6 +326,17 @@ CategorySelect::~CategorySelect()
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 );
editDlg.setCaption( tr("Edit Categories") );
QVBoxLayout *vb = new QVBoxLayout( &editDlg );
@@ -226,6 +352,9 @@ void CategorySelect::slotDialog()
d->mRec = ce.newCategories();
cmbCat->initCombo( d->mRec, mStrAppName );
}
+
+ f.close();
+ QFile::remove( categoryEdittingFileName() );
}
void CategorySelect::slotNewCat( int newUid )
@@ -247,25 +376,26 @@ void CategorySelect::slotNewCat( int newUid )
emit signalSelected( currentCategory() );
}
-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,
const QString &visibleName )
{
- 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)),
this, SLOT(slotNewCat(int)) );
cmdCat = new QToolButton( this );
@@ -313,3 +443,10 @@ void CategorySelect::setAllCategories( bool add )
} else
cmbCat->removeItem( cmbCat->count() - 1 );
}
+
+// 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
@@ -36,7 +36,8 @@ class CategoryCombo : public QComboBox
Q_OBJECT
public:
- CategoryCombo( QWidget *parent, const char* name = 0 );
+ CategoryCombo( QWidget *parent, const char* name = 0, int width=0);
+
~CategoryCombo();
int currentCategory() const;
@@ -46,6 +47,8 @@ public:
void initCombo( const QArray<int> &recCats, const QString &appName,
const QString &visibleName /* = appName */ );
+ QArray<int> initComboWithRefind( const QArray<int> &recCats, const QString &appName );
+
signals:
void sigCatChanged( int newUid );
@@ -65,13 +68,16 @@ class CategorySelect : public QHBox
Q_OBJECT
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();
const QArray<int> &currentCategories() const;
@@ -80,24 +86,26 @@ public:
// pretty much if you don't set it the constructor, you need to
// call it here ASAP!
// 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.
void setRemoveCategoryEdit( bool remove );
void setAllCategories( bool add );
+ void setFixedWidth(int width);
signals:
void signalSelected( int );
private slots:
void slotDialog();
+
+public slots:
void slotNewCat( int id );
private:
- void init();
+ void init(int width=0);
QString mStrAppName;
CategoryCombo *cmbCat;
QToolButton *cmdCat;
diff --git a/library/config.cpp b/library/config.cpp
index 9634571..e07eecb 100644
--- a/library/config.cpp
+++ b/library/config.cpp
@@ -33,7 +33,9 @@
#include <stdlib.h>
#include <unistd.h>
+#define QTOPIA_INTERNAL_LANGLIST
#include "config.h"
+#include "global.h"
/*!
@@ -95,14 +97,9 @@ Config::Config( const QString &name, Domain domain )
{
git = groups.end();
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
@@ -68,6 +68,7 @@ private:
QComboBox *month;
QSpinBox *year;
DateBookMonthHeaderPrivate *d;
+ int focus;
};
class DayItemMonthPrivate;
diff --git a/library/fileselector.h b/library/fileselector.h
index ef8efea..8cfdf13 100644
--- a/library/fileselector.h
+++ b/library/fileselector.h
@@ -22,14 +22,15 @@
#include <qhbox.h>
#include <qvbox.h>
-#include <qlistview.h>
#include <qtoolbutton.h>
+#include <qlistview.h>
#include "filemanager.h"
#include "applnk.h"
class QPopupMenu;
class QPushButton;
+class FileSelectorView;
class FileSelectorItem : public QListViewItem
{
@@ -43,34 +44,6 @@ private:
DocLnk fl;
};
-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;
class FileSelector : public QVBox
{
@@ -81,7 +54,6 @@ public:
~FileSelector();
void setNewVisible( bool b );
void setCloseVisible( bool b );
- void setCategoriesVisible( bool b );
void reread();
int fileCount();
const DocLnk *selected();
diff --git a/library/finddialog.cpp b/library/finddialog.cpp
index 7a9367b..904e952 100644
--- a/library/finddialog.cpp
+++ b/library/finddialog.cpp
@@ -18,6 +18,10 @@
**
**********************************************************************/
+// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
+// have this class.
+#define QTOPIA_INTERNAL_FD
+
#include "finddialog.h"
#include "findwidget_p.h"
diff --git a/library/finddialog.h b/library/finddialog.h
index 265b5ae..00c7b45 100644
--- a/library/finddialog.h
+++ b/library/finddialog.h
@@ -18,6 +18,11 @@
**
**********************************************************************/
+
+//
+// DO NOT ATTEMPT TO USE THIS CLASS
+//
+
#ifndef __FINDDIALOG_H__
#define __FINDDIALOG_H__
@@ -31,9 +36,15 @@ class FindDialog : public QDialog
{
Q_OBJECT
public:
+
+// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
+// have this class.
+#ifdef QTOPIA_INTERNAL_FD
+
FindDialog( const QString &appName,
QWidget *parent = 0, const char *name = 0, bool modal = TRUE );
~FindDialog();
+#endif
QString findText() const;
void setUseDate( bool show );
diff --git a/library/mimetype.cpp b/library/mimetype.cpp
index c6a4453..9fab160 100644
--- a/library/mimetype.cpp
+++ b/library/mimetype.cpp
@@ -18,6 +18,7 @@
**
**********************************************************************/
+#define QTOPIA_INTERNAL_MIMEEXT
#include "mimetype.h"
#include "applnk.h"
#include "resource.h"
@@ -46,6 +47,7 @@ public:
}
}
QString id;
+ QString extension;
QString desc;
QPixmap regIcon;
QPixmap bigIcon;
@@ -59,6 +61,7 @@ public:
MimeType::Dict* MimeType::d=0;
static QMap<QString,QString> *typeFor = 0;
+static QMap<QString,QString> *extFor = 0;
MimeType::Dict& MimeType::dict()
{
@@ -96,6 +99,12 @@ QPixmap MimeType::pixmap() const
return d ? d->regIcon : QPixmap();
}
+QString MimeType::extension() const
+{
+ loadExtensions();
+ return *(*extFor).find(i);
+}
+
QPixmap MimeType::bigPixmap() const
{
MimeTypeData* d = data(i);
@@ -128,6 +137,7 @@ void MimeType::clear()
void MimeType::loadExtensions()
{
if ( !typeFor ) {
+ extFor = new QMap<QString,QString>;
typeFor = new QMap<QString,QString>;
loadExtensions("/etc/mime.types");
loadExtensions(QPEApplication::qpeDir()+"etc/mime.types");
@@ -145,9 +155,12 @@ void MimeType::loadExtensions(const QString& filename)
QStringList::ConstIterator it = tokens.begin();
if ( it != tokens.end() ) {
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
@@ -40,6 +40,11 @@ public:
QPixmap pixmap() const;
QPixmap bigPixmap() const;
+// DON'T define this yourself!
+#ifdef QTOPIA_INTERNAL_MIMEEXT
+ QString extension() const;
+#endif
+
const AppLnk* application() const;
static QString appsFolderName();
diff --git a/library/network.cpp b/library/network.cpp
index 7d51016..e6d2781 100644
--- a/library/network.cpp
+++ b/library/network.cpp
@@ -18,6 +18,7 @@
**
**********************************************************************/
+#define QTOPIA_INTERNAL_LANGLIST
#include "qpe/network.h"
#include "qpe/networkinterface.h"
#include "qpe/global.h"
@@ -418,14 +419,16 @@ NetworkInterface* Network::loadPlugin(const QString& type)
if ( !lib.queryInterface( IID_Network, (QUnknownInterface**)&iface ) == QS_OK )
return 0;
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;
+ }
}
return iface;
#else
diff --git a/library/power.cpp b/library/power.cpp
index 990ff62..12b52ed 100644
--- a/library/power.cpp
+++ b/library/power.cpp
@@ -102,6 +102,8 @@ bool PowerStatusManager::getProcApmStatus( int &ac, int &bs, int &bf, int &pc, i
ps->bs = PowerStatus::Charging;
break;
case 0x04:
+ case 0xff: // 0xff is Unknown but we map to NotPresent
+ default:
ps->bs = PowerStatus::NotPresent;
break;
}
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
@@ -17,6 +17,7 @@
** not clear to you.
**
**********************************************************************/
+#define QTOPIA_INTERNAL_LANGLIST
#include <qapplication.h>
#include <qstyle.h>
#include <qwidget.h>
@@ -244,10 +245,10 @@ QPEDecoration::QPEDecoration()
imageClose = Resource::loadImage( "CloseButton" );
imageHelp = Resource::loadImage( "HelpButton" );
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
qpeManager = new QPEManager( this );
#else