author | kergoth <kergoth> | 2002-06-07 18:53:14 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-06-07 18:53:14 (UTC) |
commit | 640d964cfdc7467f6cacb513087cd3acda2c04f0 (patch) (unidiff) | |
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 | |||
@@ -23,13 +23,16 @@ | |||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qdatetime.h> | 24 | #include <qdatetime.h> |
25 | 25 | ||
26 | class AlarmServer | 26 | class AlarmServer |
27 | { | 27 | { |
28 | public: | 28 | public: |
29 | static void addAlarm ( QDateTime when, const QCString& channel, const QCString& msg, int data=0); | 29 | static void addAlarm ( QDateTime when, const QCString& channel, const QCString& msg, int data=0); |
30 | static void deleteAlarm (QDateTime when, const QCString& channel, const QCString& msg, int data=0); | 30 | static void deleteAlarm (QDateTime when, const QCString& channel, const QCString& msg, int data=0); |
31 | |||
32 | private: | ||
33 | friend int initApplication(int, char **); | ||
31 | static void initialize(); | 34 | static void initialize(); |
32 | }; | 35 | }; |
33 | 36 | ||
34 | #endif | 37 | #endif |
35 | 38 | ||
diff --git a/library/applnk.h b/library/applnk.h index c6f92a3..18e20b6 100644 --- a/library/applnk.h +++ b/library/applnk.h | |||
@@ -53,16 +53,18 @@ public: | |||
53 | QString comment() const { return mComment; } | 53 | QString comment() const { return mComment; } |
54 | QString file() const; | 54 | QString file() const; |
55 | QString linkFile() const; | 55 | QString linkFile() const; |
56 | QStringList mimeTypes() const { return mMimeTypes; } | 56 | QStringList mimeTypes() const { return mMimeTypes; } |
57 | QStringList mimeTypeIcons() const { return mMimeTypeIcons; } | 57 | QStringList mimeTypeIcons() const { return mMimeTypeIcons; } |
58 | const QArray<int> &categories() const; | 58 | const QArray<int> &categories() const; |
59 | int id() const { return mId; } | 59 | int id() const { return mId; } |
60 | 60 | ||
61 | bool linkFileKnown() const { return !mLinkFile.isNull(); } | ||
62 | |||
61 | void execute() const; | 63 | void execute() const; |
62 | void execute(const QStringList& args) const; | 64 | void execute(const QStringList& args) const; |
63 | void removeFiles(); | 65 | void removeFiles(); |
64 | void removeLinkFile(); | 66 | void removeLinkFile(); |
65 | 67 | ||
66 | void setName( const QString& docname ); | 68 | void setName( const QString& docname ); |
67 | void setExec( const QString& exec ); | 69 | void setExec( const QString& exec ); |
68 | void setFile( const QString& filename ); | 70 | void setFile( const QString& filename ); |
@@ -91,16 +93,17 @@ protected: | |||
91 | QStringList mMimeTypeIcons; | 93 | QStringList mMimeTypeIcons; |
92 | int mId; | 94 | int mId; |
93 | static int lastId; | 95 | static int lastId; |
94 | AppLnkPrivate *d; | 96 | AppLnkPrivate *d; |
95 | friend class AppLnkSet; | 97 | friend class AppLnkSet; |
96 | 98 | ||
97 | virtual void invoke(const QStringList& args) const; | 99 | virtual void invoke(const QStringList& args) const; |
98 | bool ensureLinkExists() const; | 100 | bool ensureLinkExists() const; |
101 | void storeLink() const; | ||
99 | }; | 102 | }; |
100 | 103 | ||
101 | class DocLnk : public AppLnk | 104 | class DocLnk : public AppLnk |
102 | { | 105 | { |
103 | public: | 106 | public: |
104 | DocLnk(); | 107 | DocLnk(); |
105 | DocLnk( const DocLnk &o ) : AppLnk(o) { } | 108 | DocLnk( const DocLnk &o ) : AppLnk(o) { } |
106 | DocLnk( const QString &file ); | 109 | DocLnk( const QString &file ); |
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 | |||
@@ -166,46 +166,16 @@ QStringList CategoryGroup::labels(const QArray<int> &catids ) const | |||
166 | return labels; | 166 | return labels; |
167 | for ( QMap<int, QString>::ConstIterator it = mIdLabelMap.begin(); | 167 | for ( QMap<int, QString>::ConstIterator it = mIdLabelMap.begin(); |
168 | it != mIdLabelMap.end(); ++it ) | 168 | it != mIdLabelMap.end(); ++it ) |
169 | if ( catids.find( it.key() ) != -1 ) | 169 | if ( catids.find( it.key() ) != -1 ) |
170 | labels += *it; | 170 | labels += *it; |
171 | return labels; | 171 | return labels; |
172 | } | 172 | } |
173 | 173 | ||
174 | QArray<int> CategoryGroup::ids( const QStringList &cats ) const | ||
175 | { | ||
176 | QArray<int> results; | ||
177 | |||
178 | for ( QStringList::ConstIterator catIt = cats.begin(); | ||
179 | catIt != cats.end(); ++catIt ) { | ||
180 | if ( *catIt == QObject::tr("All") || *catIt == QObject::tr("Unfiled") ) | ||
181 | continue; | ||
182 | int value = id( *catIt ); | ||
183 | if ( value != 0 ) { | ||
184 | int tmp = results.size(); | ||
185 | results.resize( tmp + 1 ); | ||
186 | results[ tmp ] = value; | ||
187 | } | ||
188 | } | ||
189 | |||
190 | return results; | ||
191 | } | ||
192 | |||
193 | QArray<int> CategoryGroup::ids() const | ||
194 | { | ||
195 | QArray<int> results( mIdLabelMap.count() ); | ||
196 | int i = 0; | ||
197 | for ( QMap<int, QString>::ConstIterator it = mIdLabelMap.begin(); | ||
198 | it != mIdLabelMap.end(); ++it ) | ||
199 | results[i++] = it.key(); | ||
200 | |||
201 | return results; | ||
202 | } | ||
203 | |||
204 | /*********************************************************** | 174 | /*********************************************************** |
205 | * | 175 | * |
206 | * Categories | 176 | * Categories |
207 | * | 177 | * |
208 | **********************************************************/ | 178 | **********************************************************/ |
209 | 179 | ||
210 | /** Add the category name as long as it doesn't already exist locally | 180 | /** Add the category name as long as it doesn't already exist locally |
211 | * or globally. Return TRUE if added, FALSE if conflicts. | 181 | * or globally. Return TRUE if added, FALSE if conflicts. |
@@ -338,59 +308,52 @@ bool Categories::removeGlobalCategory( int uid ) | |||
338 | */ | 308 | */ |
339 | QStringList Categories::labels( const QString &app, | 309 | QStringList Categories::labels( const QString &app, |
340 | bool includeGlobal, | 310 | bool includeGlobal, |
341 | ExtraLabels extra ) const | 311 | ExtraLabels extra ) const |
342 | { | 312 | { |
343 | QMap< QString, CategoryGroup >::ConstIterator | 313 | QMap< QString, CategoryGroup >::ConstIterator |
344 | appIt = mAppCats.find( app ); | 314 | appIt = mAppCats.find( app ); |
345 | QStringList cats; | 315 | QStringList cats; |
316 | |||
317 | if ( appIt != mAppCats.end() ) | ||
318 | cats += (*appIt).labels(); | ||
319 | else qDebug("Categories::labels didn't find app %s", app.latin1() ); | ||
320 | if ( includeGlobal ) | ||
321 | cats += mGlobalCats.labels(); | ||
322 | |||
323 | cats.sort(); | ||
346 | switch ( extra ) { | 324 | switch ( extra ) { |
347 | case NoExtra: break; | 325 | case NoExtra: break; |
348 | case AllUnfiled: | 326 | case AllUnfiled: |
349 | cats.append( tr("All") ); | 327 | cats.append( tr("All") ); |
350 | cats.append( tr("Unfiled") ); | 328 | cats.append( tr("Unfiled") ); |
351 | break; | 329 | break; |
352 | case AllLabel: | 330 | case AllLabel: |
353 | cats.append( tr("All") ); | 331 | cats.append( tr("All") ); |
354 | break; | 332 | break; |
355 | case UnfiledLabel: | 333 | case UnfiledLabel: |
356 | cats.append( tr("Unfiled") ); | 334 | cats.append( tr("Unfiled") ); |
357 | break; | 335 | break; |
358 | } | 336 | } |
359 | if ( appIt != mAppCats.end() ) | 337 | |
360 | cats += (*appIt).labels(); | ||
361 | else qDebug("Categories::labels didn't find app %s", app.latin1() ); | ||
362 | if ( includeGlobal ) | ||
363 | cats += mGlobalCats.labels(); | ||
364 | // I don't think a sorted list is useful, the user might find prefer | ||
365 | // it in the original order. | ||
366 | // cats.sort(); | ||
367 | return cats; | 338 | return cats; |
368 | } | 339 | } |
369 | 340 | ||
370 | QString Categories::label( const QString &app, int id ) const | 341 | QString Categories::label( const QString &app, int id ) const |
371 | { | 342 | { |
372 | if ( mGlobalCats.contains( id ) ) | 343 | if ( mGlobalCats.contains( id ) ) |
373 | return mGlobalCats.label( id ); | 344 | return mGlobalCats.label( id ); |
374 | QMap< QString, CategoryGroup >::ConstIterator | 345 | QMap< QString, CategoryGroup >::ConstIterator |
375 | appIt = mAppCats.find( app ); | 346 | appIt = mAppCats.find( app ); |
376 | if ( appIt == mAppCats.end() ) | 347 | if ( appIt == mAppCats.end() ) |
377 | return QString::null; | 348 | return QString::null; |
378 | return (*appIt).label( id ); | 349 | return (*appIt).label( id ); |
379 | } | 350 | } |
380 | 351 | ||
381 | QStringList Categories::labels( const QString & app, | ||
382 | const QArray<int> &catids ) const | ||
383 | { | ||
384 | QStringList strs = mGlobalCats.labels( catids ); | ||
385 | strs += mAppCats[app].labels( catids ); | ||
386 | return strs; | ||
387 | } | ||
388 | |||
389 | /** Returns a single string associated with the cat ids for display in | 352 | /** Returns a single string associated with the cat ids for display in |
390 | * a combobox or any area that requires one string. If catids are empty | 353 | * a combobox or any area that requires one string. If catids are empty |
391 | * then "Unfiled" will be returned. If multiple categories are assigned | 354 | * then "Unfiled" will be returned. If multiple categories are assigned |
392 | * the first cat id is shown with " (multi)" appended to the string. | 355 | * the first cat id is shown with " (multi)" appended to the string. |
393 | */ | 356 | */ |
394 | QString Categories::displaySingle( const QString &app, | 357 | QString Categories::displaySingle( const QString &app, |
395 | const QArray<int> &catids, | 358 | const QArray<int> &catids, |
396 | DisplaySingle display ) const | 359 | DisplaySingle display ) const |
@@ -412,43 +375,31 @@ QString Categories::displaySingle( const QString &app, | |||
412 | r = strs.join(" "); | 375 | r = strs.join(" "); |
413 | break; | 376 | break; |
414 | } | 377 | } |
415 | } | 378 | } |
416 | else r = strs.first(); | 379 | else r = strs.first(); |
417 | return r; | 380 | return r; |
418 | } | 381 | } |
419 | 382 | ||
420 | QArray<int> Categories::ids( const QString &app ) const | 383 | QArray<int> Categories::ids( const QString &app, const QStringList &labels) const |
421 | { | ||
422 | QArray<int> allIds = mGlobalCats.ids(); | ||
423 | QArray<int> appIds = mAppCats[app].ids(); | ||
424 | |||
425 | // we should make the guarentee that the ids are in the | ||
426 | // same order as the labels, (i.e. app cats then global) | ||
427 | // otherwise there is no point in having these two separate functions. | ||
428 | uint appSize = appIds.size(); | ||
429 | appIds.resize( appSize + allIds.size() ); | ||
430 | for ( uint i = appSize; i < appIds.size(); ++i ) | ||
431 | appIds[int(i)] = allIds[int(i - appSize)]; | ||
432 | |||
433 | return appIds; | ||
434 | } | ||
435 | |||
436 | QArray<int> Categories::ids( const QString &app, const QStringList &cats ) const | ||
437 | { | 384 | { |
438 | QArray<int> allIds = mGlobalCats.ids( cats ); | 385 | QArray<int> results; |
439 | QArray<int> appIds = mAppCats[app].ids( cats ); | 386 | QStringList::ConstIterator it; |
440 | 387 | int i; | |
441 | uint appSize = appIds.size(); | 388 | |
442 | appIds.resize( appSize + allIds.size() ); | 389 | for ( i=0, it=labels.begin(); it!=labels.end(); i++, ++it ) { |
443 | for ( uint i = appSize; i < appIds.size(); ++i ) | 390 | int value = id( app, *it ); |
444 | appIds[int(i)] = allIds[int(i - appSize)]; | 391 | if ( value != 0 ) { |
445 | 392 | int tmp = results.size(); | |
446 | return appIds; | 393 | results.resize( tmp + 1 ); |
394 | results[ tmp ] = value; | ||
395 | } | ||
396 | } | ||
397 | return results; | ||
447 | } | 398 | } |
448 | 399 | ||
449 | int Categories::id( const QString &app, const QString &cat ) const | 400 | int Categories::id( const QString &app, const QString &cat ) const |
450 | { | 401 | { |
451 | if ( cat == tr("Unfiled") || cat.contains( tr(" (multi.)") ) ) | 402 | if ( cat == tr("Unfiled") || cat.contains( tr(" (multi.)") ) ) |
452 | return 0; | 403 | return 0; |
453 | int uid = mGlobalCats.id( cat ); | 404 | int uid = mGlobalCats.id( cat ); |
454 | if ( uid != 0 ) | 405 | if ( uid != 0 ) |
@@ -534,55 +485,80 @@ bool Categories::exists( const QString &appname, | |||
534 | appIt = mAppCats.find( appname ); | 485 | appIt = mAppCats.find( appname ); |
535 | 486 | ||
536 | if ( appIt == mAppCats.end() ) | 487 | if ( appIt == mAppCats.end() ) |
537 | return FALSE; | 488 | return FALSE; |
538 | 489 | ||
539 | return (*appIt).contains( catname ); | 490 | return (*appIt).contains( catname ); |
540 | } | 491 | } |
541 | 492 | ||
493 | |||
542 | bool Categories::save( const QString &fname ) const | 494 | bool Categories::save( const QString &fname ) const |
543 | { | 495 | { |
544 | QFile file( fname ); | 496 | QString strNewFile = fname + ".new"; |
545 | if ( !file.open( IO_WriteOnly ) ) { | 497 | QFile f( strNewFile ); |
498 | QString out; | ||
499 | int total_written; | ||
500 | |||
501 | if ( !f.open( IO_WriteOnly|IO_Raw ) ) { | ||
546 | qWarning("Unable to write to %s", fname.latin1()); | 502 | qWarning("Unable to write to %s", fname.latin1()); |
547 | return FALSE; | 503 | return FALSE; |
548 | } | 504 | } |
549 | 505 | ||
550 | QTextStream ts( &file ); | 506 | out = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; |
551 | ts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; | 507 | out += "<!DOCTYPE CategoryList>\n"; |
552 | ts << "<!DOCTYPE CategoryList>" << endl; | 508 | |
509 | out += "<Categories>\n"; | ||
553 | 510 | ||
554 | ts << "<Categories>" << endl; | ||
555 | for ( QMap<int, QString>::ConstIterator git = mGlobalCats.idMap().begin(); | 511 | for ( QMap<int, QString>::ConstIterator git = mGlobalCats.idMap().begin(); |
556 | git != mGlobalCats.idMap().end(); ++git ) | 512 | git != mGlobalCats.idMap().end(); ++git ) |
557 | ts << "<Category id=\"" << git.key() << "\"" | 513 | out += "<Category id=\"" + QString::number(git.key()) + "\"" + |
558 | << " name=\"" << escapeString(*git) << "\" />" << endl; | 514 | " name=\"" + escapeString(*git) + "\" />\n"; |
559 | 515 | ||
560 | for ( QMap<QString, CategoryGroup>::ConstIterator appsIt=mAppCats.begin(); | 516 | for ( QMap<QString, CategoryGroup>::ConstIterator appsIt=mAppCats.begin(); |
561 | appsIt != mAppCats.end(); ++appsIt ) { | 517 | appsIt != mAppCats.end(); ++appsIt ) { |
562 | const QString &app = appsIt.key(); | 518 | const QString &app = appsIt.key(); |
563 | const QMap<int, QString> &appcats = (*appsIt).idMap(); | 519 | const QMap<int, QString> &appcats = (*appsIt).idMap(); |
564 | for ( QMap<int, QString>::ConstIterator appcatit = appcats.begin(); | 520 | for ( QMap<int, QString>::ConstIterator appcatit = appcats.begin(); |
565 | appcatit != appcats.end(); ++appcatit ) | 521 | appcatit != appcats.end(); ++appcatit ) |
566 | ts << "<Category id=\"" << appcatit.key() << "\"" | 522 | out += "<Category id=\"" + QString::number(appcatit.key()) + "\"" + |
567 | << " app=\"" << escapeString(app) << "\"" | 523 | " app=\"" + escapeString(app) + "\"" + |
568 | << " name=\"" << escapeString(*appcatit) << "\" />" << endl; | 524 | " name=\"" + escapeString(*appcatit) + "\" />\n"; |
525 | } | ||
526 | out += "</Categories>\n"; | ||
527 | |||
528 | QCString cstr = out.utf8(); | ||
529 | total_written = f.writeBlock( cstr.data(), cstr.length() ); | ||
530 | if ( total_written != int(cstr.length()) ) { | ||
531 | f.close(); | ||
532 | QFile::remove( strNewFile ); | ||
533 | return FALSE; | ||
534 | } | ||
535 | f.close(); | ||
536 | |||
537 | if ( ::rename( strNewFile.latin1(), fname.latin1() ) < 0 ) { | ||
538 | qWarning( "problem renaming file %s to %s", | ||
539 | strNewFile.latin1(), fname.latin1()); | ||
540 | // remove the tmp file... | ||
541 | QFile::remove( strNewFile ); | ||
569 | } | 542 | } |
570 | ts << "</Categories>" << endl; | ||
571 | 543 | ||
572 | file.close(); | ||
573 | return TRUE; | 544 | return TRUE; |
574 | } | 545 | } |
575 | 546 | ||
576 | bool Categories::load( const QString &fname ) | 547 | bool Categories::load( const QString &fname ) |
577 | { | 548 | { |
578 | QFile file( fname ); | 549 | QFile file( fname ); |
579 | if ( !file.open( IO_ReadOnly ) ) { | 550 | if ( !file.open( IO_ReadOnly ) ) { |
580 | qWarning("Unable to open %s", fname.latin1()); | 551 | qWarning("Unable to open %s", fname.latin1()); |
552 | |||
553 | addGlobalCategory(tr("Business")); | ||
554 | addGlobalCategory(tr("Personal")); | ||
555 | save(fname); | ||
556 | |||
581 | return FALSE; | 557 | return FALSE; |
582 | } | 558 | } |
583 | 559 | ||
584 | clear(); | 560 | clear(); |
585 | QByteArray ba = file.readAll(); | 561 | QByteArray ba = file.readAll(); |
586 | QString data = QString::fromUtf8( ba.data(), ba.size() ); | 562 | QString data = QString::fromUtf8( ba.data(), ba.size() ); |
587 | QChar *uc = (QChar *)data.unicode(); | 563 | QChar *uc = (QChar *)data.unicode(); |
588 | int len = data.length(); | 564 | int len = data.length(); |
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 | |||
@@ -66,18 +66,17 @@ public: | |||
66 | * not found | 66 | * not found |
67 | */ | 67 | */ |
68 | const QString &label(int id) const; | 68 | const QString &label(int id) const; |
69 | /** Returns the uid associated with label or 0 if not found */ | 69 | /** Returns the uid associated with label or 0 if not found */ |
70 | int id(const QString &label) const; | 70 | int id(const QString &label) const; |
71 | 71 | ||
72 | /** Returns a sorted list of labels */ | 72 | /** Returns a sorted list of labels */ |
73 | QStringList labels() const; | 73 | QStringList labels() const; |
74 | QArray<int> ids( const QStringList &cats ) const; | 74 | |
75 | QArray<int> ids() const; | ||
76 | QStringList labels( const QArray<int> &catids ) const; | 75 | QStringList labels( const QArray<int> &catids ) const; |
77 | 76 | ||
78 | const QMap<int, QString> &idMap() const { return mIdLabelMap; } | 77 | const QMap<int, QString> &idMap() const { return mIdLabelMap; } |
79 | 78 | ||
80 | private: | 79 | private: |
81 | void insert( int uid, const QString &label ); | 80 | void insert( int uid, const QString &label ); |
82 | QMap<int, QString> mIdLabelMap; | 81 | QMap<int, QString> mIdLabelMap; |
83 | QMap<QString, int> mLabelIdMap; | 82 | QMap<QString, int> mLabelIdMap; |
@@ -125,19 +124,18 @@ public: | |||
125 | * in the application, then it removes it from the global list | 124 | * in the application, then it removes it from the global list |
126 | */ | 125 | */ |
127 | bool removeCategory( const QString &appName, const QString &catName, | 126 | bool removeCategory( const QString &appName, const QString &catName, |
128 | bool checkGlobal = TRUE); | 127 | bool checkGlobal = TRUE); |
129 | bool removeCategory( const QString &appName, int uid ); | 128 | bool removeCategory( const QString &appName, int uid ); |
130 | bool removeGlobalCategory( const QString &catName ); | 129 | bool removeGlobalCategory( const QString &catName ); |
131 | bool removeGlobalCategory( int uid ); | 130 | bool removeGlobalCategory( int uid ); |
132 | 131 | ||
133 | QArray<int> ids( const QString &app ) const; | 132 | QArray<int> ids( const QString &app, const QStringList &labels) const; |
134 | QArray<int> ids( const QString &app, | 133 | |
135 | const QStringList &cats ) const; | ||
136 | /** Returns the id associated with the app */ | 134 | /** Returns the id associated with the app */ |
137 | int id( const QString &app, const QString &cat ) const; | 135 | int id( const QString &app, const QString &cat ) const; |
138 | /** Returns the label associated with the id */ | 136 | /** Returns the label associated with the id */ |
139 | QString label( const QString &app, int id ) const; | 137 | QString label( const QString &app, int id ) const; |
140 | 138 | ||
141 | enum ExtraLabels { NoExtra, AllUnfiled, AllLabel, UnfiledLabel }; | 139 | enum ExtraLabels { NoExtra, AllUnfiled, AllLabel, UnfiledLabel }; |
142 | /** Returns the sorted list of all categories that are | 140 | /** Returns the sorted list of all categories that are |
143 | * associated with the app. | 141 | * associated with the app. |
@@ -148,20 +146,16 @@ public: | |||
148 | * the list | 146 | * the list |
149 | * If extra = AllLabel, then All is prepended | 147 | * If extra = AllLabel, then All is prepended |
150 | * If extra = UnfiledLabel, then Unfiled is prepended | 148 | * If extra = UnfiledLabel, then Unfiled is prepended |
151 | */ | 149 | */ |
152 | QStringList labels( const QString &app, | 150 | QStringList labels( const QString &app, |
153 | bool includeGlobal = TRUE, | 151 | bool includeGlobal = TRUE, |
154 | ExtraLabels extra = NoExtra ) const; | 152 | ExtraLabels extra = NoExtra ) const; |
155 | 153 | ||
156 | /** Returns the labels of the categories associated with the uids */ | ||
157 | QStringList labels( const QString & app, | ||
158 | const QArray<int> &catids ) const; | ||
159 | |||
160 | enum DisplaySingle { ShowMulti, ShowAll, ShowFirst }; | 154 | enum DisplaySingle { ShowMulti, ShowAll, ShowFirst }; |
161 | 155 | ||
162 | /** Returns a single string associated with the cat ids for display in | 156 | /** Returns a single string associated with the cat ids for display in |
163 | * a combobox or any area that requires one string. If catids are empty | 157 | * a combobox or any area that requires one string. If catids are empty |
164 | * then "Unfiled" will be returned. If multiple categories are assigned | 158 | * then "Unfiled" will be returned. If multiple categories are assigned |
165 | * then the behavior depends on the DisplaySingle type. | 159 | * then the behavior depends on the DisplaySingle type. |
166 | * If /a display is set to ShowMulti then " (multi)" appended to the | 160 | * If /a display is set to ShowMulti then " (multi)" appended to the |
167 | * first string. If /a display is set to ShowAll, then a space seperated | 161 | * first string. If /a display is set to ShowAll, then a space seperated |
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 | |||
@@ -13,19 +13,21 @@ | |||
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define QTOPIA_INTERNAL_CONTACT_MRE | ||
22 | |||
21 | #include "contact.h" | 23 | #include "contact.h" |
22 | #include "vobject_p.h" | 24 | #include "vobject_p.h" |
23 | #include "qfiledirect_p.h" | 25 | #include "qfiledirect_p.h" |
24 | 26 | ||
25 | #include <qpe/stringutil.h> | 27 | #include <qpe/stringutil.h> |
26 | #include <qpe/timeconversion.h> | 28 | #include <qpe/timeconversion.h> |
27 | 29 | ||
28 | #include <qobject.h> | 30 | #include <qobject.h> |
29 | #include <qregexp.h> | 31 | #include <qregexp.h> |
30 | #include <qstylesheet.h> | 32 | #include <qstylesheet.h> |
31 | #include <qfileinfo.h> | 33 | #include <qfileinfo.h> |
@@ -381,109 +383,117 @@ QStringList Contact::fields() | |||
381 | 383 | ||
382 | list.append( "Title" ); // Not Used! | 384 | list.append( "Title" ); // Not Used! |
383 | list.append( "FirstName" ); | 385 | list.append( "FirstName" ); |
384 | list.append( "MiddleName" ); | 386 | list.append( "MiddleName" ); |
385 | list.append( "LastName" ); | 387 | list.append( "LastName" ); |
386 | list.append( "Suffix" ); | 388 | list.append( "Suffix" ); |
387 | list.append( "FileAs" ); | 389 | list.append( "FileAs" ); |
388 | 390 | ||
391 | list.append( "JobTitle" ); | ||
392 | list.append( "Department" ); | ||
393 | list.append( "Company" ); | ||
394 | list.append( "BusinessPhone" ); | ||
395 | list.append( "BusinessFax" ); | ||
396 | list.append( "BusinessMobile" ); | ||
397 | |||
389 | list.append( "DefaultEmail" ); | 398 | list.append( "DefaultEmail" ); |
390 | list.append( "Emails" ); | 399 | list.append( "Emails" ); |
391 | 400 | ||
392 | list.append( "HomeStreet" ); | ||
393 | list.append( "HomeCity" ); | ||
394 | list.append( "HomeState" ); | ||
395 | list.append( "HomeZip" ); | ||
396 | list.append( "HomeCountry" ); | ||
397 | list.append( "HomePhone" ); | 401 | list.append( "HomePhone" ); |
398 | list.append( "HomeFax" ); | 402 | list.append( "HomeFax" ); |
399 | list.append( "HomeMobile" ); | 403 | list.append( "HomeMobile" ); |
400 | list.append( "HomeWebPage" ); | ||
401 | 404 | ||
402 | list.append( "Company" ); | ||
403 | list.append( "BusinessStreet" ); | 405 | list.append( "BusinessStreet" ); |
404 | list.append( "BusinessCity" ); | 406 | list.append( "BusinessCity" ); |
405 | list.append( "BusinessState" ); | 407 | list.append( "BusinessState" ); |
406 | list.append( "BusinessZip" ); | 408 | list.append( "BusinessZip" ); |
407 | list.append( "BusinessCountry" ); | 409 | list.append( "BusinessCountry" ); |
410 | list.append( "BusinessPager" ); | ||
408 | list.append( "BusinessWebPage" ); | 411 | list.append( "BusinessWebPage" ); |
409 | list.append( "JobTitle" ); | 412 | |
410 | list.append( "Department" ); | ||
411 | list.append( "Office" ); | 413 | list.append( "Office" ); |
412 | list.append( "BusinessPhone" ); | ||
413 | list.append( "BusinessFax" ); | ||
414 | list.append( "BusinessMobile" ); | ||
415 | list.append( "BusinessPager" ); | ||
416 | list.append( "Profession" ); | 414 | list.append( "Profession" ); |
417 | list.append( "Assistant" ); | 415 | list.append( "Assistant" ); |
418 | list.append( "Manager" ); | 416 | list.append( "Manager" ); |
419 | 417 | ||
418 | list.append( "HomeStreet" ); | ||
419 | list.append( "HomeCity" ); | ||
420 | list.append( "HomeState" ); | ||
421 | list.append( "HomeZip" ); | ||
422 | list.append( "HomeCountry" ); | ||
423 | list.append( "HomeWebPage" ); | ||
424 | |||
420 | list.append( "Spouse" ); | 425 | list.append( "Spouse" ); |
421 | list.append( "Gender" ); | 426 | list.append( "Gender" ); |
422 | list.append( "Birthday" ); | 427 | list.append( "Birthday" ); |
423 | list.append( "Anniversary" ); | 428 | list.append( "Anniversary" ); |
424 | list.append( "Nickname" ); | 429 | list.append( "Nickname" ); |
425 | |||
426 | list.append( "Children" ); | 430 | list.append( "Children" ); |
431 | |||
427 | list.append( "Notes" ); | 432 | list.append( "Notes" ); |
433 | list.append( "Groups" ); | ||
428 | 434 | ||
429 | return list; | 435 | return list; |
430 | } | 436 | } |
431 | 437 | ||
432 | QStringList Contact::trfields() | 438 | QStringList Contact::trfields() |
433 | { | 439 | { |
434 | QStringList list; | 440 | QStringList list; |
435 | 441 | ||
436 | list.append( QObject::tr( "Name Title") ); | 442 | list.append( QObject::tr( "Name Title") ); |
437 | list.append( QObject::tr( "First Name" ) ); | 443 | list.append( QObject::tr( "First Name" ) ); |
438 | list.append( QObject::tr( "Middle Name" ) ); | 444 | list.append( QObject::tr( "Middle Name" ) ); |
439 | list.append( QObject::tr( "Last Name" ) ); | 445 | list.append( QObject::tr( "Last Name" ) ); |
440 | list.append( QObject::tr( "Suffix" ) ); | 446 | list.append( QObject::tr( "Suffix" ) ); |
441 | list.append( QObject::tr( "File As" ) ); | 447 | list.append( QObject::tr( "File As" ) ); |
442 | 448 | ||
449 | list.append( QObject::tr( "Job Title" ) ); | ||
450 | list.append( QObject::tr( "Department" ) ); | ||
451 | list.append( QObject::tr( "Company" ) ); | ||
452 | list.append( QObject::tr( "Business Phone" ) ); | ||
453 | list.append( QObject::tr( "Business Fax" ) ); | ||
454 | list.append( QObject::tr( "Business Mobile" ) ); | ||
455 | |||
443 | list.append( QObject::tr( "Default Email" ) ); | 456 | list.append( QObject::tr( "Default Email" ) ); |
444 | list.append( QObject::tr( "Emails" ) ); | 457 | list.append( QObject::tr( "Emails" ) ); |
445 | 458 | ||
446 | list.append( QObject::tr( "Home Street" ) ); | ||
447 | list.append( QObject::tr( "Home City" ) ); | ||
448 | list.append( QObject::tr( "Home State" ) ); | ||
449 | list.append( QObject::tr( "Home Zip" ) ); | ||
450 | list.append( QObject::tr( "Home Country" ) ); | ||
451 | list.append( QObject::tr( "Home Phone" ) ); | 459 | list.append( QObject::tr( "Home Phone" ) ); |
452 | list.append( QObject::tr( "Home Fax" ) ); | 460 | list.append( QObject::tr( "Home Fax" ) ); |
453 | list.append( QObject::tr( "Home Mobile" ) ); | 461 | list.append( QObject::tr( "Home Mobile" ) ); |
454 | list.append( QObject::tr( "Home Web Page" ) ); | ||
455 | 462 | ||
456 | list.append( QObject::tr( "Company" ) ); | ||
457 | list.append( QObject::tr( "Business Street" ) ); | 463 | list.append( QObject::tr( "Business Street" ) ); |
458 | list.append( QObject::tr( "Business City" ) ); | 464 | list.append( QObject::tr( "Business City" ) ); |
459 | list.append( QObject::tr( "Business State" ) ); | 465 | list.append( QObject::tr( "Business State" ) ); |
460 | list.append( QObject::tr( "Business Zip" ) ); | 466 | list.append( QObject::tr( "Business Zip" ) ); |
461 | list.append( QObject::tr( "Business Country" ) ); | 467 | list.append( QObject::tr( "Business Country" ) ); |
468 | list.append( QObject::tr( "Business Pager" ) ); | ||
462 | list.append( QObject::tr( "Business WebPage" ) ); | 469 | list.append( QObject::tr( "Business WebPage" ) ); |
463 | list.append( QObject::tr( "Job Title" ) ); | 470 | |
464 | list.append( QObject::tr( "Department" ) ); | ||
465 | list.append( QObject::tr( "Office" ) ); | 471 | list.append( QObject::tr( "Office" ) ); |
466 | list.append( QObject::tr( "Business Phone" ) ); | ||
467 | list.append( QObject::tr( "Business Fax" ) ); | ||
468 | list.append( QObject::tr( "Business Mobile" ) ); | ||
469 | list.append( QObject::tr( "Business Pager" ) ); | ||
470 | list.append( QObject::tr( "Profession" ) ); | 472 | list.append( QObject::tr( "Profession" ) ); |
471 | list.append( QObject::tr( "Assistant" ) ); | 473 | list.append( QObject::tr( "Assistant" ) ); |
472 | list.append( QObject::tr( "Manager" ) ); | 474 | list.append( QObject::tr( "Manager" ) ); |
473 | 475 | ||
476 | list.append( QObject::tr( "Home Street" ) ); | ||
477 | list.append( QObject::tr( "Home City" ) ); | ||
478 | list.append( QObject::tr( "Home State" ) ); | ||
479 | list.append( QObject::tr( "Home Zip" ) ); | ||
480 | list.append( QObject::tr( "Home Country" ) ); | ||
481 | list.append( QObject::tr( "Home Web Page" ) ); | ||
482 | |||
474 | list.append( QObject::tr( "Spouse" ) ); | 483 | list.append( QObject::tr( "Spouse" ) ); |
475 | list.append( QObject::tr( "Gender" ) ); | 484 | list.append( QObject::tr( "Gender" ) ); |
476 | list.append( QObject::tr( "Birthday" ) ); | 485 | list.append( QObject::tr( "Birthday" ) ); |
477 | list.append( QObject::tr( "Anniversary" ) ); | 486 | list.append( QObject::tr( "Anniversary" ) ); |
478 | list.append( QObject::tr( "Nickname" ) ); | 487 | list.append( QObject::tr( "Nickname" ) ); |
479 | |||
480 | list.append( QObject::tr( "Children" ) ); | 488 | list.append( QObject::tr( "Children" ) ); |
489 | |||
481 | list.append( QObject::tr( "Notes" ) ); | 490 | list.append( QObject::tr( "Notes" ) ); |
491 | list.append( QObject::tr( "Groups" ) ); | ||
482 | 492 | ||
483 | return list; | 493 | return list; |
484 | } | 494 | } |
485 | 495 | ||
486 | void Contact::setEmails( const QString &v ) | 496 | void Contact::setEmails( const QString &v ) |
487 | { | 497 | { |
488 | replace( Qtopia::Emails, v ); | 498 | replace( Qtopia::Emails, v ); |
489 | if ( v.isEmpty() ) | 499 | if ( v.isEmpty() ) |
@@ -624,17 +634,17 @@ static Contact parseVObject( VObject *obj ) | |||
624 | VObject *o = nextVObject( &it ); | 634 | VObject *o = nextVObject( &it ); |
625 | QCString name = vObjectName( o ); | 635 | QCString name = vObjectName( o ); |
626 | QCString value = vObjectStringZValue( o ); | 636 | QCString value = vObjectStringZValue( o ); |
627 | if ( name == VCNameProp ) { | 637 | if ( name == VCNameProp ) { |
628 | VObjectIterator nit; | 638 | VObjectIterator nit; |
629 | initPropIterator( &nit, o ); | 639 | initPropIterator( &nit, o ); |
630 | while( moreIteration( &nit ) ) { | 640 | while( moreIteration( &nit ) ) { |
631 | VObject *o = nextVObject( &nit ); | 641 | VObject *o = nextVObject( &nit ); |
632 | QCString name = vObjectName( o ); | 642 | QCString name = vObjectTypeInfo( o ); |
633 | QString value = vObjectStringZValue( o ); | 643 | QString value = vObjectStringZValue( o ); |
634 | if ( name == VCNamePrefixesProp ) | 644 | if ( name == VCNamePrefixesProp ) |
635 | c.setTitle( value ); | 645 | c.setTitle( value ); |
636 | else if ( name == VCNameSuffixesProp ) | 646 | else if ( name == VCNameSuffixesProp ) |
637 | c.setSuffix( value ); | 647 | c.setSuffix( value ); |
638 | else if ( name == VCFamilyNameProp ) | 648 | else if ( name == VCFamilyNameProp ) |
639 | c.setLastName( value ); | 649 | c.setLastName( value ); |
640 | else if ( name == VCGivenNameProp ) | 650 | else if ( name == VCGivenNameProp ) |
@@ -697,17 +707,17 @@ static Contact parseVObject( VObject *obj ) | |||
697 | UNKNOWN = 0x80 | 707 | UNKNOWN = 0x80 |
698 | }; | 708 | }; |
699 | int type = 0; | 709 | int type = 0; |
700 | 710 | ||
701 | VObjectIterator nit; | 711 | VObjectIterator nit; |
702 | initPropIterator( &nit, o ); | 712 | initPropIterator( &nit, o ); |
703 | while( moreIteration( &nit ) ) { | 713 | while( moreIteration( &nit ) ) { |
704 | VObject *o = nextVObject( &nit ); | 714 | VObject *o = nextVObject( &nit ); |
705 | QCString name = vObjectName( o ); | 715 | QCString name = vObjectTypeInfo( o ); |
706 | if ( name == VCHomeProp ) | 716 | if ( name == VCHomeProp ) |
707 | type |= HOME; | 717 | type |= HOME; |
708 | else if ( name == VCWorkProp ) | 718 | else if ( name == VCWorkProp ) |
709 | type |= WORK; | 719 | type |= WORK; |
710 | else if ( name == VCVoiceProp ) | 720 | else if ( name == VCVoiceProp ) |
711 | type |= VOICE; | 721 | type |= VOICE; |
712 | else if ( name == VCCellularProp ) | 722 | else if ( name == VCCellularProp ) |
713 | type |= CELL; | 723 | type |= CELL; |
@@ -744,17 +754,17 @@ static Contact parseVObject( VObject *obj ) | |||
744 | } | 754 | } |
745 | else if ( name == VCEmailAddressProp ) { | 755 | else if ( name == VCEmailAddressProp ) { |
746 | QString email = vObjectStringZValue( o ); | 756 | QString email = vObjectStringZValue( o ); |
747 | bool valid = TRUE; | 757 | bool valid = TRUE; |
748 | VObjectIterator nit; | 758 | VObjectIterator nit; |
749 | initPropIterator( &nit, o ); | 759 | initPropIterator( &nit, o ); |
750 | while( moreIteration( &nit ) ) { | 760 | while( moreIteration( &nit ) ) { |
751 | VObject *o = nextVObject( &nit ); | 761 | VObject *o = nextVObject( &nit ); |
752 | QCString name = vObjectName( o ); | 762 | QCString name = vObjectTypeInfo( o ); |
753 | if ( name != VCInternetProp && name != VCHomeProp && | 763 | if ( name != VCInternetProp && name != VCHomeProp && |
754 | name != VCWorkProp && | 764 | name != VCWorkProp && |
755 | name != VCPreferredProp ) | 765 | name != VCPreferredProp ) |
756 | // ### preffered should map to default email | 766 | // ### preffered should map to default email |
757 | valid = FALSE; | 767 | valid = FALSE; |
758 | } | 768 | } |
759 | if ( valid ) { | 769 | if ( valid ) { |
760 | if ( haveDefaultEmail ) { | 770 | if ( haveDefaultEmail ) { |
@@ -767,17 +777,17 @@ static Contact parseVObject( VObject *obj ) | |||
767 | } | 777 | } |
768 | } | 778 | } |
769 | } | 779 | } |
770 | else if ( name == VCURLProp ) { | 780 | else if ( name == VCURLProp ) { |
771 | VObjectIterator nit; | 781 | VObjectIterator nit; |
772 | initPropIterator( &nit, o ); | 782 | initPropIterator( &nit, o ); |
773 | while( moreIteration( &nit ) ) { | 783 | while( moreIteration( &nit ) ) { |
774 | VObject *o = nextVObject( &nit ); | 784 | VObject *o = nextVObject( &nit ); |
775 | QCString name = vObjectName( o ); | 785 | QCString name = vObjectTypeInfo( o ); |
776 | if ( name == VCHomeProp ) | 786 | if ( name == VCHomeProp ) |
777 | c.setHomeWebpage( value ); | 787 | c.setHomeWebpage( value ); |
778 | else if ( name == VCWorkProp ) | 788 | else if ( name == VCWorkProp ) |
779 | c.setBusinessWebpage( value ); | 789 | c.setBusinessWebpage( value ); |
780 | } | 790 | } |
781 | } | 791 | } |
782 | else if ( name == VCOrgProp ) { | 792 | else if ( name == VCOrgProp ) { |
783 | VObjectIterator nit; | 793 | VObjectIterator nit; |
@@ -837,39 +847,39 @@ static Contact parseVObject( VObject *obj ) | |||
837 | } | 847 | } |
838 | #endif | 848 | #endif |
839 | } | 849 | } |
840 | c.setFileAs(); | 850 | c.setFileAs(); |
841 | return c; | 851 | return c; |
842 | } | 852 | } |
843 | 853 | ||
844 | void Contact::writeVCard( const QString &filename, const QValueList<Contact> &contacts) | 854 | void Contact::writeVCard( const QString &filename, const QValueList<Contact> &contacts) |
845 | { | 855 | { |
846 | QFileDirect f( filename.utf8().data() ); | 856 | QFileDirect f( filename.utf8().data() ); |
847 | if ( !f.open( IO_WriteOnly ) ) { | 857 | if ( !f.open( IO_WriteOnly ) ) { |
848 | qWarning("Unable to open vcard write"); | 858 | qWarning("Unable to open vcard write"); |
849 | return; | 859 | return; |
850 | } | 860 | } |
851 | 861 | ||
852 | QValueList<Contact>::ConstIterator it; | 862 | QValueList<Contact>::ConstIterator it; |
853 | for( it = contacts.begin(); it != contacts.end(); ++it ) { | 863 | for( it = contacts.begin(); it != contacts.end(); ++it ) { |
854 | VObject *obj = createVObject( *it ); | 864 | VObject *obj = createVObject( *it ); |
855 | writeVObject(f.directHandle() , obj ); | 865 | writeVObject(f.directHandle() , obj ); |
856 | cleanVObject( obj ); | 866 | cleanVObject( obj ); |
857 | } | 867 | } |
858 | cleanStrTbl(); | 868 | cleanStrTbl(); |
859 | } | 869 | } |
860 | 870 | ||
861 | void Contact::writeVCard( const QString &filename, const Contact &contact) | 871 | void Contact::writeVCard( const QString &filename, const Contact &contact) |
862 | { | 872 | { |
863 | QFileDirect f( filename.utf8().data() ); | 873 | QFileDirect f( filename.utf8().data() ); |
864 | if ( !f.open( IO_WriteOnly ) ) { | 874 | if ( !f.open( IO_WriteOnly ) ) { |
865 | qWarning("Unable to open vcard write"); | 875 | qWarning("Unable to open vcard write"); |
866 | return; | 876 | return; |
867 | } | 877 | } |
868 | 878 | ||
869 | VObject *obj = createVObject( contact ); | 879 | VObject *obj = createVObject( contact ); |
870 | writeVObject( f.directHandle() , obj ); | 880 | writeVObject( f.directHandle() , obj ); |
871 | cleanVObject( obj ); | 881 | cleanVObject( obj ); |
872 | 882 | ||
873 | cleanStrTbl(); | 883 | cleanStrTbl(); |
874 | } | 884 | } |
875 | 885 | ||
@@ -889,16 +899,21 @@ QValueList<Contact> Contact::readVCard( const QString &filename ) | |||
889 | VObject *t = obj; | 899 | VObject *t = obj; |
890 | obj = nextVObjectInList(obj); | 900 | obj = nextVObjectInList(obj); |
891 | cleanVObject( t ); | 901 | cleanVObject( t ); |
892 | } | 902 | } |
893 | 903 | ||
894 | return contacts; | 904 | return contacts; |
895 | } | 905 | } |
896 | 906 | ||
907 | bool Contact::match( const QString ®exp ) const | ||
908 | { | ||
909 | return match(QRegExp(regexp)); | ||
910 | } | ||
911 | |||
897 | bool Contact::match( const QRegExp &r ) const | 912 | bool Contact::match( const QRegExp &r ) const |
898 | { | 913 | { |
899 | bool match; | 914 | bool match; |
900 | match = false; | 915 | match = false; |
901 | QMap<int, QString>::ConstIterator it; | 916 | QMap<int, QString>::ConstIterator it; |
902 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { | 917 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { |
903 | if ( (*it).find( r ) > -1 ) { | 918 | if ( (*it).find( r ) > -1 ) { |
904 | match = true; | 919 | match = true; |
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 | |||
@@ -96,17 +96,22 @@ public: | |||
96 | void setBirthday( const QString &v ) { replace( Qtopia::Birthday, v ); } | 96 | void setBirthday( const QString &v ) { replace( Qtopia::Birthday, v ); } |
97 | void setAnniversary( const QString &v ) { replace( Qtopia::Anniversary, v ); } | 97 | void setAnniversary( const QString &v ) { replace( Qtopia::Anniversary, v ); } |
98 | void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); } | 98 | void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); } |
99 | void setChildren( const QString &v ); | 99 | void setChildren( const QString &v ); |
100 | 100 | ||
101 | // other | 101 | // other |
102 | void setNotes( const QString &v ) { replace( Qtopia::Notes, v); } | 102 | void setNotes( const QString &v ) { replace( Qtopia::Notes, v); } |
103 | 103 | ||
104 | bool match( const QRegExp &r ) const; | 104 | bool match( const QString ®exp ) const; |
105 | |||
106 | // DON'T ATTEMPT TO USE THIS | ||
107 | #ifdef QTOPIA_INTERNAL_CONTACT_MRE | ||
108 | bool match( const QRegExp ®exp ) const; | ||
109 | #endif | ||
105 | 110 | ||
106 | // // custom | 111 | // // custom |
107 | // void setCustomField( const QString &key, const QString &v ) | 112 | // void setCustomField( const QString &key, const QString &v ) |
108 | // { replace(Custom- + key, v ); } | 113 | // { replace(Custom- + key, v ); } |
109 | 114 | ||
110 | // name | 115 | // name |
111 | QString fullName() const; | 116 | QString fullName() const; |
112 | QString title() const { return find( Qtopia::Title ); } | 117 | QString title() const { return find( Qtopia::Title ); } |
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 | |||
@@ -135,17 +135,22 @@ private: | |||
135 | bool endTimeDirty : 1; | 135 | bool endTimeDirty : 1; |
136 | time_t startUTC, endUTC; | 136 | time_t startUTC, endUTC; |
137 | QString tz; | 137 | QString tz; |
138 | bool hAlarm, hRepeat; | 138 | bool hAlarm, hRepeat; |
139 | int aMinutes; | 139 | int aMinutes; |
140 | SoundTypeChoice aSound; | 140 | SoundTypeChoice aSound; |
141 | RepeatPattern pattern; | 141 | RepeatPattern pattern; |
142 | QString note; | 142 | QString note; |
143 | // ADDITION | ||
144 | int mRid;// Recode ID | ||
145 | int mRinfo;// Recode Info | ||
146 | // | ||
143 | EventPrivate *d; | 147 | EventPrivate *d; |
148 | |||
144 | }; | 149 | }; |
145 | 150 | ||
146 | // Since an event spans multiple day, it is better to have this | 151 | // Since an event spans multiple day, it is better to have this |
147 | // class to represent a day instead of creating many | 152 | // class to represent a day instead of creating many |
148 | // dummy events... | 153 | // dummy events... |
149 | 154 | ||
150 | class EffectiveEventPrivate; | 155 | class EffectiveEventPrivate; |
151 | class QPC_EXPORT EffectiveEvent | 156 | class QPC_EXPORT EffectiveEvent |
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 | |||
@@ -26,81 +26,92 @@ | |||
26 | namespace Qtopia | 26 | namespace Qtopia |
27 | { | 27 | { |
28 | static const int UID_ID = 0; | 28 | static const int UID_ID = 0; |
29 | static const int CATEGORY_ID = 1; | 29 | static const int CATEGORY_ID = 1; |
30 | 30 | ||
31 | enum AddressBookFields { | 31 | enum AddressBookFields { |
32 | AddressUid = UID_ID, | 32 | AddressUid = UID_ID, |
33 | AddressCategory = CATEGORY_ID, | 33 | AddressCategory = CATEGORY_ID, |
34 | 34 | ||
35 | // NOTE: Order of fields dependency in backend/contact.cpp | ||
36 | |||
35 | Title, | 37 | Title, |
36 | FirstName, | 38 | FirstName, |
37 | MiddleName, | 39 | MiddleName, |
38 | LastName, | 40 | LastName, |
39 | Suffix, | 41 | Suffix, |
40 | FileAs, | 42 | FileAs, |
41 | 43 | ||
44 | JobTitle, | ||
45 | Department, | ||
46 | Company, | ||
47 | BusinessPhone, | ||
48 | BusinessFax, | ||
49 | BusinessMobile, | ||
50 | |||
42 | 51 | ||
43 | DefaultEmail, | 52 | DefaultEmail, |
44 | Emails, | 53 | Emails, |
45 | 54 | ||
46 | // home | ||
47 | HomeStreet, | ||
48 | HomeCity, | ||
49 | HomeState, | ||
50 | HomeZip, | ||
51 | HomeCountry, | ||
52 | HomePhone, | 55 | HomePhone, |
53 | HomeFax, | 56 | HomeFax, |
54 | HomeMobile, | 57 | HomeMobile, |
55 | HomeWebPage, | ||
56 | 58 | ||
57 | // business | 59 | // business |
58 | Company, | ||
59 | BusinessStreet, | 60 | BusinessStreet, |
60 | BusinessCity, | 61 | BusinessCity, |
61 | BusinessState, | 62 | BusinessState, |
62 | BusinessZip, | 63 | BusinessZip, |
63 | BusinessCountry, | 64 | BusinessCountry, |
65 | BusinessPager, | ||
64 | BusinessWebPage, | 66 | BusinessWebPage, |
65 | JobTitle, | 67 | |
66 | Department, | ||
67 | Office, | 68 | Office, |
68 | BusinessPhone, | ||
69 | BusinessFax, | ||
70 | BusinessMobile, | ||
71 | BusinessPager, | ||
72 | Profession, | 69 | Profession, |
73 | Assistant, | 70 | Assistant, |
74 | Manager, | 71 | Manager, |
75 | 72 | ||
73 | // home | ||
74 | HomeStreet, | ||
75 | HomeCity, | ||
76 | HomeState, | ||
77 | HomeZip, | ||
78 | HomeCountry, | ||
79 | HomeWebPage, | ||
80 | |||
76 | //personal | 81 | //personal |
77 | Spouse, | 82 | Spouse, |
78 | Gender, | 83 | Gender, |
79 | Birthday, | 84 | Birthday, |
80 | Anniversary, | 85 | Anniversary, |
81 | Nickname, | 86 | Nickname, |
82 | Children, | 87 | Children, |
83 | 88 | ||
84 | // other | 89 | // other |
85 | Notes, | 90 | Notes, |
86 | Groups | 91 | Groups |
92 | |||
93 | ,rid, | ||
94 | rinfo | ||
87 | }; | 95 | }; |
88 | 96 | ||
89 | // dataset = "todolist" | 97 | // dataset = "todolist" |
90 | enum TaskFields { | 98 | enum TaskFields { |
91 | TaskUid = UID_ID, | 99 | TaskUid = UID_ID, |
92 | TaskCategory = CATEGORY_ID, | 100 | TaskCategory = CATEGORY_ID, |
93 | 101 | ||
94 | HasDate, | 102 | HasDate, |
95 | Completed, | 103 | Completed, |
96 | TaskDescription, | 104 | TaskDescription, |
97 | Priority, | 105 | Priority, |
98 | Date | 106 | Date, |
107 | |||
108 | TaskRid, | ||
109 | TaskRinfo | ||
99 | }; | 110 | }; |
100 | 111 | ||
101 | // dataset = "categories" for todos | 112 | // dataset = "categories" for todos |
102 | enum CategoryFields { | 113 | enum CategoryFields { |
103 | CatUid = UID_ID, | 114 | CatUid = UID_ID, |
104 | CatName, | 115 | CatName, |
105 | CatAppGroup | 116 | CatAppGroup |
106 | }; | 117 | }; |
@@ -123,13 +134,16 @@ namespace Qtopia | |||
123 | AlarmTime, | 134 | AlarmTime, |
124 | 135 | ||
125 | RepeatPatternType, | 136 | RepeatPatternType, |
126 | RepeatPatternFrequency, | 137 | RepeatPatternFrequency, |
127 | RepeatPatternPosition, | 138 | RepeatPatternPosition, |
128 | RepeatPatternDays, | 139 | RepeatPatternDays, |
129 | RepeatPatternHasEndDate, | 140 | RepeatPatternHasEndDate, |
130 | RepeatPatternEndDate, | 141 | RepeatPatternEndDate, |
142 | |||
143 | DateBookRid, | ||
144 | DateBookRinfo | ||
131 | }; | 145 | }; |
132 | }; | 146 | }; |
133 | 147 | ||
134 | 148 | ||
135 | #endif | 149 | #endif |
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 | |||
@@ -67,11 +67,15 @@ private: | |||
67 | static Qtopia::UidGen sUidGen; | 67 | static Qtopia::UidGen sUidGen; |
68 | 68 | ||
69 | bool mDue; | 69 | bool mDue; |
70 | QDate mDueDate; | 70 | QDate mDueDate; |
71 | bool mCompleted; | 71 | bool mCompleted; |
72 | int mPriority; | 72 | int mPriority; |
73 | QString mDesc; | 73 | QString mDesc; |
74 | TaskPrivate *d; | 74 | TaskPrivate *d; |
75 | // ADDITION | ||
76 | int recordId; | ||
77 | int recordInfo; | ||
78 | // | ||
75 | }; | 79 | }; |
76 | 80 | ||
77 | #endif | 81 | #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 | |||
@@ -1202,9 +1202,18 @@ DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list) | |||
1202 | } | 1202 | } |
1203 | 1203 | ||
1204 | while (list) { | 1204 | while (list) { |
1205 | writeVObject(f.directHandle(),list); | 1205 | writeVObject(f.directHandle(),list); |
1206 | list = nextVObjectInList(list); | 1206 | list = nextVObjectInList(list); |
1207 | } | 1207 | } |
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | DLLEXPORT(const char *) vObjectTypeInfo(VObject *o) | ||
1211 | { | ||
1212 | const char *type = vObjectName( o ); | ||
1213 | if ( strcmp( type, "TYPE" ) == 0 ) | ||
1214 | type = vObjectStringZValue( o ); | ||
1215 | return type; | ||
1216 | } | ||
1217 | |||
1218 | |||
1210 | // end of source file vobject.c | 1219 | // 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 | |||
@@ -391,11 +391,14 @@ will get a link error. | |||
391 | 391 | ||
392 | 392 | ||
393 | #if INCLUDEMFC | 393 | #if INCLUDEMFC |
394 | extern VObject* Parse_MIME_FromFile(CFile *file); | 394 | extern VObject* Parse_MIME_FromFile(CFile *file); |
395 | #else | 395 | #else |
396 | extern VObject* Parse_MIME_FromFile(FILE *file); | 396 | extern VObject* Parse_MIME_FromFile(FILE *file); |
397 | #endif | 397 | #endif |
398 | 398 | ||
399 | extern DLLEXPORT(const char *) vObjectTypeInfo(VObject *o); | ||
400 | |||
401 | |||
399 | #endif /* __VOBJECT_H__ */ | 402 | #endif /* __VOBJECT_H__ */ |
400 | 403 | ||
401 | 404 | ||
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 | |||
@@ -70,19 +70,21 @@ CategoryEdit::CategoryEdit( const QArray<int> &recCats, | |||
70 | 70 | ||
71 | void CategoryEdit::setCategories( const QArray<int> &recCats, | 71 | void CategoryEdit::setCategories( const QArray<int> &recCats, |
72 | const QString &appName, const QString &visibleName ) | 72 | const QString &appName, const QString &visibleName ) |
73 | { | 73 | { |
74 | if ( !d ) | 74 | if ( !d ) |
75 | d = new CategoryEditPrivate( (QWidget*)parent(), name() ); | 75 | d = new CategoryEditPrivate( (QWidget*)parent(), name() ); |
76 | d->mStrApp = appName; | 76 | d->mStrApp = appName; |
77 | d->mVisible = visibleName; | 77 | d->mVisible = visibleName; |
78 | QArray<int> cats = d->mCategories.ids( d->mStrApp ); | 78 | |
79 | lvView->clear(); | ||
80 | QStringList appCats = d->mCategories.labels( d->mStrApp ); | 79 | QStringList appCats = d->mCategories.labels( d->mStrApp ); |
80 | QArray<int> cats = d->mCategories.ids(d->mStrApp, appCats); | ||
81 | lvView->clear(); | ||
82 | |||
81 | QStringList::ConstIterator it; | 83 | QStringList::ConstIterator it; |
82 | int i, j; | 84 | int i, j; |
83 | for ( i = 0, it = appCats.begin(); it != appCats.end(); i++, ++it ) { | 85 | for ( i = 0, it = appCats.begin(); it != appCats.end(); i++, ++it ) { |
84 | QCheckListItem *chk; | 86 | QCheckListItem *chk; |
85 | chk = new QCheckListItem( lvView, (*it), QCheckListItem::CheckBox ); | 87 | chk = new QCheckListItem( lvView, (*it), QCheckListItem::CheckBox ); |
86 | if ( !d->mCategories.isGlobal((*it)) ) | 88 | if ( !d->mCategories.isGlobal((*it)) ) |
87 | chk->setText( 1, tr(d->mVisible) ); | 89 | chk->setText( 1, tr(d->mVisible) ); |
88 | else | 90 | else |
diff --git a/library/categoryselect.cpp b/library/categoryselect.cpp index dc5d1fa..21b3f91 100644 --- a/library/categoryselect.cpp +++ b/library/categoryselect.cpp | |||
@@ -14,24 +14,34 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <qpe/categories.h> | 21 | #include <qpe/categories.h> |
22 | #include <qpe/palmtoprecord.h> | ||
22 | 23 | ||
23 | #include <qdialog.h> | 24 | #include <qmessagebox.h> |
24 | #include <qlayout.h> | 25 | #include <qlayout.h> |
25 | #include <qtoolbutton.h> | 26 | #include <qtoolbutton.h> |
27 | #include <qfile.h> | ||
26 | 28 | ||
27 | #include "categorywidget.h" | 29 | #include "categorywidget.h" |
28 | #include "categoryselect.h" | 30 | #include "categoryselect.h" |
29 | 31 | ||
32 | #include <stdlib.h> | ||
33 | |||
34 | static QString categoryEdittingFileName() | ||
35 | { | ||
36 | QString str = getenv("HOME"); | ||
37 | str +="/.cateditting"; | ||
38 | return str; | ||
39 | } | ||
30 | 40 | ||
31 | class CategoryComboPrivate | 41 | class CategoryComboPrivate |
32 | { | 42 | { |
33 | public: | 43 | public: |
34 | CategoryComboPrivate(QObject *o) | 44 | CategoryComboPrivate(QObject *o) |
35 | : mCat( o ) | 45 | : mCat( o ) |
36 | { | 46 | { |
37 | } | 47 | } |
@@ -52,20 +62,22 @@ public: | |||
52 | CategorySelectPrivate() | 62 | CategorySelectPrivate() |
53 | { | 63 | { |
54 | } | 64 | } |
55 | QArray<int> mRec; | 65 | QArray<int> mRec; |
56 | bool usingAll; | 66 | bool usingAll; |
57 | QString mVisibleName; | 67 | QString mVisibleName; |
58 | }; | 68 | }; |
59 | 69 | ||
60 | CategoryCombo::CategoryCombo( QWidget *parent, const char *name ) | 70 | CategoryCombo::CategoryCombo( QWidget *parent, const char *name , int width) |
61 | : QComboBox( parent, name ) | 71 | : QComboBox( parent, name ) |
62 | { | 72 | { |
63 | d = new CategoryComboPrivate(this); | 73 | d = new CategoryComboPrivate(this); |
74 | if (width) | ||
75 | setFixedWidth(width); | ||
64 | } | 76 | } |
65 | 77 | ||
66 | void CategoryCombo::initCombo( const QArray<int> &recCats, | 78 | void CategoryCombo::initCombo( const QArray<int> &recCats, |
67 | const QString &appName ) | 79 | const QString &appName ) |
68 | { | 80 | { |
69 | initCombo( recCats, appName, appName ); | 81 | initCombo( recCats, appName, appName ); |
70 | } | 82 | } |
71 | 83 | ||
@@ -73,81 +85,182 @@ void CategoryCombo::initCombo( const QArray<int> &recCats, | |||
73 | const QString &appName, | 85 | const QString &appName, |
74 | const QString &visibleName ) | 86 | const QString &visibleName ) |
75 | { | 87 | { |
76 | d->mStrAppName = appName; | 88 | d->mStrAppName = appName; |
77 | d->mStrVisibleName = visibleName; | 89 | d->mStrVisibleName = visibleName; |
78 | clear(); | 90 | clear(); |
79 | QStringList slApp; | 91 | QStringList slApp; |
80 | 92 | ||
93 | QObject::disconnect( this, SIGNAL(activated(int)), | ||
94 | this, SLOT(slotValueChanged(int)) ); | ||
95 | |||
81 | QObject::connect( this, SIGNAL(activated(int)), | 96 | QObject::connect( this, SIGNAL(activated(int)), |
82 | this, SLOT(slotValueChanged(int)) ); | 97 | this, SLOT(slotValueChanged(int)) ); |
83 | bool loadOk = d->mCat.load( categoryFileName() ); | 98 | bool loadOk = d->mCat.load( categoryFileName() ); |
84 | slApp = d->mCat.labels( d->mStrAppName, TRUE, Categories::UnfiledLabel ); | 99 | slApp = d->mCat.labels( d->mStrAppName, TRUE, Categories::UnfiledLabel ); |
85 | d->mAppCats = d->mCat.ids( d->mStrAppName ); | 100 | |
101 | d->mAppCats = d->mCat.ids( d->mStrAppName, slApp); | ||
86 | 102 | ||
87 | int i, | 103 | int i, |
88 | j, | 104 | j, |
89 | saveMe, | 105 | saveMe, |
90 | recCount; | 106 | recCount; |
91 | QStringList::Iterator it; | 107 | QStringList::Iterator it; |
92 | // now add in all the items... | 108 | // now add in all the items... |
93 | recCount = recCats.count(); | 109 | recCount = recCats.count(); |
94 | saveMe = -1; | 110 | saveMe = -1; |
95 | if ( recCount > 1 && loadOk ) { | 111 | if ( recCount > 1 && loadOk ) { |
96 | it = slApp.begin(); | 112 | it = slApp.begin(); |
97 | insertItem( *it ); | 113 | for ( j = 0; j< (int)(slApp.count()-1); ++it, j++ ) { |
98 | ++it; | ||
99 | for ( j = 0; it != slApp.end(); ++it, j++ ) { | ||
100 | // grr... we have to go through and compare... | 114 | // grr... we have to go through and compare... |
101 | if ( j < int(d->mAppCats.size()) ) { | 115 | if ( j < int(d->mAppCats.size()) ) { |
102 | for ( i = 0; i < recCount; i++ ) { | 116 | for ( i = 0; i < recCount; i++ ) { |
103 | if ( recCats[i] == d->mAppCats[j] ) { | 117 | if ( recCats[i] == d->mAppCats[j] ) { |
104 | (*it).append( tr(" (Multi.)") ); | 118 | (*it).append( tr(" (Multi.)") ); |
105 | if ( saveMe < 0 ) | 119 | if ( saveMe < 0 ) |
106 | saveMe = j; | 120 | saveMe = j; |
107 | // no need to continue through the list. | 121 | // no need to continue through the list. |
108 | break; | 122 | break; |
109 | } | 123 | } |
110 | } | 124 | } |
111 | } | 125 | } |
112 | insertItem( *it ); | 126 | insertItem( *it ); |
113 | } | 127 | } |
128 | insertItem( *it ); | ||
114 | } else | 129 | } else |
115 | insertStringList( slApp ); | 130 | insertStringList( slApp ); |
116 | 131 | ||
117 | if ( recCount > 0 && loadOk ) { | 132 | if ( recCount > 0 && loadOk ) { |
118 | for ( i = 0; i < int(d->mAppCats.size()); i++ ) { | 133 | for ( i = 0; i < int(d->mAppCats.size()); i++ ) { |
119 | if ( d->mAppCats[i] == recCats[0] ) { | 134 | if ( d->mAppCats[i] == recCats[0] ) { |
120 | setCurrentItem( i + 1 ); | 135 | setCurrentItem( i ); |
136 | break; | ||
137 | } | ||
138 | } | ||
139 | } else | ||
140 | { | ||
141 | setCurrentItem( slApp.count()-1 ); // unfiled | ||
142 | } | ||
143 | } | ||
144 | |||
145 | // this is a new function by SHARP instead of initCombo() | ||
146 | QArray<int> CategoryCombo::initComboWithRefind( const QArray<int> &recCats, | ||
147 | const QString &appName) | ||
148 | { | ||
149 | QString visibleName = appName; | ||
150 | d->mStrAppName = appName; | ||
151 | d->mStrVisibleName = visibleName; | ||
152 | clear(); | ||
153 | QStringList slApp; | ||
154 | QArray<int> results; | ||
155 | |||
156 | QObject::disconnect( this, SIGNAL(activated(int)), | ||
157 | this, SLOT(slotValueChanged(int)) ); | ||
158 | |||
159 | QObject::connect( this, SIGNAL(activated(int)), | ||
160 | this, SLOT(slotValueChanged(int)) ); | ||
161 | bool loadOk = d->mCat.load( categoryFileName() ); | ||
162 | slApp = d->mCat.labels( d->mStrAppName, TRUE, Categories::UnfiledLabel ); | ||
163 | |||
164 | d->mAppCats = d->mCat.ids( d->mStrAppName, slApp); | ||
165 | |||
166 | // addition part | ||
167 | // make new recCats | ||
168 | if (loadOk){ | ||
169 | int i,j; | ||
170 | int value; | ||
171 | int rCount = recCats.count(); | ||
172 | int mCount = d->mAppCats.count(); | ||
173 | |||
174 | for (i=0; i<rCount; i++){ | ||
175 | value = 0; | ||
176 | for (j=0; j<mCount; j++){ | ||
177 | if (recCats[i] == d->mAppCats[j]){ | ||
178 | value = recCats[i]; | ||
179 | break; | ||
180 | } | ||
181 | } | ||
182 | if (value != 0){ | ||
183 | int tmp = results.size(); | ||
184 | results.resize( tmp + 1 ); | ||
185 | results[ tmp ] = value; | ||
186 | } | ||
187 | } | ||
188 | } | ||
189 | else{ | ||
190 | results = recCats; | ||
191 | } | ||
192 | // addition end | ||
193 | |||
194 | int i, | ||
195 | j, | ||
196 | saveMe, | ||
197 | recCount; | ||
198 | QStringList::Iterator it; | ||
199 | // now add in all the items... | ||
200 | recCount = results.count(); | ||
201 | saveMe = -1; | ||
202 | if ( recCount > 1 && loadOk ) { | ||
203 | it = slApp.begin(); | ||
204 | for ( j = 0; j< (int)(slApp.count()-1); ++it, j++ ) { | ||
205 | |||
206 | // grr... we have to go through and compare... | ||
207 | if ( j < int(d->mAppCats.size()) ) { | ||
208 | for ( i = 0; i < recCount; i++ ) { | ||
209 | if ( results[i] == d->mAppCats[j] ) { | ||
210 | (*it).append( tr(" (Multi.)") ); | ||
211 | if ( saveMe < 0 ) | ||
212 | saveMe = j; | ||
213 | // no need to continue through the list. | ||
214 | break; | ||
215 | } | ||
216 | } | ||
217 | } | ||
218 | insertItem( *it ); | ||
219 | } | ||
220 | insertItem( *it ); | ||
221 | } else | ||
222 | insertStringList( slApp ); | ||
223 | |||
224 | if ( recCount > 0 && loadOk ) { | ||
225 | for ( i = 0; i < int(d->mAppCats.size()); i++ ) { | ||
226 | if ( d->mAppCats[i] == results[0] ) { | ||
227 | setCurrentItem( i ); | ||
121 | break; | 228 | break; |
122 | } | 229 | } |
123 | } | 230 | } |
124 | } else | 231 | } else |
125 | setCurrentItem( 0 ); // unfiled | 232 | { |
233 | setCurrentItem( slApp.count()-1 ); // unfiled | ||
234 | } | ||
235 | /* | ||
126 | QObject::connect( this, SIGNAL(activated(int)), | 236 | QObject::connect( this, SIGNAL(activated(int)), |
127 | this, SLOT(slotValueChanged(int)) ); | 237 | this, SLOT(slotValueChanged(int)) ); |
238 | */ | ||
239 | return results; | ||
128 | } | 240 | } |
129 | 241 | ||
242 | |||
130 | CategoryCombo::~CategoryCombo() | 243 | CategoryCombo::~CategoryCombo() |
131 | { | 244 | { |
132 | delete d; | 245 | delete d; |
133 | } | 246 | } |
134 | 247 | ||
135 | int CategoryCombo::currentCategory() const | 248 | int CategoryCombo::currentCategory() const |
136 | { | 249 | { |
137 | int returnMe; | 250 | int returnMe; |
138 | returnMe = currentItem(); | 251 | returnMe = currentItem(); |
139 | // unfiled is now 0... | 252 | |
140 | if ( returnMe == 0 ) | 253 | if ( returnMe == (int)d->mAppCats.count() ) |
141 | returnMe = -1; | 254 | returnMe = -1; |
142 | else if ( returnMe > (int)d->mAppCats.count() ) // only happen on "All" | 255 | else if ( returnMe > (int)d->mAppCats.count() ) // only happen on "All" |
143 | returnMe = -2; | 256 | returnMe = -2; |
144 | else | 257 | else |
145 | returnMe = d->mAppCats[returnMe - 1]; | 258 | returnMe = d->mAppCats[returnMe]; |
146 | return returnMe; | 259 | return returnMe; |
147 | } | 260 | } |
148 | 261 | ||
149 | void CategoryCombo::setCurrentCategory( int newCatUid ) | 262 | void CategoryCombo::setCurrentCategory( int newCatUid ) |
150 | { | 263 | { |
151 | int i; | 264 | int i; |
152 | for ( i = 0; i < int(d->mAppCats.size()); i++ ) { | 265 | for ( i = 0; i < int(d->mAppCats.size()); i++ ) { |
153 | if ( d->mAppCats[i] == newCatUid ) | 266 | if ( d->mAppCats[i] == newCatUid ) |
@@ -168,69 +281,85 @@ void CategoryCombo::setCurrentText( const QString &str ) | |||
168 | } | 281 | } |
169 | } | 282 | } |
170 | 283 | ||
171 | void CategoryCombo::slotValueChanged( int ) | 284 | void CategoryCombo::slotValueChanged( int ) |
172 | { | 285 | { |
173 | emit sigCatChanged( currentCategory() ); | 286 | emit sigCatChanged( currentCategory() ); |
174 | } | 287 | } |
175 | 288 | ||
176 | CategorySelect::CategorySelect( QWidget *parent, const char *name ) | 289 | CategorySelect::CategorySelect( QWidget *parent, const char *name,int width) |
177 | : QHBox( parent, name ), | 290 | : QHBox( parent, name ), |
178 | cmbCat( 0 ), | 291 | cmbCat( 0 ), |
179 | cmdCat( 0 ), | 292 | cmdCat( 0 ), |
180 | d( 0 ) | 293 | d( 0 ) |
181 | { | 294 | { |
182 | d = new CategorySelectPrivate(); | 295 | d = new CategorySelectPrivate(); |
183 | init(); | 296 | init(width); |
184 | } | 297 | } |
185 | 298 | ||
186 | CategorySelect::CategorySelect( const QArray<int> &vl, | 299 | CategorySelect::CategorySelect( const QArray<int> &vl, |
187 | const QString &appName, QWidget *parent, | 300 | const QString &appName, QWidget *parent, |
188 | const char *name ) | 301 | const char *name ,int width) |
189 | : QHBox( parent, name ) | 302 | : QHBox( parent, name ) |
190 | { | 303 | { |
191 | d = new CategorySelectPrivate( vl ); | 304 | d = new CategorySelectPrivate( vl ); |
192 | init(); | 305 | |
306 | init(width); | ||
307 | |||
193 | setCategories( vl, appName, appName ); | 308 | setCategories( vl, appName, appName ); |
194 | } | 309 | } |
195 | 310 | ||
196 | CategorySelect::CategorySelect( const QArray<int> &vl, | 311 | CategorySelect::CategorySelect( const QArray<int> &vl, |
197 | const QString &appName, | 312 | const QString &appName, |
198 | const QString &visibleName, | 313 | const QString &visibleName, |
199 | QWidget *parent, const char *name ) | 314 | QWidget *parent, const char *name , int width) |
200 | : QHBox( parent, name ) | 315 | : QHBox( parent, name ) |
201 | { | 316 | { |
202 | d = new CategorySelectPrivate( vl ); | 317 | d = new CategorySelectPrivate( vl ); |
203 | init(); | 318 | init(width); |
204 | setCategories( vl, appName, visibleName ); | 319 | setCategories( vl, appName, visibleName ); |
205 | } | 320 | } |
206 | 321 | ||
207 | CategorySelect::~CategorySelect() | 322 | CategorySelect::~CategorySelect() |
208 | { | 323 | { |
209 | delete d; | 324 | delete d; |
210 | } | 325 | } |
211 | 326 | ||
212 | void CategorySelect::slotDialog() | 327 | void CategorySelect::slotDialog() |
213 | { | 328 | { |
329 | if (QFile::exists( categoryEdittingFileName() )){ | ||
330 | QMessageBox::warning(this,tr("Error"), | ||
331 | tr("Sorry, another application is\nediting categories.") ); | ||
332 | return; | ||
333 | } | ||
334 | |||
335 | QFile f( categoryEdittingFileName() ); | ||
336 | if ( !f.open( IO_WriteOnly) ){ | ||
337 | return; | ||
338 | } | ||
339 | |||
214 | QDialog editDlg( this, 0, TRUE ); | 340 | QDialog editDlg( this, 0, TRUE ); |
215 | editDlg.setCaption( tr("Edit Categories") ); | 341 | editDlg.setCaption( tr("Edit Categories") ); |
216 | QVBoxLayout *vb = new QVBoxLayout( &editDlg ); | 342 | QVBoxLayout *vb = new QVBoxLayout( &editDlg ); |
217 | QScrollView *sv = new QScrollView( &editDlg ); | 343 | QScrollView *sv = new QScrollView( &editDlg ); |
218 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 344 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
219 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 345 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
220 | vb->addWidget( sv ); | 346 | vb->addWidget( sv ); |
221 | CategoryWidget ce( d->mRec, mStrAppName, d->mVisibleName, &editDlg ); | 347 | CategoryWidget ce( d->mRec, mStrAppName, d->mVisibleName, &editDlg ); |
222 | sv->addChild( &ce ); | 348 | sv->addChild( &ce ); |
223 | editDlg.showMaximized(); | 349 | editDlg.showMaximized(); |
224 | 350 | ||
225 | if ( editDlg.exec() ) { | 351 | if ( editDlg.exec() ) { |
226 | d->mRec = ce.newCategories(); | 352 | d->mRec = ce.newCategories(); |
227 | cmbCat->initCombo( d->mRec, mStrAppName ); | 353 | cmbCat->initCombo( d->mRec, mStrAppName ); |
228 | } | 354 | } |
355 | |||
356 | f.close(); | ||
357 | QFile::remove( categoryEdittingFileName() ); | ||
229 | } | 358 | } |
230 | 359 | ||
231 | void CategorySelect::slotNewCat( int newUid ) | 360 | void CategorySelect::slotNewCat( int newUid ) |
232 | { | 361 | { |
233 | if ( newUid != -1 ) { | 362 | if ( newUid != -1 ) { |
234 | bool alreadyIn = false; | 363 | bool alreadyIn = false; |
235 | for ( uint it = 0; it < d->mRec.count(); ++it ) { | 364 | for ( uint it = 0; it < d->mRec.count(); ++it ) { |
236 | if ( d->mRec[it] == newUid ) { | 365 | if ( d->mRec[it] == newUid ) { |
@@ -242,35 +371,36 @@ void CategorySelect::slotNewCat( int newUid ) | |||
242 | d->mRec.resize( 1 ); | 371 | d->mRec.resize( 1 ); |
243 | d->mRec[ 0 ] = newUid; | 372 | d->mRec[ 0 ] = newUid; |
244 | } | 373 | } |
245 | } else | 374 | } else |
246 | d->mRec.resize(0); // now Unfiled. | 375 | d->mRec.resize(0); // now Unfiled. |
247 | emit signalSelected( currentCategory() ); | 376 | emit signalSelected( currentCategory() ); |
248 | } | 377 | } |
249 | 378 | ||
250 | void CategorySelect::setCategories( const QArray<int> &rec, | 379 | QString CategorySelect::setCategories( const QArray<int> &rec, |
251 | const QString &appName ) | 380 | const QString &appName ) |
252 | { | 381 | { |
253 | setCategories( rec, appName, appName ); | 382 | return setCategories( rec, appName, appName ); |
254 | } | 383 | } |
255 | 384 | ||
256 | void CategorySelect::setCategories( const QArray<int> &rec, | 385 | QString CategorySelect::setCategories( const QArray<int> &rec, |
257 | const QString &appName, | 386 | const QString &appName, |
258 | const QString &visibleName ) | 387 | const QString &visibleName ) |
259 | { | 388 | { |
260 | d->mRec = rec; | ||
261 | d->mVisibleName = visibleName; | 389 | d->mVisibleName = visibleName; |
262 | mStrAppName = appName; | 390 | mStrAppName = appName; |
263 | cmbCat->initCombo( rec, appName ); | 391 | d->mRec = cmbCat->initComboWithRefind( rec, appName ); |
392 | return Qtopia::Record::idsToString(d->mRec); | ||
264 | } | 393 | } |
265 | 394 | ||
266 | void CategorySelect::init() | 395 | void CategorySelect::init(int width) |
267 | { | 396 | { |
268 | cmbCat = new CategoryCombo( this ); | 397 | cmbCat = new CategoryCombo( this, 0, width); |
398 | |||
269 | QObject::connect( cmbCat, SIGNAL(sigCatChanged(int)), | 399 | QObject::connect( cmbCat, SIGNAL(sigCatChanged(int)), |
270 | this, SLOT(slotNewCat(int)) ); | 400 | this, SLOT(slotNewCat(int)) ); |
271 | cmdCat = new QToolButton( this ); | 401 | cmdCat = new QToolButton( this ); |
272 | QObject::connect( cmdCat, SIGNAL(clicked()), this, SLOT(slotDialog()) ); | 402 | QObject::connect( cmdCat, SIGNAL(clicked()), this, SLOT(slotDialog()) ); |
273 | cmdCat->setTextLabel( "...", FALSE ); | 403 | cmdCat->setTextLabel( "...", FALSE ); |
274 | cmdCat->setUsesTextLabel( true ); | 404 | cmdCat->setUsesTextLabel( true ); |
275 | cmdCat->setMaximumSize( cmdCat->sizeHint() ); | 405 | cmdCat->setMaximumSize( cmdCat->sizeHint() ); |
276 | cmdCat->setFocusPolicy( TabFocus ); | 406 | cmdCat->setFocusPolicy( TabFocus ); |
@@ -308,8 +438,15 @@ void CategorySelect::setAllCategories( bool add ) | |||
308 | { | 438 | { |
309 | d->usingAll = add; | 439 | d->usingAll = add; |
310 | if ( add ) { | 440 | if ( add ) { |
311 | cmbCat->insertItem( tr( "All" ), cmbCat->count() ); | 441 | cmbCat->insertItem( tr( "All" ), cmbCat->count() ); |
312 | cmbCat->setCurrentItem( cmbCat->count() - 1 ); | 442 | cmbCat->setCurrentItem( cmbCat->count() - 1 ); |
313 | } else | 443 | } else |
314 | cmbCat->removeItem( cmbCat->count() - 1 ); | 444 | cmbCat->removeItem( cmbCat->count() - 1 ); |
315 | } | 445 | } |
446 | |||
447 | // 01.12.21 added | ||
448 | void CategorySelect::setFixedWidth(int width) | ||
449 | { | ||
450 | width -= cmdCat->width(); | ||
451 | cmbCat->setFixedWidth(width); | ||
452 | } | ||
diff --git a/library/categoryselect.h b/library/categoryselect.h index 5c6b565..7a8e491 100644 --- a/library/categoryselect.h +++ b/library/categoryselect.h | |||
@@ -31,26 +31,29 @@ extern QString categoryFileName(); | |||
31 | class QToolButton; | 31 | class QToolButton; |
32 | 32 | ||
33 | class CategoryComboPrivate; | 33 | class CategoryComboPrivate; |
34 | class CategoryCombo : public QComboBox | 34 | class CategoryCombo : public QComboBox |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | CategoryCombo( QWidget *parent, const char* name = 0 ); | 39 | CategoryCombo( QWidget *parent, const char* name = 0, int width=0); |
40 | |||
40 | ~CategoryCombo(); | 41 | ~CategoryCombo(); |
41 | 42 | ||
42 | int currentCategory() const; | 43 | int currentCategory() const; |
43 | void setCurrentCategory( int id ); | 44 | void setCurrentCategory( int id ); |
44 | // depreciated. | 45 | // depreciated. |
45 | void initCombo( const QArray<int> &recCats, const QString &appName ); | 46 | void initCombo( const QArray<int> &recCats, const QString &appName ); |
46 | void initCombo( const QArray<int> &recCats, const QString &appName, | 47 | void initCombo( const QArray<int> &recCats, const QString &appName, |
47 | const QString &visibleName /* = appName */ ); | 48 | const QString &visibleName /* = appName */ ); |
48 | 49 | ||
50 | QArray<int> initComboWithRefind( const QArray<int> &recCats, const QString &appName ); | ||
51 | |||
49 | signals: | 52 | signals: |
50 | void sigCatChanged( int newUid ); | 53 | void sigCatChanged( int newUid ); |
51 | 54 | ||
52 | private slots: | 55 | private slots: |
53 | void slotValueChanged( int ); | 56 | void slotValueChanged( int ); |
54 | 57 | ||
55 | private: | 58 | private: |
56 | void setCurrentText( const QString &str ); | 59 | void setCurrentText( const QString &str ); |
@@ -60,46 +63,51 @@ private: | |||
60 | #endif | 63 | #endif |
61 | 64 | ||
62 | class CategorySelectPrivate; | 65 | class CategorySelectPrivate; |
63 | class CategorySelect : public QHBox | 66 | class CategorySelect : public QHBox |
64 | { | 67 | { |
65 | Q_OBJECT | 68 | Q_OBJECT |
66 | public: | 69 | public: |
67 | // we need two constructors, the first gets around designer limitations | 70 | // we need two constructors, the first gets around designer limitations |
68 | CategorySelect( QWidget *parent = 0, const char *name = 0 ); | 71 | |
72 | CategorySelect( QWidget *parent = 0, const char *name = 0, int width = 0 ); | ||
69 | 73 | ||
70 | CategorySelect( const QArray<int> &vlCats, const QString &appName, | 74 | CategorySelect( const QArray<int> &vlCats, const QString &appName, |
71 | QWidget *parent = 0, const char *name = 0 ); | 75 | QWidget *parent = 0, const char *name = 0, |
76 | int width = 0); | ||
72 | CategorySelect( const QArray<int> &vlCats, const QString &appName, | 77 | CategorySelect( const QArray<int> &vlCats, const QString &appName, |
73 | const QString &visibleName, QWidget *parent = 0, | 78 | const QString &visibleName, QWidget *parent = 0, |
74 | const char *name = 0 ); | 79 | const char *name = 0 , int width = 0); |
80 | |||
75 | ~CategorySelect(); | 81 | ~CategorySelect(); |
76 | 82 | ||
77 | const QArray<int> ¤tCategories() const; | 83 | const QArray<int> ¤tCategories() const; |
78 | int currentCategory() const; | 84 | int currentCategory() const; |
79 | void setCurrentCategory( int newCatUid ); | 85 | void setCurrentCategory( int newCatUid ); |
80 | // pretty much if you don't set it the constructor, you need to | 86 | // pretty much if you don't set it the constructor, you need to |
81 | // call it here ASAP! | 87 | // call it here ASAP! |
82 | // however this call is depreciated... | 88 | // however this call is depreciated... |
83 | void setCategories( const QArray<int> &vlCats, const QString &appName ); | ||
84 | // use this one instead (for translating ) | ||
85 | void setCategories( const QArray<int> &vlCats, const QString &appName, | ||
86 | const QString &visibleName ); | ||
87 | 89 | ||
90 | QString setCategories( const QArray<int> &vlCats, const QString &appName ); | ||
91 | QString setCategories( const QArray<int> &vlCats, const QString &appName, | ||
92 | const QString &visibleName ); | ||
88 | // these were added for find dialog. | 93 | // these were added for find dialog. |
89 | void setRemoveCategoryEdit( bool remove ); | 94 | void setRemoveCategoryEdit( bool remove ); |
90 | void setAllCategories( bool add ); | 95 | void setAllCategories( bool add ); |
91 | 96 | ||
97 | void setFixedWidth(int width); | ||
92 | signals: | 98 | signals: |
93 | void signalSelected( int ); | 99 | void signalSelected( int ); |
94 | 100 | ||
95 | private slots: | 101 | private slots: |
96 | void slotDialog(); | 102 | void slotDialog(); |
103 | |||
104 | public slots: | ||
97 | void slotNewCat( int id ); | 105 | void slotNewCat( int id ); |
98 | 106 | ||
99 | private: | 107 | private: |
100 | void init(); | 108 | void init(int width=0); |
101 | QString mStrAppName; | 109 | QString mStrAppName; |
102 | CategoryCombo *cmbCat; | 110 | CategoryCombo *cmbCat; |
103 | QToolButton *cmdCat; | 111 | QToolButton *cmdCat; |
104 | CategorySelectPrivate *d; | 112 | CategorySelectPrivate *d; |
105 | }; | 113 | }; |
diff --git a/library/config.cpp b/library/config.cpp index 9634571..e07eecb 100644 --- a/library/config.cpp +++ b/library/config.cpp | |||
@@ -28,17 +28,19 @@ | |||
28 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
29 | 29 | ||
30 | #include <sys/stat.h> | 30 | #include <sys/stat.h> |
31 | #include <sys/types.h> | 31 | #include <sys/types.h> |
32 | #include <fcntl.h> | 32 | #include <fcntl.h> |
33 | #include <stdlib.h> | 33 | #include <stdlib.h> |
34 | #include <unistd.h> | 34 | #include <unistd.h> |
35 | 35 | ||
36 | #define QTOPIA_INTERNAL_LANGLIST | ||
36 | #include "config.h" | 37 | #include "config.h" |
38 | #include "global.h" | ||
37 | 39 | ||
38 | 40 | ||
39 | /*! | 41 | /*! |
40 | \internal | 42 | \internal |
41 | */ | 43 | */ |
42 | QString Config::configFilename(const QString& name, Domain d) | 44 | QString Config::configFilename(const QString& name, Domain d) |
43 | { | 45 | { |
44 | switch (d) { | 46 | switch (d) { |
@@ -90,24 +92,19 @@ QString Config::configFilename(const QString& name, Domain d) | |||
90 | 92 | ||
91 | In the File Domain, \a name is an absolute filename. | 93 | In the File Domain, \a name is an absolute filename. |
92 | */ | 94 | */ |
93 | Config::Config( const QString &name, Domain domain ) | 95 | Config::Config( const QString &name, Domain domain ) |
94 | : filename( configFilename(name,domain) ) | 96 | : filename( configFilename(name,domain) ) |
95 | { | 97 | { |
96 | git = groups.end(); | 98 | git = groups.end(); |
97 | read(); | 99 | read(); |
98 | 100 | QStringList l = Global::languageList(); | |
99 | lang = getenv("LANG"); | 101 | lang = l[0]; |
100 | int i = lang.find("."); | 102 | glang = l[1]; |
101 | if ( i > 0 ) | ||
102 | lang = lang.left( i ); | ||
103 | i = lang.find( "_" ); | ||
104 | if ( i > 0 ) | ||
105 | glang = lang.left(i); | ||
106 | } | 103 | } |
107 | 104 | ||
108 | /*! | 105 | /*! |
109 | Writes any changes to disk and destroys the in-memory object. | 106 | Writes any changes to disk and destroys the in-memory object. |
110 | */ | 107 | */ |
111 | Config::~Config() | 108 | Config::~Config() |
112 | { | 109 | { |
113 | if ( changed ) | 110 | if ( changed ) |
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 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #define QPE_OWNAPM | ||
22 | #define QPE_HAVE_TOGGLELIGHT | ||
23 | #define QPE_NOCIBAUD | ||
24 | #define QPE_STARTMENU | ||
25 | #include <asm/sharp_apm.h> | ||
26 | #ifndef APM_IOC_BATTERY_BACK_CHK | ||
27 | #define APM_IOC_BATTERY_BACK_CHK _IO(APM_IOC_MAGIC, 32) | ||
28 | #endif | ||
29 | #ifndef APM_IOC_BATTERY_MAIN_CHK | ||
30 | #define APM_IOC_BATTERY_MAIN_CHK _IO(APM_IOC_MAGIC, 33) | ||
31 | #endif | ||
32 | |||
33 | #include <unistd.h> | ||
34 | #include <stdio.h> | ||
35 | #include <signal.h> | ||
36 | #include <fcntl.h> | ||
37 | #include <sys/ioctl.h> | ||
38 | |||
39 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | ||
40 | |||
41 | /* --- for SHARP_BUZZER device --- */ | ||
42 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | ||
43 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | ||
44 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | ||
45 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | ||
46 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | ||
47 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | ||
48 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | ||
49 | |||
50 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | ||
51 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | ||
52 | #define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | ||
53 | #define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | ||
54 | #define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | ||
55 | #define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | ||
56 | #define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | ||
57 | #define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | ||
58 | #define SHARP_PDA_APPSTART 9 /* application start */ | ||
59 | #define SHARP_PDA_APPQUIT 10 /* application ends */ | ||
60 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | ||
61 | #define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | ||
62 | #define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | ||
63 | #define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | ||
64 | |||
65 | |||
66 | #define CUSTOM_BUZZER( sound ) \ | ||
67 | { \ | ||
68 | static int fd = open( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); \ | ||
69 | ioctl( fd, SHARP_BUZZER_MAKESOUND, sound ); \ | ||
70 | } | ||
71 | |||
72 | #define CUSTOM_SOUND_ALARM CUSTOM_BUZZER( SHARP_BUZ_SCHEDULE_ALARM ) | ||
73 | |||
74 | #include <sys/ioctl.h> | ||
75 | #include <asm/sharp_char.h> | ||
76 | |||
77 | // a bit awkward, as this value is defined in emailclient.cpp aswell... | ||
78 | #define LED_MAIL 0 | ||
79 | #define SHARP_LED_MAIL 9 | ||
80 | |||
81 | #define CUSTOM_LEDS( led, status ) \ | ||
82 | { \ | ||
83 | if ( led == LED_MAIL ) \ | ||
84 | led = SHARP_LED_MAIL; \ | ||
85 | static int fd = open( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); \ | ||
86 | sharp_led_status leds; \ | ||
87 | memset(&leds, 0, sizeof(leds)); \ | ||
88 | leds.which = led; \ | ||
89 | leds.status = status; \ | ||
90 | ioctl( fd, SHARP_LED_SETSTATUS, (char*)&leds ); \ | ||
91 | } | ||
92 | |||
93 | #define QPE_HAVE_MEMALERTER | ||
94 | |||
95 | #define QPE_MEMALERTER_IMPL \ | ||
96 | static void sig_handler(int sig) \ | ||
97 | { \ | ||
98 | switch (sig) { \ | ||
99 | case SIGHUP: \ | ||
100 | memstate = VeryLow; \ | ||
101 | break; \ | ||
102 | case SIGUSR1: \ | ||
103 | memstate = Normal; \ | ||
104 | break; \ | ||
105 | case SIGUSR2: \ | ||
106 | memstate = Low; \ | ||
107 | break; \ | ||
108 | } \ | ||
109 | } \ | ||
110 | static void initMemalerter() \ | ||
111 | { \ | ||
112 | struct sigaction sa; \ | ||
113 | memset(&sa, '\0', sizeof sa); \ | ||
114 | sa.sa_handler = sig_handler; \ | ||
115 | sa.sa_flags = SA_RESTART; \ | ||
116 | if (sigaction(SIGHUP, &sa, NULL) < 0) { \ | ||
117 | return; \ | ||
118 | } \ | ||
119 | if (sigaction(SIGUSR1, &sa, NULL) < 0) { \ | ||
120 | return; \ | ||
121 | } \ | ||
122 | if (sigaction(SIGUSR2, &sa, NULL) < 0) { \ | ||
123 | return; \ | ||
124 | } \ | ||
125 | FILE *fo = fopen("/proc/sys/vm/freepg_signal_proc", "w"); \ | ||
126 | \ | ||
127 | if (!fo) \ | ||
128 | return; \ | ||
129 | fprintf(fo, "qpe\n"); \ | ||
130 | fclose(fo); \ | ||
131 | } | ||
132 | |||
133 | #define QPE_INITIAL_NUMLOCK_STATE \ | ||
134 | { \ | ||
135 | bool numLock = FALSE; \ | ||
136 | sharp_kbdctl_modifstat st; \ | ||
137 | int dev = ::open("/dev/sharp_kbdctl", O_RDWR); \ | ||
138 | if( dev >= 0 ) { \ | ||
139 | memset(&st, 0, sizeof(st)); \ | ||
140 | st.which = 3; \ | ||
141 | int ret = ioctl(dev, SHARP_KBDCTL_GETMODIFSTAT, (char*)&st); \ | ||
142 | if( !ret ) \ | ||
143 | numLock = (bool)st.stat; \ | ||
144 | ::close(dev); \ | ||
145 | } \ | ||
146 | return numLock; \ | ||
147 | } | ||
diff --git a/library/datebookmonth.h b/library/datebookmonth.h index 6cd1ac5..a7647ae 100644 --- a/library/datebookmonth.h +++ b/library/datebookmonth.h | |||
@@ -63,16 +63,17 @@ private slots: | |||
63 | void monthBack(); | 63 | void monthBack(); |
64 | void monthForward(); | 64 | void monthForward(); |
65 | 65 | ||
66 | private: | 66 | private: |
67 | QToolButton *begin, *back, *next, *end; | 67 | QToolButton *begin, *back, *next, *end; |
68 | QComboBox *month; | 68 | QComboBox *month; |
69 | QSpinBox *year; | 69 | QSpinBox *year; |
70 | DateBookMonthHeaderPrivate *d; | 70 | DateBookMonthHeaderPrivate *d; |
71 | int focus; | ||
71 | }; | 72 | }; |
72 | 73 | ||
73 | class DayItemMonthPrivate; | 74 | class DayItemMonthPrivate; |
74 | class DayItemMonth : public QTableItem | 75 | class DayItemMonth : public QTableItem |
75 | { | 76 | { |
76 | public: | 77 | public: |
77 | DayItemMonth( QTable *table, EditType et, const QString &t ); | 78 | DayItemMonth( QTable *table, EditType et, const QString &t ); |
78 | ~DayItemMonth(); | 79 | ~DayItemMonth(); |
diff --git a/library/fileselector.h b/library/fileselector.h index ef8efea..8cfdf13 100644 --- a/library/fileselector.h +++ b/library/fileselector.h | |||
@@ -17,76 +17,48 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef FILESELECTOR_H | 20 | #ifndef FILESELECTOR_H |
21 | #define FILESELECTOR_H | 21 | #define FILESELECTOR_H |
22 | 22 | ||
23 | #include <qhbox.h> | 23 | #include <qhbox.h> |
24 | #include <qvbox.h> | 24 | #include <qvbox.h> |
25 | #include <qlistview.h> | ||
26 | #include <qtoolbutton.h> | 25 | #include <qtoolbutton.h> |
26 | #include <qlistview.h> | ||
27 | 27 | ||
28 | #include "filemanager.h" | 28 | #include "filemanager.h" |
29 | #include "applnk.h" | 29 | #include "applnk.h" |
30 | 30 | ||
31 | class QPopupMenu; | 31 | class QPopupMenu; |
32 | class QPushButton; | 32 | class QPushButton; |
33 | class FileSelectorView; | ||
33 | 34 | ||
34 | class FileSelectorItem : public QListViewItem | 35 | class FileSelectorItem : public QListViewItem |
35 | { | 36 | { |
36 | public: | 37 | public: |
37 | FileSelectorItem( QListView *parent, const DocLnk& f ); | 38 | FileSelectorItem( QListView *parent, const DocLnk& f ); |
38 | ~FileSelectorItem(); | 39 | ~FileSelectorItem(); |
39 | 40 | ||
40 | DocLnk file() const { return fl; } | 41 | DocLnk file() const { return fl; } |
41 | 42 | ||
42 | private: | 43 | private: |
43 | DocLnk fl; | 44 | DocLnk fl; |
44 | }; | 45 | }; |
45 | 46 | ||
46 | class CategoryMenu; | ||
47 | class FileSelectorViewPrivate; | ||
48 | class FileSelectorView : public QListView | ||
49 | { | ||
50 | Q_OBJECT | ||
51 | |||
52 | public: | ||
53 | FileSelectorView( const QString &mimefilter, QWidget *parent, const char *name ); | ||
54 | ~FileSelectorView(); | ||
55 | void reread(); | ||
56 | int fileCount() { return count; } | ||
57 | |||
58 | void setCategoryFilter(CategoryMenu *); | ||
59 | protected: | ||
60 | void keyPressEvent( QKeyEvent *e ); | ||
61 | |||
62 | protected slots: | ||
63 | void cardMessage( const QCString &, const QByteArray &); | ||
64 | |||
65 | void categoryChanged(); | ||
66 | |||
67 | private: | ||
68 | QString filter; | ||
69 | FileManager *fileManager; | ||
70 | int count; | ||
71 | FileSelectorViewPrivate *d; | ||
72 | }; | ||
73 | |||
74 | class FileSelectorPrivate; | 47 | class FileSelectorPrivate; |
75 | class FileSelector : public QVBox | 48 | class FileSelector : public QVBox |
76 | { | 49 | { |
77 | Q_OBJECT | 50 | Q_OBJECT |
78 | 51 | ||
79 | public: | 52 | public: |
80 | FileSelector( const QString &mimefilter, QWidget *parent, const char *name, bool newVisible = TRUE, bool closeVisible = TRUE ); | 53 | FileSelector( const QString &mimefilter, QWidget *parent, const char *name, bool newVisible = TRUE, bool closeVisible = TRUE ); |
81 | ~FileSelector(); | 54 | ~FileSelector(); |
82 | void setNewVisible( bool b ); | 55 | void setNewVisible( bool b ); |
83 | void setCloseVisible( bool b ); | 56 | void setCloseVisible( bool b ); |
84 | void setCategoriesVisible( bool b ); | ||
85 | void reread(); | 57 | void reread(); |
86 | int fileCount(); | 58 | int fileCount(); |
87 | const DocLnk *selected(); | 59 | const DocLnk *selected(); |
88 | 60 | ||
89 | signals: | 61 | signals: |
90 | void fileSelected( const DocLnk & ); | 62 | void fileSelected( const DocLnk & ); |
91 | void newSelected( const DocLnk & ); | 63 | void newSelected( const DocLnk & ); |
92 | void closeMe(); | 64 | void closeMe(); |
diff --git a/library/finddialog.cpp b/library/finddialog.cpp index 7a9367b..904e952 100644 --- a/library/finddialog.cpp +++ b/library/finddialog.cpp | |||
@@ -13,16 +13,20 @@ | |||
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | ||
22 | // have this class. | ||
23 | #define QTOPIA_INTERNAL_FD | ||
24 | |||
21 | #include "finddialog.h" | 25 | #include "finddialog.h" |
22 | #include "findwidget_p.h" | 26 | #include "findwidget_p.h" |
23 | 27 | ||
24 | #include <qlayout.h> | 28 | #include <qlayout.h> |
25 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
26 | 30 | ||
27 | FindDialog::FindDialog( const QString &appName, QWidget *parent, | 31 | FindDialog::FindDialog( const QString &appName, QWidget *parent, |
28 | const char *name, bool modal ) | 32 | const char *name, bool modal ) |
diff --git a/library/finddialog.h b/library/finddialog.h index 265b5ae..00c7b45 100644 --- a/library/finddialog.h +++ b/library/finddialog.h | |||
@@ -13,32 +13,43 @@ | |||
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | |||
22 | // | ||
23 | // DO NOT ATTEMPT TO USE THIS CLASS | ||
24 | // | ||
25 | |||
21 | #ifndef __FINDDIALOG_H__ | 26 | #ifndef __FINDDIALOG_H__ |
22 | #define __FINDDIALOG_H__ | 27 | #define __FINDDIALOG_H__ |
23 | 28 | ||
24 | #include <qdatetime.h> | 29 | #include <qdatetime.h> |
25 | #include <qdialog.h> | 30 | #include <qdialog.h> |
26 | 31 | ||
27 | class FindWidget; | 32 | class FindWidget; |
28 | 33 | ||
29 | class FindDialogPrivate; | 34 | class FindDialogPrivate; |
30 | class FindDialog : public QDialog | 35 | class FindDialog : public QDialog |
31 | { | 36 | { |
32 | Q_OBJECT | 37 | Q_OBJECT |
33 | public: | 38 | public: |
39 | |||
40 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | ||
41 | // have this class. | ||
42 | #ifdef QTOPIA_INTERNAL_FD | ||
43 | |||
34 | FindDialog( const QString &appName, | 44 | FindDialog( const QString &appName, |
35 | QWidget *parent = 0, const char *name = 0, bool modal = TRUE ); | 45 | QWidget *parent = 0, const char *name = 0, bool modal = TRUE ); |
36 | ~FindDialog(); | 46 | ~FindDialog(); |
47 | #endif | ||
37 | 48 | ||
38 | QString findText() const; | 49 | QString findText() const; |
39 | void setUseDate( bool show ); | 50 | void setUseDate( bool show ); |
40 | void setDate( const QDate &dt ); | 51 | void setDate( const QDate &dt ); |
41 | 52 | ||
42 | public slots: | 53 | public slots: |
43 | void slotNotFound(); | 54 | void slotNotFound(); |
44 | void slotWrapAround(); | 55 | void slotWrapAround(); |
diff --git a/library/mimetype.cpp b/library/mimetype.cpp index c6a4453..9fab160 100644 --- a/library/mimetype.cpp +++ b/library/mimetype.cpp | |||
@@ -13,16 +13,17 @@ | |||
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define QTOPIA_INTERNAL_MIMEEXT | ||
21 | #include "mimetype.h" | 22 | #include "mimetype.h" |
22 | #include "applnk.h" | 23 | #include "applnk.h" |
23 | #include "resource.h" | 24 | #include "resource.h" |
24 | #include "qpeapplication.h" | 25 | #include "qpeapplication.h" |
25 | #include <qfile.h> | 26 | #include <qfile.h> |
26 | #include <qdict.h> | 27 | #include <qdict.h> |
27 | #include <qregexp.h> | 28 | #include <qregexp.h> |
28 | #include <qstringlist.h> | 29 | #include <qstringlist.h> |
@@ -41,29 +42,31 @@ public: | |||
41 | bigIcon = lnk.bigPixmap(); | 42 | bigIcon = lnk.bigPixmap(); |
42 | } else { | 43 | } else { |
43 | QImage unscaledIcon = Resource::loadImage( icon ); | 44 | QImage unscaledIcon = Resource::loadImage( icon ); |
44 | regIcon.convertFromImage( unscaledIcon.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 45 | regIcon.convertFromImage( unscaledIcon.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
45 | bigIcon.convertFromImage( unscaledIcon.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ) ); | 46 | bigIcon.convertFromImage( unscaledIcon.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ) ); |
46 | } | 47 | } |
47 | } | 48 | } |
48 | QString id; | 49 | QString id; |
50 | QString extension; | ||
49 | QString desc; | 51 | QString desc; |
50 | QPixmap regIcon; | 52 | QPixmap regIcon; |
51 | QPixmap bigIcon; | 53 | QPixmap bigIcon; |
52 | AppLnk app; | 54 | AppLnk app; |
53 | }; | 55 | }; |
54 | 56 | ||
55 | class MimeType::Dict : public QDict<MimeTypeData> { | 57 | class MimeType::Dict : public QDict<MimeTypeData> { |
56 | public: | 58 | public: |
57 | Dict() {} | 59 | Dict() {} |
58 | }; | 60 | }; |
59 | 61 | ||
60 | MimeType::Dict* MimeType::d=0; | 62 | MimeType::Dict* MimeType::d=0; |
61 | static QMap<QString,QString> *typeFor = 0; | 63 | static QMap<QString,QString> *typeFor = 0; |
64 | static QMap<QString,QString> *extFor = 0; | ||
62 | 65 | ||
63 | MimeType::Dict& MimeType::dict() | 66 | MimeType::Dict& MimeType::dict() |
64 | { | 67 | { |
65 | if ( !d ) { | 68 | if ( !d ) { |
66 | d = new Dict; | 69 | d = new Dict; |
67 | d->setAutoDelete(TRUE); | 70 | d->setAutoDelete(TRUE); |
68 | } | 71 | } |
69 | return *d; | 72 | return *d; |
@@ -91,16 +94,22 @@ QString MimeType::description() const | |||
91 | } | 94 | } |
92 | 95 | ||
93 | QPixmap MimeType::pixmap() const | 96 | QPixmap MimeType::pixmap() const |
94 | { | 97 | { |
95 | MimeTypeData* d = data(i); | 98 | MimeTypeData* d = data(i); |
96 | return d ? d->regIcon : QPixmap(); | 99 | return d ? d->regIcon : QPixmap(); |
97 | } | 100 | } |
98 | 101 | ||
102 | QString MimeType::extension() const | ||
103 | { | ||
104 | loadExtensions(); | ||
105 | return *(*extFor).find(i); | ||
106 | } | ||
107 | |||
99 | QPixmap MimeType::bigPixmap() const | 108 | QPixmap MimeType::bigPixmap() const |
100 | { | 109 | { |
101 | MimeTypeData* d = data(i); | 110 | MimeTypeData* d = data(i); |
102 | return d ? d->bigIcon : QPixmap(); | 111 | return d ? d->bigIcon : QPixmap(); |
103 | } | 112 | } |
104 | 113 | ||
105 | const AppLnk* MimeType::application() const | 114 | const AppLnk* MimeType::application() const |
106 | { | 115 | { |
@@ -123,16 +132,17 @@ void MimeType::clear() | |||
123 | { | 132 | { |
124 | delete d; | 133 | delete d; |
125 | d = 0; | 134 | d = 0; |
126 | } | 135 | } |
127 | 136 | ||
128 | void MimeType::loadExtensions() | 137 | void MimeType::loadExtensions() |
129 | { | 138 | { |
130 | if ( !typeFor ) { | 139 | if ( !typeFor ) { |
140 | extFor = new QMap<QString,QString>; | ||
131 | typeFor = new QMap<QString,QString>; | 141 | typeFor = new QMap<QString,QString>; |
132 | loadExtensions("/etc/mime.types"); | 142 | loadExtensions("/etc/mime.types"); |
133 | loadExtensions(QPEApplication::qpeDir()+"etc/mime.types"); | 143 | loadExtensions(QPEApplication::qpeDir()+"etc/mime.types"); |
134 | } | 144 | } |
135 | } | 145 | } |
136 | 146 | ||
137 | void MimeType::loadExtensions(const QString& filename) | 147 | void MimeType::loadExtensions(const QString& filename) |
138 | { | 148 | { |
@@ -140,19 +150,22 @@ void MimeType::loadExtensions(const QString& filename) | |||
140 | if ( file.open(IO_ReadOnly) ) { | 150 | if ( file.open(IO_ReadOnly) ) { |
141 | QTextStream in(&file); | 151 | QTextStream in(&file); |
142 | QRegExp space("[ \t]+"); | 152 | QRegExp space("[ \t]+"); |
143 | while (!in.atEnd()) { | 153 | while (!in.atEnd()) { |
144 | QStringList tokens = QStringList::split(space, in.readLine()); | 154 | QStringList tokens = QStringList::split(space, in.readLine()); |
145 | QStringList::ConstIterator it = tokens.begin(); | 155 | QStringList::ConstIterator it = tokens.begin(); |
146 | if ( it != tokens.end() ) { | 156 | if ( it != tokens.end() ) { |
147 | QString id = *it; ++it; | 157 | QString id = *it; ++it; |
148 | while (it != tokens.end()) { | 158 | if ( it != tokens.end() ) { |
149 | (*typeFor)[*it] = id; | 159 | (*extFor)[id] = *it; |
150 | ++it; | 160 | while (it != tokens.end()) { |
161 | (*typeFor)[*it] = id; | ||
162 | ++it; | ||
163 | } | ||
151 | } | 164 | } |
152 | } | 165 | } |
153 | } | 166 | } |
154 | } | 167 | } |
155 | } | 168 | } |
156 | 169 | ||
157 | void MimeType::init( const QString& ext_or_id ) | 170 | void MimeType::init( const QString& ext_or_id ) |
158 | { | 171 | { |
diff --git a/library/mimetype.h b/library/mimetype.h index 58725d7..b6cca95 100644 --- a/library/mimetype.h +++ b/library/mimetype.h | |||
@@ -35,16 +35,21 @@ public: | |||
35 | MimeType( const QString& ext_or_id ); | 35 | MimeType( const QString& ext_or_id ); |
36 | MimeType( const DocLnk& ); | 36 | MimeType( const DocLnk& ); |
37 | 37 | ||
38 | QString id() const; | 38 | QString id() const; |
39 | QString description() const; | 39 | QString description() const; |
40 | QPixmap pixmap() const; | 40 | QPixmap pixmap() const; |
41 | QPixmap bigPixmap() const; | 41 | QPixmap bigPixmap() const; |
42 | 42 | ||
43 | // DON'T define this yourself! | ||
44 | #ifdef QTOPIA_INTERNAL_MIMEEXT | ||
45 | QString extension() const; | ||
46 | #endif | ||
47 | |||
43 | const AppLnk* application() const; | 48 | const AppLnk* application() const; |
44 | 49 | ||
45 | static QString appsFolderName(); | 50 | static QString appsFolderName(); |
46 | static void updateApplications(); | 51 | static void updateApplications(); |
47 | 52 | ||
48 | // These shouldn't be needed | 53 | // These shouldn't be needed |
49 | static void clear(); | 54 | static void clear(); |
50 | static void registerApp( const AppLnk& ); | 55 | static void registerApp( const AppLnk& ); |
diff --git a/library/network.cpp b/library/network.cpp index 7d51016..e6d2781 100644 --- a/library/network.cpp +++ b/library/network.cpp | |||
@@ -13,16 +13,17 @@ | |||
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define QTOPIA_INTERNAL_LANGLIST | ||
21 | #include "qpe/network.h" | 22 | #include "qpe/network.h" |
22 | #include "qpe/networkinterface.h" | 23 | #include "qpe/networkinterface.h" |
23 | #include "qpe/global.h" | 24 | #include "qpe/global.h" |
24 | #include "qpe/config.h" | 25 | #include "qpe/config.h" |
25 | #include "qpe/resource.h" | 26 | #include "qpe/resource.h" |
26 | #include "qpe/qpeapplication.h" | 27 | #include "qpe/qpeapplication.h" |
27 | #include <qpe/qcopenvelope_qws.h> | 28 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/qlibrary.h> | 29 | #include <qpe/qlibrary.h> |
@@ -413,24 +414,26 @@ NetworkInterface* Network::loadPlugin(const QString& type) | |||
413 | if ( !ifaces ) ifaces = new QDict<NetworkInterface>; | 414 | if ( !ifaces ) ifaces = new QDict<NetworkInterface>; |
414 | NetworkInterface *iface = ifaces->find(type); | 415 | NetworkInterface *iface = ifaces->find(type); |
415 | if ( !iface ) { | 416 | if ( !iface ) { |
416 | QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".so"; | 417 | QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".so"; |
417 | QLibrary lib(libfile); | 418 | QLibrary lib(libfile); |
418 | if ( !lib.queryInterface( IID_Network, (QUnknownInterface**)&iface ) == QS_OK ) | 419 | if ( !lib.queryInterface( IID_Network, (QUnknownInterface**)&iface ) == QS_OK ) |
419 | return 0; | 420 | return 0; |
420 | ifaces->insert(type,iface); | 421 | ifaces->insert(type,iface); |
421 | QString lang = getenv( "LANG" ); | 422 | QStringList langs = Global::languageList(); |
422 | QTranslator * trans = new QTranslator(qApp); | 423 | for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { |
423 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/lib"+type+".qm"; | 424 | QString lang = *it; |
424 | if ( trans->load( tfn )) | 425 | QTranslator * trans = new QTranslator(qApp); |
425 | qApp->installTranslator( trans ); | 426 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/lib"+type+".qm"; |
426 | else | 427 | if ( trans->load( tfn )) |
427 | delete trans; | 428 | qApp->installTranslator( trans ); |
428 | 429 | else | |
430 | delete trans; | ||
431 | } | ||
429 | } | 432 | } |
430 | return iface; | 433 | return iface; |
431 | #else | 434 | #else |
432 | return 0; | 435 | return 0; |
433 | #endif | 436 | #endif |
434 | } | 437 | } |
435 | 438 | ||
436 | #include "network.moc" | 439 | #include "network.moc" |
diff --git a/library/power.cpp b/library/power.cpp index 990ff62..12b52ed 100644 --- a/library/power.cpp +++ b/library/power.cpp | |||
@@ -97,16 +97,18 @@ bool PowerStatusManager::getProcApmStatus( int &ac, int &bs, int &bf, int &pc, i | |||
97 | break; | 97 | break; |
98 | case 0x02: | 98 | case 0x02: |
99 | ps->bs = PowerStatus::Critical; | 99 | ps->bs = PowerStatus::Critical; |
100 | break; | 100 | break; |
101 | case 0x03: | 101 | case 0x03: |
102 | ps->bs = PowerStatus::Charging; | 102 | ps->bs = PowerStatus::Charging; |
103 | break; | 103 | break; |
104 | case 0x04: | 104 | case 0x04: |
105 | case 0xff: // 0xff is Unknown but we map to NotPresent | ||
106 | default: | ||
105 | ps->bs = PowerStatus::NotPresent; | 107 | ps->bs = PowerStatus::NotPresent; |
106 | break; | 108 | break; |
107 | } | 109 | } |
108 | 110 | ||
109 | switch ( ac ) { | 111 | switch ( ac ) { |
110 | case 0x00: | 112 | case 0x00: |
111 | ps->ac = PowerStatus::Offline; | 113 | ps->ac = PowerStatus::Offline; |
112 | break; | 114 | 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 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #ifndef QCOP_MESSAGE_H | ||
22 | #define QCOP_MESSAGE_H | ||
23 | |||
24 | #include <qdatastream.h> | ||
25 | #include <qbuffer.h> | ||
26 | |||
27 | class QCopMessage : public QDataStream { | ||
28 | public: | ||
29 | QCopMessage(); | ||
30 | QCopMessage(const QCString& channel, const QCString& message); | ||
31 | QCopMessage(const QCopMessage& orig); | ||
32 | ~QCopMessage(); | ||
33 | |||
34 | void setChannel(QCString& channel) { m_Channel = channel; } | ||
35 | QCString channel() const { return m_Channel; } | ||
36 | void setMessage(QCString& message) { m_Message = message; } | ||
37 | QCString message() const { return m_Message; } | ||
38 | const QByteArray data() const; | ||
39 | |||
40 | QCopMessage& operator=(const QCopMessage& orig); | ||
41 | |||
42 | private: | ||
43 | QCString m_Channel; | ||
44 | QCString m_Message; | ||
45 | }; | ||
46 | |||
47 | // ### No need to inline, just maintaining binary compatability | ||
48 | inline QCopMessage::QCopMessage() : QDataStream(new QBuffer()) { | ||
49 | device()->open(IO_WriteOnly); | ||
50 | } | ||
51 | |||
52 | inline QCopMessage::QCopMessage(const QCString& channel, const QCString& message) | ||
53 | : QDataStream(new QBuffer()), m_Channel(channel), m_Message(message) { | ||
54 | device()->open(IO_WriteOnly); | ||
55 | } | ||
56 | |||
57 | inline QCopMessage::QCopMessage(const QCopMessage& orig) : QDataStream() { | ||
58 | // The QBuffer is going to share the byte array, so it will keep the | ||
59 | // data pointer even when this one goes out of scope. | ||
60 | QByteArray array(((QBuffer*)orig.device())->buffer()); | ||
61 | array.detach(); | ||
62 | setDevice(new QBuffer(array)); | ||
63 | device()->open(IO_Append); | ||
64 | |||
65 | m_Channel = orig.channel(); | ||
66 | m_Message = orig.message(); | ||
67 | } | ||
68 | |||
69 | inline QCopMessage& QCopMessage::operator=(const QCopMessage& orig) { | ||
70 | if (device()) { | ||
71 | delete device(); | ||
72 | unsetDevice(); | ||
73 | } | ||
74 | |||
75 | // The QBuffer is going to share the byte array, so it will keep the | ||
76 | // data pointer even when this one goes out of scope. | ||
77 | QByteArray array(((QBuffer*)orig.device())->buffer()); | ||
78 | array.detach(); | ||
79 | setDevice(new QBuffer(array)); | ||
80 | device()->open(IO_Append); | ||
81 | |||
82 | m_Channel = orig.channel(); | ||
83 | m_Message = orig.message(); | ||
84 | |||
85 | return *this; | ||
86 | } | ||
87 | |||
88 | inline const QByteArray QCopMessage::data() const { | ||
89 | return ((QBuffer*)device())->buffer(); | ||
90 | } | ||
91 | |||
92 | inline QCopMessage::~QCopMessage() { | ||
93 | // If we still have our QBuffer, clean it up... | ||
94 | if (device()) | ||
95 | delete device(); | ||
96 | unsetDevice(); | ||
97 | } | ||
98 | |||
99 | #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 | |||
@@ -12,16 +12,17 @@ | |||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #define QTOPIA_INTERNAL_LANGLIST | ||
20 | #include <qapplication.h> | 21 | #include <qapplication.h> |
21 | #include <qstyle.h> | 22 | #include <qstyle.h> |
22 | #include <qwidget.h> | 23 | #include <qwidget.h> |
23 | #include <qpainter.h> | 24 | #include <qpainter.h> |
24 | #include <qtimer.h> | 25 | #include <qtimer.h> |
25 | #include <qwhatsthis.h> | 26 | #include <qwhatsthis.h> |
26 | #include "qcopenvelope_qws.h" | 27 | #include "qcopenvelope_qws.h" |
27 | #include "qpedecoration_qws.h" | 28 | #include "qpedecoration_qws.h" |
@@ -239,20 +240,20 @@ public: | |||
239 | 240 | ||
240 | QPEDecoration::QPEDecoration() | 241 | QPEDecoration::QPEDecoration() |
241 | : QWSDefaultDecoration() | 242 | : QWSDefaultDecoration() |
242 | { | 243 | { |
243 | imageOk = Resource::loadImage( "OKButton" ); | 244 | imageOk = Resource::loadImage( "OKButton" ); |
244 | imageClose = Resource::loadImage( "CloseButton" ); | 245 | imageClose = Resource::loadImage( "CloseButton" ); |
245 | imageHelp = Resource::loadImage( "HelpButton" ); | 246 | imageHelp = Resource::loadImage( "HelpButton" ); |
246 | helpFile = QString(qApp->argv()[0]) + ".html"; | 247 | helpFile = QString(qApp->argv()[0]) + ".html"; |
247 | QString lang = getenv( "LANG" ); | 248 | QStringList path = Global::helpPath(); |
248 | helpExists = QFile::exists( QPEApplication::qpeDir() + "/help/" + lang + "/html/" + helpFile ); | 249 | helpExists = FALSE; |
249 | if ( !helpExists ) | 250 | for (QStringList::ConstIterator it=path.begin(); it!=path.end() && !helpExists; ++it) |
250 | helpExists = QFile::exists( QPEApplication::qpeDir() + "/help/en/html/" + helpFile ); | 251 | helpExists = QFile::exists( *it + "/" + helpFile ); |
251 | #ifndef MINIMIZE_HELP_HACK | 252 | #ifndef MINIMIZE_HELP_HACK |
252 | qpeManager = new QPEManager( this ); | 253 | qpeManager = new QPEManager( this ); |
253 | #else | 254 | #else |
254 | qpeManager = 0; | 255 | qpeManager = 0; |
255 | #endif | 256 | #endif |
256 | } | 257 | } |
257 | 258 | ||
258 | QPEDecoration::~QPEDecoration() | 259 | QPEDecoration::~QPEDecoration() |