author | zecke <zecke> | 2003-04-16 10:57:59 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-04-16 10:57:59 (UTC) |
commit | eeb29547890a2d162de66d7d5b98d3840a7e2d79 (patch) (unidiff) | |
tree | 973c6de7aae2fd5ba368efb87fa24234f0e12aa3 | |
parent | dfa2d294b3af09bf3757a3c2294a925093e72fc6 (diff) | |
download | opie-eeb29547890a2d162de66d7d5b98d3840a7e2d79.zip opie-eeb29547890a2d162de66d7d5b98d3840a7e2d79.tar.gz opie-eeb29547890a2d162de66d7d5b98d3840a7e2d79.tar.bz2 |
Fix API docu
-rw-r--r-- | library/applnk.cpp | 16 | ||||
-rw-r--r-- | library/backend/categories.cpp | 9 | ||||
-rw-r--r-- | library/backend/categories.h | 2 | ||||
-rw-r--r-- | library/backend/event.cpp | 4 | ||||
-rw-r--r-- | library/backend/palmtoprecord.h | 12 | ||||
-rw-r--r-- | library/datebookdb.cpp | 12 | ||||
-rw-r--r-- | library/finddialog.cpp | 7 | ||||
-rw-r--r-- | library/global.cpp | 28 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 3 | ||||
-rw-r--r-- | library/storage.cpp | 6 |
10 files changed, 65 insertions, 34 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp index 35822dd..00030e8 100644 --- a/library/applnk.cpp +++ b/library/applnk.cpp | |||
@@ -303,65 +303,81 @@ int AppLnk::bigIconSize() | |||
303 | */ | 303 | */ |
304 | /*! | 304 | /*! |
305 | \fn const QArray<int>& AppLnk::categories() const | 305 | \fn const QArray<int>& AppLnk::categories() const |
306 | 306 | ||
307 | Returns the Categories property. | 307 | Returns the Categories property. |
308 | 308 | ||
309 | See the CategoryWidget for more details. | 309 | See the CategoryWidget for more details. |
310 | 310 | ||
311 | \sa setCategories() | 311 | \sa setCategories() |
312 | */ | 312 | */ |
313 | 313 | ||
314 | const QArray<int>& AppLnk::categories() const | 314 | const QArray<int>& AppLnk::categories() const |
315 | { | 315 | { |
316 | d->ensureCatArray(); | 316 | d->ensureCatArray(); |
317 | return d->mCat; | 317 | return d->mCat; |
318 | } | 318 | } |
319 | 319 | ||
320 | /*! | 320 | /*! |
321 | \fn int AppLnk::id() const | 321 | \fn int AppLnk::id() const |
322 | 322 | ||
323 | Returns the id of the AppLnk. If the AppLnk is not in an AppLnkSet, | 323 | Returns the id of the AppLnk. If the AppLnk is not in an AppLnkSet, |
324 | this value is 0, otherwise it is a value that is unique for the | 324 | this value is 0, otherwise it is a value that is unique for the |
325 | duration of the current process. | 325 | duration of the current process. |
326 | 326 | ||
327 | \sa AppLnkSet::find() | 327 | \sa AppLnkSet::find() |
328 | */ | 328 | */ |
329 | 329 | ||
330 | /*! | 330 | /*! |
331 | \fn bool AppLnk::isValid() const | 331 | \fn bool AppLnk::isValid() const |
332 | 332 | ||
333 | Returns TRUE if this AppLnk is valid; otherwise returns FALSE. | 333 | Returns TRUE if this AppLnk is valid; otherwise returns FALSE. |
334 | */ | 334 | */ |
335 | /*! | ||
336 | \fn bool AppLnk::fileKnown() const | ||
337 | |||
338 | If the with the AppLnk associated file is not equal to QString::null | ||
339 | */ | ||
340 | /*! | ||
341 | \fn bool AppLnk::linkFileKnown()const | ||
342 | |||
343 | The filename of the AppLnk | ||
335 | 344 | ||
345 | */ | ||
346 | /*! | ||
347 | \fn void AppLnk::setRotation( const QString& ) | ||
348 | |||
349 | The default rotation of the associated application. This | ||
350 | function is included inline for binary compatible issues | ||
351 | */ | ||
336 | /*! | 352 | /*! |
337 | Creates an invalid AppLnk. | 353 | Creates an invalid AppLnk. |
338 | 354 | ||
339 | \sa isValid() | 355 | \sa isValid() |
340 | */ | 356 | */ |
341 | AppLnk::AppLnk() | 357 | AppLnk::AppLnk() |
342 | { | 358 | { |
343 | mId = 0; | 359 | mId = 0; |
344 | d = new AppLnkPrivate(); | 360 | d = new AppLnkPrivate(); |
345 | } | 361 | } |
346 | 362 | ||
347 | /*! | 363 | /*! |
348 | Loads \a file (e.g. \e app.desktop) as an AppLnk. | 364 | Loads \a file (e.g. \e app.desktop) as an AppLnk. |
349 | 365 | ||
350 | \sa writeLink() | 366 | \sa writeLink() |
351 | */ | 367 | */ |
352 | AppLnk::AppLnk( const QString &file ) | 368 | AppLnk::AppLnk( const QString &file ) |
353 | { | 369 | { |
354 | QStringList sl; | 370 | QStringList sl; |
355 | d = new AppLnkPrivate(); | 371 | d = new AppLnkPrivate(); |
356 | if ( !file.isNull() ) { | 372 | if ( !file.isNull() ) { |
357 | Config config( file, Config::File ); | 373 | Config config( file, Config::File ); |
358 | 374 | ||
359 | if ( config.isValid() ) { | 375 | if ( config.isValid() ) { |
360 | config.setGroup( "Desktop Entry" ); | 376 | config.setGroup( "Desktop Entry" ); |
361 | 377 | ||
362 | mName = config.readEntry( "Name", file ); | 378 | mName = config.readEntry( "Name", file ); |
363 | mExec = config.readEntry( "Exec" ); | 379 | mExec = config.readEntry( "Exec" ); |
364 | mType = config.readEntry( "Type", QString::null ); | 380 | mType = config.readEntry( "Type", QString::null ); |
365 | mIconFile = config.readEntry( "Icon", QString::null ); | 381 | mIconFile = config.readEntry( "Icon", QString::null ); |
366 | mRotation = config.readEntry( "Rotation", "" ); | 382 | mRotation = config.readEntry( "Rotation", "" ); |
367 | mComment = config.readEntry( "Comment", QString::null ); | 383 | mComment = config.readEntry( "Comment", QString::null ); |
diff --git a/library/backend/categories.cpp b/library/backend/categories.cpp index 2e84089..cce9f38 100644 --- a/library/backend/categories.cpp +++ b/library/backend/categories.cpp | |||
@@ -458,65 +458,65 @@ QString Categories::label( const QString &app, int id ) const | |||
458 | Returns a single string associated with \a catids for display in a | 458 | Returns a single string associated with \a catids for display in a |
459 | combobox or any area that requires one string. If \a catids are empty | 459 | combobox or any area that requires one string. If \a catids are empty |
460 | then "Unfiled" will be returned. If multiple categories are | 460 | then "Unfiled" will be returned. If multiple categories are |
461 | assigned then the behavior depends on the DisplaySingle type. | 461 | assigned then the behavior depends on the DisplaySingle type. |
462 | 462 | ||
463 | If \a display is set to ShowMulti then " (multi)" appended to the | 463 | If \a display is set to ShowMulti then " (multi)" appended to the |
464 | first string. If \a display is set to ShowAll, then a space | 464 | first string. If \a display is set to ShowAll, then a space |
465 | seperated string is returned with all categories. If ShowFirst is | 465 | seperated string is returned with all categories. If ShowFirst is |
466 | set, the just the first string is returned. | 466 | set, the just the first string is returned. |
467 | */ | 467 | */ |
468 | QString Categories::displaySingle( const QString &app, | 468 | QString Categories::displaySingle( const QString &app, |
469 | const QArray<int> &catids, | 469 | const QArray<int> &catids, |
470 | DisplaySingle display ) const | 470 | DisplaySingle display ) const |
471 | { | 471 | { |
472 | QStringList strs = labels( app, catids ); | 472 | QStringList strs = labels( app, catids ); |
473 | if ( !strs.count() ) | 473 | if ( !strs.count() ) |
474 | return tr("Unfiled"); | 474 | return tr("Unfiled"); |
475 | strs.sort(); | 475 | strs.sort(); |
476 | QString r; | 476 | QString r; |
477 | if ( strs.count() > 1 ) { | 477 | if ( strs.count() > 1 ) { |
478 | switch ( display ) { | 478 | switch ( display ) { |
479 | case ShowFirst: | 479 | case ShowFirst: |
480 | r = strs.first(); | 480 | r = strs.first(); |
481 | break; | 481 | break; |
482 | case ShowMulti: | 482 | case ShowMulti: |
483 | r = strs.first() + tr(" (multi.)"); | 483 | r = strs.first() + tr(" (multi.)"); |
484 | break; | 484 | break; |
485 | case ShowAll: | 485 | case ShowAll: |
486 | r = strs.join(" "); | 486 | r = strs.join(" "); |
487 | break; | 487 | break; |
488 | } | 488 | } |
489 | } | 489 | } |
490 | else r = strs.first(); | 490 | else r = strs.first(); |
491 | return r; | 491 | return r; |
492 | } | 492 | } |
493 | 493 | ||
494 | /*! | 494 | /*! |
495 | 495 | ||
496 | Returns all ids associated with the application CategoryGroup \a app | 496 | Returns all ids associated with the application CategoryGroup \a app |
497 | and the passed in \a labels in that group. | 497 | and the passed in \a labels in that group. |
498 | */ | 498 | */ |
499 | QArray<int> Categories::ids( const QString &app, const QStringList &labels) const | 499 | QArray<int> Categories::ids( const QString &app, const QStringList &labels) const |
500 | { | 500 | { |
501 | QArray<int> results; | 501 | QArray<int> results; |
502 | QStringList::ConstIterator it; | 502 | QStringList::ConstIterator it; |
503 | int i; | 503 | int i; |
504 | 504 | ||
505 | for ( i=0, it=labels.begin(); it!=labels.end(); i++, ++it ) { | 505 | for ( i=0, it=labels.begin(); it!=labels.end(); i++, ++it ) { |
506 | int value = id( app, *it ); | 506 | int value = id( app, *it ); |
507 | if ( value != 0 ) { | 507 | if ( value != 0 ) { |
508 | int tmp = results.size(); | 508 | int tmp = results.size(); |
509 | results.resize( tmp + 1 ); | 509 | results.resize( tmp + 1 ); |
510 | results[ tmp ] = value; | 510 | results[ tmp ] = value; |
511 | } | 511 | } |
512 | } | 512 | } |
513 | return results; | 513 | return results; |
514 | } | 514 | } |
515 | 515 | ||
516 | /*! | 516 | /*! |
517 | Returns the id associated with the app. If the id is not found in the | 517 | Returns the id associated with the app. If the id is not found in the |
518 | application CategoryGroup, then it searches the global CategoryGroup. | 518 | application CategoryGroup, then it searches the global CategoryGroup. |
519 | If it is not found it either, 0 is returned. | 519 | If it is not found it either, 0 is returned. |
520 | */ | 520 | */ |
521 | int Categories::id( const QString &app, const QString &cat ) const | 521 | int Categories::id( const QString &app, const QString &cat ) const |
522 | { | 522 | { |
@@ -819,94 +819,89 @@ void CheckedListView::addCheckableList( const QStringList &options ) | |||
819 | it != options.end(); ++it ) { | 819 | it != options.end(); ++it ) { |
820 | (void) new QCheckListItem( this, *it, | 820 | (void) new QCheckListItem( this, *it, |
821 | QCheckListItem::CheckBox ); | 821 | QCheckListItem::CheckBox ); |
822 | } | 822 | } |
823 | } | 823 | } |
824 | 824 | ||
825 | void CheckedListView::setChecked( const QStringList &checked ) | 825 | void CheckedListView::setChecked( const QStringList &checked ) |
826 | { | 826 | { |
827 | // iterate over all items | 827 | // iterate over all items |
828 | bool showingChecked = FALSE; | 828 | bool showingChecked = FALSE; |
829 | for ( QCheckListItem *i = (QCheckListItem *) firstChild(); | 829 | for ( QCheckListItem *i = (QCheckListItem *) firstChild(); |
830 | i; i = (QCheckListItem *)i->nextSibling() ) | 830 | i; i = (QCheckListItem *)i->nextSibling() ) |
831 | // see if the item should be checked by searching the | 831 | // see if the item should be checked by searching the |
832 | // checked list | 832 | // checked list |
833 | if ( checked.find( i->text( 0 ) ) != checked.end() ) { | 833 | if ( checked.find( i->text( 0 ) ) != checked.end() ) { |
834 | i->setOn( TRUE ); | 834 | i->setOn( TRUE ); |
835 | // make sure it is showing at least one checked item | 835 | // make sure it is showing at least one checked item |
836 | if ( !showingChecked ) { | 836 | if ( !showingChecked ) { |
837 | ensureItemVisible( i ); | 837 | ensureItemVisible( i ); |
838 | showingChecked = TRUE; | 838 | showingChecked = TRUE; |
839 | } | 839 | } |
840 | } | 840 | } |
841 | else | 841 | else |
842 | i->setOn( FALSE ); | 842 | i->setOn( FALSE ); |
843 | } | 843 | } |
844 | 844 | ||
845 | /*! \fn Categories &Categories::operator= ( const Categories &c ) | 845 | /*! \fn Categories &Categories::operator= ( const Categories &c ) |
846 | 846 | ||
847 | Performs deep copy. | 847 | Performs deep copy. |
848 | */ | 848 | */ |
849 | 849 | ||
850 | 850 | ||
851 | /*! \fn QStringList Categories::labels( const QString & app, const QArray<int> &catids ) const | ||
852 | |||
853 | Returns list of labels associated with the application and catids | ||
854 | */ | ||
855 | |||
856 | /*! \fn QStringList Categories::globalCategories() const | 851 | /*! \fn QStringList Categories::globalCategories() const |
857 | 852 | ||
858 | Returns list of all global category labels | 853 | Returns list of all global category labels |
859 | */ | 854 | */ |
860 | 855 | ||
861 | /*! \fn const QMap<QString, CategoryGroup> &Categories::appGroupMap() const | 856 | /*! \fn const QMap<QString, CategoryGroup> &Categories::appGroupMap() const |
862 | 857 | ||
863 | Returns a map of application names to CategoryGroup. The CategoryGroup | 858 | Returns a map of application names to CategoryGroup. The CategoryGroup |
864 | class defines a map of ids to category labels and category labels to ids. | 859 | class defines a map of ids to category labels and category labels to ids. |
865 | */ | 860 | */ |
866 | 861 | ||
867 | /*! \fn const CategoryGroup &Categories::globalGroup() const | 862 | /*! \fn const CategoryGroup &Categories::globalGroup() const |
868 | 863 | ||
869 | Returns the global CategoryGroup. The CategoryGroup | 864 | Returns the global CategoryGroup. The CategoryGroup |
870 | class defines a map of ids to category labels and category labels to ids. | 865 | class defines a map of ids to category labels and category labels to ids. |
871 | */ | 866 | */ |
872 | 867 | ||
873 | /*! \fn void Categories::categoryAdded( const Categories &cats, const QString &appname, int uid) | 868 | /*! \fn void Categories::categoryAdded( const Categories &cats, const QString &appname, int uid) |
874 | 869 | ||
875 | Emitted if a category is added. | 870 | Emitted if a category is added. |
876 | 871 | ||
877 | \a cats is a const reference to this object | 872 | \a cats is a const reference to this object |
878 | \a appname is the CategoryGroup application name that the category was added to or QString::null if it was global | 873 | \a appname is the CategoryGroup application name that the category was added to or QString::null if it was global |
879 | \a uid is the unique identifier associated with the added category | 874 | \a uid is the unique identifier associated with the added category |
880 | */ | 875 | */ |
881 | 876 | ||
882 | /*! \fn void Categories::categoryRemoved( const Categories &cats, const QString &appname, | 877 | /*! \fn void Categories::categoryRemoved( const Categories &cats, const QString &appname, |
883 | int uid) | 878 | int uid) |
884 | 879 | ||
885 | Emitted if removed category is removed. | 880 | Emitted if removed category is removed. |
886 | 881 | ||
887 | \a cats is a const reference to this object | 882 | \a cats is a const reference to this object |
888 | \a appname is the CategoryGroup application name that the category was removed from or QString::null if it was the global CategoryGroup | 883 | \a appname is the CategoryGroup application name that the category was removed from or QString::null if it was the global CategoryGroup |
889 | \a uid is the unique identifier associated with the removed category | 884 | \a uid is the unique identifier associated with the removed category |
890 | */ | 885 | */ |
891 | 886 | ||
892 | 887 | ||
893 | /*! \fn void Categories::categoryRenamed( const Categories &cats, const QString &appname, | 888 | /*! \fn void Categories::categoryRenamed( const Categories &cats, const QString &appname, |
894 | int uid) | 889 | int uid) |
895 | 890 | ||
896 | Emitted if \a uid in the \a appname CategoryGroup is renamed in \a cats | 891 | Emitted if \a uid in the \a appname CategoryGroup is renamed in \a cats |
897 | object. | 892 | object. |
898 | 893 | ||
899 | \a cats is a const reference to this object | 894 | \a cats is a const reference to this object |
900 | \a appname is the CategoryGroup application name that the category was renamed in or QString::null if it was the global CategoryGroup | 895 | \a appname is the CategoryGroup application name that the category was renamed in or QString::null if it was the global CategoryGroup |
901 | \a uid is the unique identifier associated with the renamed category | 896 | \a uid is the unique identifier associated with the renamed category |
902 | */ | 897 | */ |
903 | 898 | ||
904 | /*! \fn Categories::Categories( QObject *parent=0, const char *name = 0 ) | 899 | /*! \fn Categories::Categories( QObject *parent=0, const char *name = 0 ) |
905 | 900 | ||
906 | Constructor for an empty Categories object. | 901 | Constructor for an empty Categories object. |
907 | */ | 902 | */ |
908 | 903 | ||
909 | /*! \fn Categories::Categories( const Categories ©From ) | 904 | /*! \fn Categories::Categories( const Categories ©From ) |
910 | 905 | ||
911 | Deep copy constructor | 906 | Deep copy constructor |
912 | */ | 907 | */ |
diff --git a/library/backend/categories.h b/library/backend/categories.h index ba65ee3..d5b3669 100644 --- a/library/backend/categories.h +++ b/library/backend/categories.h | |||
@@ -56,65 +56,65 @@ public: | |||
56 | bool remove( const QString &label ); | 56 | bool remove( const QString &label ); |
57 | bool remove( int uid ); | 57 | bool remove( int uid ); |
58 | 58 | ||
59 | bool rename( int uid, const QString &newLabel ); | 59 | bool rename( int uid, const QString &newLabel ); |
60 | bool rename( const QString &oldLabel, const QString &newLabel ); | 60 | bool rename( const QString &oldLabel, const QString &newLabel ); |
61 | 61 | ||
62 | bool contains(int id) const; | 62 | bool contains(int id) const; |
63 | bool contains(const QString &label) const; | 63 | bool contains(const QString &label) const; |
64 | 64 | ||
65 | /** Returns label associated with the uid or QString::null if | 65 | /** Returns label associated with the uid or QString::null if |
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 | 74 | ||
75 | QStringList labels( const QArray<int> &catids ) const; | 75 | QStringList labels( const QArray<int> &catids ) const; |
76 | 76 | ||
77 | const QMap<int, QString> &idMap() const { return mIdLabelMap; } | 77 | const QMap<int, QString> &idMap() const { return mIdLabelMap; } |
78 | 78 | ||
79 | private: | 79 | private: |
80 | void insert( int uid, const QString &label ); | 80 | void insert( int uid, const QString &label ); |
81 | QMap<int, QString> mIdLabelMap; | 81 | QMap<int, QString> mIdLabelMap; |
82 | QMap<QString, int> mLabelIdMap; | 82 | QMap<QString, int> mLabelIdMap; |
83 | 83 | ||
84 | static Qtopia::UidGen &uidGen() { return sUidGen; } | 84 | static Qtopia::UidGen &uidGen() { return sUidGen; } |
85 | static Qtopia::UidGen sUidGen; | 85 | static Qtopia::UidGen sUidGen; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | /** Map from application name to categories */ | 88 | /* Map from application name to categories */ |
89 | class QPC_EXPORT Categories : public QObject | 89 | class QPC_EXPORT Categories : public QObject |
90 | { | 90 | { |
91 | Q_OBJECT | 91 | Q_OBJECT |
92 | public: | 92 | public: |
93 | Categories( QObject *parent=0, const char *name = 0 ) | 93 | Categories( QObject *parent=0, const char *name = 0 ) |
94 | : QObject( parent, name ), mGlobalCats(), mAppCats() { } | 94 | : QObject( parent, name ), mGlobalCats(), mAppCats() { } |
95 | Categories( const Categories ©From ) : QObject( copyFrom.parent() ), | 95 | Categories( const Categories ©From ) : QObject( copyFrom.parent() ), |
96 | mGlobalCats( copyFrom.mGlobalCats ), | 96 | mGlobalCats( copyFrom.mGlobalCats ), |
97 | mAppCats( copyFrom.mAppCats ) { } | 97 | mAppCats( copyFrom.mAppCats ) { } |
98 | virtual ~Categories() { } | 98 | virtual ~Categories() { } |
99 | 99 | ||
100 | Categories &operator= ( const Categories &c ) | 100 | Categories &operator= ( const Categories &c ) |
101 | { mAppCats = c.mAppCats; mGlobalCats = c.mGlobalCats; return *this; } | 101 | { mAppCats = c.mAppCats; mGlobalCats = c.mGlobalCats; return *this; } |
102 | 102 | ||
103 | void clear(); | 103 | void clear(); |
104 | 104 | ||
105 | /** Add the category name as long as it doesn't already exist | 105 | /** Add the category name as long as it doesn't already exist |
106 | * locally or globally. Return UID if added, 0 if conflicts | 106 | * locally or globally. Return UID if added, 0 if conflicts |
107 | * (error). | 107 | * (error). |
108 | */ | 108 | */ |
109 | int addCategory( const QString &appname, const QString &catname); | 109 | int addCategory( const QString &appname, const QString &catname); |
110 | /** Add the category name as long as it doesn't already exist | 110 | /** Add the category name as long as it doesn't already exist |
111 | * locally or globally. Return UID if added, 0 if conflicts | 111 | * locally or globally. Return UID if added, 0 if conflicts |
112 | * (error). | 112 | * (error). |
113 | */ | 113 | */ |
114 | int addCategory( const QString &appname, const QString &catname, int uid); | 114 | int addCategory( const QString &appname, const QString &catname, int uid); |
115 | /** Add the global category just checking that it doesn't | 115 | /** Add the global category just checking that it doesn't |
116 | * already exist globally. Return UID if added, 0 if conflicts. | 116 | * already exist globally. Return UID if added, 0 if conflicts. |
117 | */ | 117 | */ |
118 | int addGlobalCategory( const QString &catname ); | 118 | int addGlobalCategory( const QString &catname ); |
119 | /** Add the global category just checking that it doesn't | 119 | /** Add the global category just checking that it doesn't |
120 | * already exist globally. Return UID if added, 0 if conflicts. | 120 | * already exist globally. Return UID if added, 0 if conflicts. |
diff --git a/library/backend/event.cpp b/library/backend/event.cpp index d906f19..4c24ab3 100644 --- a/library/backend/event.cpp +++ b/library/backend/event.cpp | |||
@@ -138,71 +138,71 @@ Qtopia::UidGen Event::sUidGen( Qtopia::UidGen::Qtopia ); | |||
138 | \enum Event::RepeatType | 138 | \enum Event::RepeatType |
139 | 139 | ||
140 | This enum defines how a event will repeat, if at all. | 140 | This enum defines how a event will repeat, if at all. |
141 | 141 | ||
142 | <ul> | 142 | <ul> |
143 | <li>\c NoRepeat - Event does not repeat. | 143 | <li>\c NoRepeat - Event does not repeat. |
144 | <li>\c Daily - Event occurs every n days. | 144 | <li>\c Daily - Event occurs every n days. |
145 | <li>\c Weekly - Event occurs every n weeks. | 145 | <li>\c Weekly - Event occurs every n weeks. |
146 | <li>\c MonthlyDay - Event occurs every n months. Event will always occur in | 146 | <li>\c MonthlyDay - Event occurs every n months. Event will always occur in |
147 | the same week and same day of week as the first event. | 147 | the same week and same day of week as the first event. |
148 | <li>\c MonthlyDate - Event occurs every n months. Event will always occur | 148 | <li>\c MonthlyDate - Event occurs every n months. Event will always occur |
149 | on the same day of the month as the first event. | 149 | on the same day of the month as the first event. |
150 | <li>\c Yearly - Event occurs every n years. | 150 | <li>\c Yearly - Event occurs every n years. |
151 | </ul> | 151 | </ul> |
152 | */ | 152 | */ |
153 | 153 | ||
154 | /*! | 154 | /*! |
155 | \fn bool Event::isAllDay() const | 155 | \fn bool Event::isAllDay() const |
156 | 156 | ||
157 | Returns TRUE if the event is an all day event. Otherwise returns FALSE. | 157 | Returns TRUE if the event is an all day event. Otherwise returns FALSE. |
158 | */ | 158 | */ |
159 | 159 | ||
160 | /*! | 160 | /*! |
161 | \fn void Event::setAllDay(bool allday) | 161 | \fn void Event::setAllDay(bool allday) |
162 | 162 | ||
163 | If \a allday is TRUE, will set the event to be an all day event. | 163 | If \a allday is TRUE, will set the event to be an all day event. |
164 | Otherwise sets the event to not be an all day event. | 164 | Otherwise sets the event to not be an all day event. |
165 | 165 | ||
166 | \warning This function may affect the start and end times of the event. | 166 | \warning This function may affect the start and end times of the event. |
167 | */ | 167 | */ |
168 | 168 | ||
169 | /*! | 169 | /*! |
170 | \fn QDateTime Event::start() const | 170 | \fn QDateTime Event::start(bool) const |
171 | 171 | ||
172 | Returns the start date and time of the first occurance of the event. | 172 | Returns the start date and time of the first occurance of the event. |
173 | */ | 173 | */ |
174 | 174 | ||
175 | /*! | 175 | /*! |
176 | \fn QDateTime Event::end() const | 176 | \fn QDateTime Event::end(bool) const |
177 | 177 | ||
178 | Returns the end date and time of the first occurance of the event. | 178 | Returns the end date and time of the first occurance of the event. |
179 | */ | 179 | */ |
180 | 180 | ||
181 | /*! | 181 | /*! |
182 | \fn time_t Event::startTime() const | 182 | \fn time_t Event::startTime() const |
183 | \internal | 183 | \internal |
184 | */ | 184 | */ |
185 | 185 | ||
186 | /*! | 186 | /*! |
187 | \fn time_t Event::endTime() const | 187 | \fn time_t Event::endTime() const |
188 | \internal | 188 | \internal |
189 | */ | 189 | */ |
190 | 190 | ||
191 | /*! | 191 | /*! |
192 | \fn void Event::setAlarm(int delay, SoundTypeChoice s) | 192 | \fn void Event::setAlarm(int delay, SoundTypeChoice s) |
193 | 193 | ||
194 | Sets the alarm delay of the event to \a delay and the sound type of the | 194 | Sets the alarm delay of the event to \a delay and the sound type of the |
195 | alarm to \a s. | 195 | alarm to \a s. |
196 | */ | 196 | */ |
197 | 197 | ||
198 | /*! | 198 | /*! |
199 | \fn void Event::clearAlarm() | 199 | \fn void Event::clearAlarm() |
200 | 200 | ||
201 | Clears the alarm for the event. | 201 | Clears the alarm for the event. |
202 | */ | 202 | */ |
203 | 203 | ||
204 | /*! | 204 | /*! |
205 | \fn int Event::alarmDelay() const | 205 | \fn int Event::alarmDelay() const |
206 | 206 | ||
207 | Returns the delay in minutes between the alarm for an event and the | 207 | Returns the delay in minutes between the alarm for an event and the |
208 | start of the event. | 208 | start of the event. |
diff --git a/library/backend/palmtoprecord.h b/library/backend/palmtoprecord.h index 72f7d1c..15cdd6a 100644 --- a/library/backend/palmtoprecord.h +++ b/library/backend/palmtoprecord.h | |||
@@ -3,67 +3,79 @@ | |||
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef QTPALMTOP_RECORD_H | 20 | #ifndef QTPALMTOP_RECORD_H |
21 | #define QTPALMTOP_RECORD_H | 21 | #define QTPALMTOP_RECORD_H |
22 | #include <qglobal.h> | 22 | #include <qglobal.h> |
23 | #include "qpcglobal.h" | 23 | #include "qpcglobal.h" |
24 | #include "palmtopuidgen.h" | 24 | #include "palmtopuidgen.h" |
25 | #include <qarray.h> | 25 | #include <qarray.h> |
26 | #include <qmap.h> | 26 | #include <qmap.h> |
27 | 27 | ||
28 | #if defined(QPC_TEMPLATEDLL) | 28 | #if defined(QPC_TEMPLATEDLL) |
29 | // MOC_SKIP_BEGIN | 29 | // MOC_SKIP_BEGIN |
30 | QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<QString, QString>; | 30 | QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<QString, QString>; |
31 | // MOC_SKIP_END | 31 | // MOC_SKIP_END |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | class QRegExp; | 34 | class QRegExp; |
35 | /** | ||
36 | * @short Qtopia namespace | ||
37 | * The namespace of Qtopia | ||
38 | */ | ||
35 | namespace Qtopia { | 39 | namespace Qtopia { |
36 | 40 | ||
37 | class RecordPrivate; | 41 | class RecordPrivate; |
42 | /** | ||
43 | * @short The base class of all Records | ||
44 | * | ||
45 | * The base class for Records in Qtopia | ||
46 | * @see Task | ||
47 | * @see Event | ||
48 | * @see Contact | ||
49 | */ | ||
38 | class QPC_EXPORT Record | 50 | class QPC_EXPORT Record |
39 | { | 51 | { |
40 | public: | 52 | public: |
41 | Record() : mUid(0), mCats() { } | 53 | Record() : mUid(0), mCats() { } |
42 | Record( const Record &c ) :mUid( c.mUid ), mCats ( c.mCats ), customMap(c.customMap) { } | 54 | Record( const Record &c ) :mUid( c.mUid ), mCats ( c.mCats ), customMap(c.customMap) { } |
43 | virtual ~Record() { } | 55 | virtual ~Record() { } |
44 | 56 | ||
45 | Record &operator=( const Record &c ); | 57 | Record &operator=( const Record &c ); |
46 | 58 | ||
47 | virtual bool match( const QRegExp & ) const { return FALSE; } | 59 | virtual bool match( const QRegExp & ) const { return FALSE; } |
48 | 60 | ||
49 | void setCategories( const QArray<int> &v ) { mCats = v; mCats.sort(); } | 61 | void setCategories( const QArray<int> &v ) { mCats = v; mCats.sort(); } |
50 | void setCategories( int single ); | 62 | void setCategories( int single ); |
51 | const QArray<int> &categories() const { return mCats; } | 63 | const QArray<int> &categories() const { return mCats; } |
52 | 64 | ||
53 | void reassignCategoryId( int oldId, int newId ) | 65 | void reassignCategoryId( int oldId, int newId ) |
54 | { | 66 | { |
55 | int index = mCats.find( oldId ); | 67 | int index = mCats.find( oldId ); |
56 | if ( index >= 0 ) | 68 | if ( index >= 0 ) |
57 | mCats[index] = newId; | 69 | mCats[index] = newId; |
58 | } | 70 | } |
59 | 71 | ||
60 | int uid() const { return mUid; }; | 72 | int uid() const { return mUid; }; |
61 | virtual void setUid( int i ) { mUid = i; uidGen().store( mUid ); } | 73 | virtual void setUid( int i ) { mUid = i; uidGen().store( mUid ); } |
62 | bool isValidUid() const { return mUid != 0; } | 74 | bool isValidUid() const { return mUid != 0; } |
63 | void assignUid() { setUid( uidGen().generate() ); } | 75 | void assignUid() { setUid( uidGen().generate() ); } |
64 | 76 | ||
65 | virtual QString customField(const QString &) const; | 77 | virtual QString customField(const QString &) const; |
66 | virtual void setCustomField(const QString &, const QString &); | 78 | virtual void setCustomField(const QString &, const QString &); |
67 | virtual void removeCustomField(const QString &); | 79 | virtual void removeCustomField(const QString &); |
68 | 80 | ||
69 | virtual bool operator == ( const Record &r ) const | 81 | virtual bool operator == ( const Record &r ) const |
diff --git a/library/datebookdb.cpp b/library/datebookdb.cpp index 0fedfa8..2f33255 100644 --- a/library/datebookdb.cpp +++ b/library/datebookdb.cpp | |||
@@ -42,65 +42,65 @@ public: | |||
42 | bool clean; // indcate whether we need to write to disk... | 42 | bool clean; // indcate whether we need to write to disk... |
43 | }; | 43 | }; |
44 | 44 | ||
45 | 45 | ||
46 | // Helper functions | 46 | // Helper functions |
47 | 47 | ||
48 | static QString dateBookJournalFile() | 48 | static QString dateBookJournalFile() |
49 | { | 49 | { |
50 | QString str = getenv("HOME"); | 50 | QString str = getenv("HOME"); |
51 | return QString( str +"/.caljournal" ); | 51 | return QString( str +"/.caljournal" ); |
52 | } | 52 | } |
53 | 53 | ||
54 | static QString dateBookFilename() | 54 | static QString dateBookFilename() |
55 | { | 55 | { |
56 | return Global::applicationFileName("datebook","datebook.xml"); | 56 | return Global::applicationFileName("datebook","datebook.xml"); |
57 | } | 57 | } |
58 | 58 | ||
59 | /* Calculating the next event of a recuring event is actually | 59 | /* Calculating the next event of a recuring event is actually |
60 | computationally inexpensive, esp. compared to checking each day | 60 | computationally inexpensive, esp. compared to checking each day |
61 | individually. There are bad worse cases for say the 29th of | 61 | individually. There are bad worse cases for say the 29th of |
62 | february or the 31st of some other months. However | 62 | february or the 31st of some other months. However |
63 | these are still bounded */ | 63 | these are still bounded */ |
64 | bool nextOccurance(const Event &e, const QDate &from, QDateTime &next) | 64 | bool nextOccurance(const Event &e, const QDate &from, QDateTime &next) |
65 | { | 65 | { |
66 | // easy checks, first are we too far in the future or too far in the past? | 66 | // easy checks, first are we too far in the future or too far in the past? |
67 | QDate tmpDate; | 67 | QDate tmpDate; |
68 | int freq = e.repeatPattern().frequency; | 68 | int freq = e.repeatPattern().frequency; |
69 | int diff, diff2, a; | 69 | int diff, diff2, a; |
70 | int iday, imonth, iyear; | 70 | int iday, imonth, iyear; |
71 | int dayOfWeek = 0; | 71 | int dayOfWeek = 0; |
72 | int firstOfWeek = 0; | 72 | int firstOfWeek = 0; |
73 | int weekOfMonth; | 73 | int weekOfMonth; |
74 | 74 | ||
75 | 75 | ||
76 | if (e.repeatPattern().hasEndDate && e.repeatPattern().endDate() < from) | 76 | if (e.repeatPattern().hasEndDate && e.repeatPattern().endDate() < from) |
77 | return FALSE; | 77 | return FALSE; |
78 | 78 | ||
79 | if (e.start() >= from) { | 79 | if (e.start() >= from) { |
80 | next = e.start(); | 80 | next = e.start(); |
81 | return TRUE; | 81 | return TRUE; |
82 | } | 82 | } |
83 | 83 | ||
84 | switch ( e.repeatPattern().type ) { | 84 | switch ( e.repeatPattern().type ) { |
85 | case Event::Weekly: | 85 | case Event::Weekly: |
86 | /* weekly is just daily by 7 */ | 86 | /* weekly is just daily by 7 */ |
87 | /* first convert the repeatPattern.Days() mask to the next | 87 | /* first convert the repeatPattern.Days() mask to the next |
88 | day of week valid after from */ | 88 | day of week valid after from */ |
89 | dayOfWeek = from.dayOfWeek(); | 89 | dayOfWeek = from.dayOfWeek(); |
90 | dayOfWeek--; /* we want 0-6, doco for above specs 1-7 */ | 90 | dayOfWeek--; /* we want 0-6, doco for above specs 1-7 */ |
91 | 91 | ||
92 | /* this is done in case freq > 1 and from in week not | 92 | /* this is done in case freq > 1 and from in week not |
93 | for this round */ | 93 | for this round */ |
94 | // firstOfWeek = 0; this is already done at decl. | 94 | // firstOfWeek = 0; this is already done at decl. |
95 | while(!((1 << firstOfWeek) & e.repeatPattern().days)) | 95 | while(!((1 << firstOfWeek) & e.repeatPattern().days)) |
96 | firstOfWeek++; | 96 | firstOfWeek++; |
97 | 97 | ||
98 | /* there is at least one 'day', or there would be no event */ | 98 | /* there is at least one 'day', or there would be no event */ |
99 | while(!((1 << (dayOfWeek % 7)) & e.repeatPattern().days)) | 99 | while(!((1 << (dayOfWeek % 7)) & e.repeatPattern().days)) |
100 | dayOfWeek++; | 100 | dayOfWeek++; |
101 | 101 | ||
102 | dayOfWeek = dayOfWeek % 7; /* the actual day of week */ | 102 | dayOfWeek = dayOfWeek % 7; /* the actual day of week */ |
103 | dayOfWeek -= e.start().date().dayOfWeek() -1; | 103 | dayOfWeek -= e.start().date().dayOfWeek() -1; |
104 | 104 | ||
105 | firstOfWeek = firstOfWeek % 7; /* the actual first of week */ | 105 | firstOfWeek = firstOfWeek % 7; /* the actual first of week */ |
106 | firstOfWeek -= e.start().date().dayOfWeek() -1; | 106 | firstOfWeek -= e.start().date().dayOfWeek() -1; |
@@ -432,110 +432,110 @@ QValueList<Event> DateBookDB::getEvents( const QDate &from, const QDate &to ) | |||
432 | qHeapSort(tmpList); | 432 | qHeapSort(tmpList); |
433 | return tmpList; | 433 | return tmpList; |
434 | } | 434 | } |
435 | 435 | ||
436 | QValueList<Event> DateBookDB::getEvents( const QDateTime &start ) | 436 | QValueList<Event> DateBookDB::getEvents( const QDateTime &start ) |
437 | { | 437 | { |
438 | QValueList<Event> day = getEvents(start.date(),start.date()); | 438 | QValueList<Event> day = getEvents(start.date(),start.date()); |
439 | 439 | ||
440 | QValueListConstIterator<Event> it; | 440 | QValueListConstIterator<Event> it; |
441 | QDateTime dtTmp; | 441 | QDateTime dtTmp; |
442 | QValueList<Event> tmpList; | 442 | QValueList<Event> tmpList; |
443 | for (it = day.begin(); it != day.end(); ++it ) { | 443 | for (it = day.begin(); it != day.end(); ++it ) { |
444 | dtTmp = (*it).start(TRUE); | 444 | dtTmp = (*it).start(TRUE); |
445 | if ( dtTmp == start ) | 445 | if ( dtTmp == start ) |
446 | tmpList.append( *it ); | 446 | tmpList.append( *it ); |
447 | } | 447 | } |
448 | return tmpList; | 448 | return tmpList; |
449 | } | 449 | } |
450 | 450 | ||
451 | //#### Why is this code duplicated in getEvents ????? | 451 | //#### Why is this code duplicated in getEvents ????? |
452 | 452 | ||
453 | QValueList<EffectiveEvent> DateBookDB::getEffectiveEvents( const QDate &from, | 453 | QValueList<EffectiveEvent> DateBookDB::getEffectiveEvents( const QDate &from, |
454 | const QDate &to ) | 454 | const QDate &to ) |
455 | { | 455 | { |
456 | QValueList<EffectiveEvent> tmpList; | 456 | QValueList<EffectiveEvent> tmpList; |
457 | QValueListIterator<Event> it; | 457 | QValueListIterator<Event> it; |
458 | 458 | ||
459 | EffectiveEvent effEv; | 459 | EffectiveEvent effEv; |
460 | QDateTime dtTmp, | 460 | QDateTime dtTmp, |
461 | dtEnd; | 461 | dtEnd; |
462 | 462 | ||
463 | for (it = eventList.begin(); it != eventList.end(); ++it ) { | 463 | for (it = eventList.begin(); it != eventList.end(); ++it ) { |
464 | if (!(*it).isValidUid()) | 464 | if (!(*it).isValidUid()) |
465 | (*it).assignUid(); // FIXME: Hack to restore cleared uids | 465 | (*it).assignUid(); // FIXME: Hack to restore cleared uids |
466 | 466 | ||
467 | dtTmp = (*it).start(TRUE); | 467 | dtTmp = (*it).start(TRUE); |
468 | dtEnd = (*it).end(TRUE); | 468 | dtEnd = (*it).end(TRUE); |
469 | 469 | ||
470 | if ( dtTmp.date() >= from && dtTmp.date() <= to ) { | 470 | if ( dtTmp.date() >= from && dtTmp.date() <= to ) { |
471 | Event tmpEv = *it; | 471 | Event tmpEv = *it; |
472 | effEv.setEvent(tmpEv); | 472 | effEv.setEvent(tmpEv); |
473 | effEv.setDate( dtTmp.date() ); | 473 | effEv.setDate( dtTmp.date() ); |
474 | effEv.setStart( dtTmp.time() ); | 474 | effEv.setStart( dtTmp.time() ); |
475 | if ( dtTmp.date() != dtEnd.date() ) | 475 | if ( dtTmp.date() != dtEnd.date() ) |
476 | effEv.setEnd( QTime(23, 59, 0) ); | 476 | effEv.setEnd( QTime(23, 59, 0) ); |
477 | else | 477 | else |
478 | effEv.setEnd( dtEnd.time() ); | 478 | effEv.setEnd( dtEnd.time() ); |
479 | tmpList.append( effEv ); | 479 | tmpList.append( effEv ); |
480 | } | 480 | } |
481 | // we must also check for end date information... | 481 | // we must also check for end date information... |
482 | if ( dtEnd.date() != dtTmp.date() && dtEnd.date() >= from ) { | 482 | if ( dtEnd.date() != dtTmp.date() && dtEnd.date() >= from ) { |
483 | QDateTime dt = dtTmp.addDays( 1 ); | 483 | QDateTime dt = dtTmp.addDays( 1 ); |
484 | dt.setTime( QTime(0, 0, 0) ); | 484 | dt.setTime( QTime(0, 0, 0) ); |
485 | QDateTime dtStop; | 485 | QDateTime dtStop; |
486 | if ( dtEnd > to ) { | 486 | if ( dtEnd > to ) { |
487 | dtStop = to; | 487 | dtStop = to; |
488 | } else | 488 | } else |
489 | dtStop = dtEnd; | 489 | dtStop = dtEnd; |
490 | while ( dt <= dtStop ) { | 490 | while ( dt <= dtStop ) { |
491 | Event tmpEv = *it; | 491 | Event tmpEv = *it; |
492 | effEv.setEvent( tmpEv ); | 492 | effEv.setEvent( tmpEv ); |
493 | effEv.setDate( dt.date() ); | 493 | effEv.setDate( dt.date() ); |
494 | if ( dt >= from ) { | 494 | if ( dt >= from ) { |
495 | effEv.setStart( QTime(0, 0, 0) ); | 495 | effEv.setStart( QTime(0, 0, 0) ); |
496 | if ( dt.date() == dtEnd.date() ) | 496 | if ( dt.date() == dtEnd.date() ) |
497 | effEv.setEnd( dtEnd.time() ); | 497 | effEv.setEnd( dtEnd.time() ); |
498 | else | 498 | else |
499 | effEv.setEnd( QTime(23, 59, 59) ); | 499 | effEv.setEnd( QTime(23, 59, 59) ); |
500 | tmpList.append( effEv ); | 500 | tmpList.append( effEv ); |
501 | } | 501 | } |
502 | dt = dt.addDays( 1 ); | 502 | dt = dt.addDays( 1 ); |
503 | } | 503 | } |
504 | } | 504 | } |
505 | } | 505 | } |
506 | // check for repeating events... | 506 | // check for repeating events... |
507 | QDateTime repeat; | 507 | QDateTime repeat; |
508 | for ( it = repeatEvents.begin(); it != repeatEvents.end(); ++it ) { | 508 | for ( it = repeatEvents.begin(); it != repeatEvents.end(); ++it ) { |
509 | if (!(*it).isValidUid()) | 509 | if (!(*it).isValidUid()) |
510 | (*it).assignUid(); // FIXME: Hack to restore cleared uids | 510 | (*it).assignUid(); // FIXME: Hack to restore cleared uids |
511 | 511 | ||
512 | /* create a false end date, to short circuit on hard | 512 | /* create a false end date, to short circuit on hard |
513 | MonthlyDay recurences */ | 513 | MonthlyDay recurences */ |
514 | Event dummy_event = *it; | 514 | Event dummy_event = *it; |
515 | int duration = (*it).start().date().daysTo( (*it).end().date() ); | 515 | int duration = (*it).start().date().daysTo( (*it).end().date() ); |
516 | QDate itDate = from.addDays(-duration); | 516 | QDate itDate = from.addDays(-duration); |
517 | 517 | ||
518 | Event::RepeatPattern r = dummy_event.repeatPattern(); | 518 | Event::RepeatPattern r = dummy_event.repeatPattern(); |
519 | if ( !r.hasEndDate || r.endDate() > to ) { | 519 | if ( !r.hasEndDate || r.endDate() > to ) { |
520 | r.setEndDate( to ); | 520 | r.setEndDate( to ); |
521 | r.hasEndDate = TRUE; | 521 | r.hasEndDate = TRUE; |
522 | } | 522 | } |
523 | dummy_event.setRepeat(TRUE, r); | 523 | dummy_event.setRepeat(TRUE, r); |
524 | 524 | ||
525 | while (nextOccurance(dummy_event, itDate, repeat)) { | 525 | while (nextOccurance(dummy_event, itDate, repeat)) { |
526 | if(repeat.date() > to) | 526 | if(repeat.date() > to) |
527 | break; | 527 | break; |
528 | effEv.setDate( repeat.date() ); | 528 | effEv.setDate( repeat.date() ); |
529 | if ((*it).type() == Event::AllDay) { | 529 | if ((*it).type() == Event::AllDay) { |
530 | effEv.setStart( QTime(0,0,0) ); | 530 | effEv.setStart( QTime(0,0,0) ); |
531 | effEv.setEnd( QTime(23,59,59) ); | 531 | effEv.setEnd( QTime(23,59,59) ); |
532 | } else { | 532 | } else { |
533 | /* we only occur by days, not hours/minutes/seconds. Hence | 533 | /* we only occur by days, not hours/minutes/seconds. Hence |
534 | the actual end and start times will be the same for | 534 | the actual end and start times will be the same for |
535 | every repeated event. For multi day events this is | 535 | every repeated event. For multi day events this is |
536 | fixed up later if on wronge day span */ | 536 | fixed up later if on wronge day span */ |
537 | effEv.setStart( (*it).start().time() ); | 537 | effEv.setStart( (*it).start().time() ); |
538 | effEv.setEnd( (*it).end().time() ); | 538 | effEv.setEnd( (*it).end().time() ); |
539 | } | 539 | } |
540 | if ( duration != 0 ) { | 540 | if ( duration != 0 ) { |
541 | // multi-day repeating events | 541 | // multi-day repeating events |
@@ -594,165 +594,165 @@ void DateBookDB::addEvent( const Event &ev, bool doalarm ) | |||
594 | addJFEvent( ev, doalarm ); | 594 | addJFEvent( ev, doalarm ); |
595 | d->clean = false; | 595 | d->clean = false; |
596 | } | 596 | } |
597 | 597 | ||
598 | void DateBookDB::addJFEvent( const Event &ev, bool doalarm ) | 598 | void DateBookDB::addJFEvent( const Event &ev, bool doalarm ) |
599 | { | 599 | { |
600 | if ( doalarm && ev.hasAlarm() ) | 600 | if ( doalarm && ev.hasAlarm() ) |
601 | addEventAlarm( ev ); | 601 | addEventAlarm( ev ); |
602 | if ( ev.hasRepeat() ) | 602 | if ( ev.hasRepeat() ) |
603 | repeatEvents.append( ev ); | 603 | repeatEvents.append( ev ); |
604 | else | 604 | else |
605 | eventList.append( ev ); | 605 | eventList.append( ev ); |
606 | } | 606 | } |
607 | 607 | ||
608 | void DateBookDB::editEvent( const Event &old, Event &editedEv ) | 608 | void DateBookDB::editEvent( const Event &old, Event &editedEv ) |
609 | { | 609 | { |
610 | int oldIndex=0; | 610 | int oldIndex=0; |
611 | bool oldHadRepeat = old.hasRepeat(); | 611 | bool oldHadRepeat = old.hasRepeat(); |
612 | Event orig; | 612 | Event orig; |
613 | 613 | ||
614 | // write to the journal... | 614 | // write to the journal... |
615 | if ( oldHadRepeat ) { | 615 | if ( oldHadRepeat ) { |
616 | if ( origRepeat( old, orig ) ) // should work always... | 616 | if ( origRepeat( old, orig ) ) // should work always... |
617 | oldIndex = repeatEvents.findIndex( orig ); | 617 | oldIndex = repeatEvents.findIndex( orig ); |
618 | } else | 618 | } else |
619 | oldIndex = eventList.findIndex( old ); | 619 | oldIndex = eventList.findIndex( old ); |
620 | saveJournalEntry( editedEv, ACTION_REPLACE, oldIndex, oldHadRepeat ); | 620 | saveJournalEntry( editedEv, ACTION_REPLACE, oldIndex, oldHadRepeat ); |
621 | 621 | ||
622 | // Delete old event | 622 | // Delete old event |
623 | if ( old.hasAlarm() ) | 623 | if ( old.hasAlarm() ) |
624 | delEventAlarm( old ); | 624 | delEventAlarm( old ); |
625 | if ( oldHadRepeat ) { | 625 | if ( oldHadRepeat ) { |
626 | if ( editedEv.hasRepeat() ) { // This mean that origRepeat was run above and | 626 | if ( editedEv.hasRepeat() ) { // This mean that origRepeat was run above and |
627 | // orig is initialized | 627 | // orig is initialized |
628 | // assumption, when someone edits a repeating event, they | 628 | // assumption, when someone edits a repeating event, they |
629 | // want to change them all, maybe not perfect, but it works | 629 | // want to change them all, maybe not perfect, but it works |
630 | // for the moment... | 630 | // for the moment... |
631 | repeatEvents.remove( orig ); | 631 | repeatEvents.remove( orig ); |
632 | } else | 632 | } else |
633 | removeRepeat( old ); | 633 | removeRepeat( old ); |
634 | } else { | 634 | } else { |
635 | QValueList<Event>::Iterator it = eventList.find( old ); | 635 | QValueList<Event>::Iterator it = eventList.find( old ); |
636 | if ( it != eventList.end() ) | 636 | if ( it != eventList.end() ) |
637 | eventList.remove( it ); | 637 | eventList.remove( it ); |
638 | } | 638 | } |
639 | 639 | ||
640 | // Add new event | 640 | // Add new event |
641 | if ( editedEv.hasAlarm() ) | 641 | if ( editedEv.hasAlarm() ) |
642 | addEventAlarm( editedEv ); | 642 | addEventAlarm( editedEv ); |
643 | if ( editedEv.hasRepeat() ) | 643 | if ( editedEv.hasRepeat() ) |
644 | repeatEvents.append( editedEv ); | 644 | repeatEvents.append( editedEv ); |
645 | else | 645 | else |
646 | eventList.append( editedEv ); | 646 | eventList.append( editedEv ); |
647 | 647 | ||
648 | d->clean = false; | 648 | d->clean = false; |
649 | } | 649 | } |
650 | 650 | ||
651 | void DateBookDB::removeEvent( const Event &ev ) | 651 | void DateBookDB::removeEvent( const Event &ev ) |
652 | { | 652 | { |
653 | // write to the journal... | 653 | // write to the journal... |
654 | saveJournalEntry( ev, ACTION_REMOVE, -1, false ); | 654 | saveJournalEntry( ev, ACTION_REMOVE, -1, false ); |
655 | removeJFEvent( ev ); | 655 | removeJFEvent( ev ); |
656 | d->clean = false; | 656 | d->clean = false; |
657 | } | 657 | } |
658 | 658 | ||
659 | void DateBookDB::removeJFEvent( const Event&ev ) | 659 | void DateBookDB::removeJFEvent( const Event&ev ) |
660 | { | 660 | { |
661 | if ( ev.hasAlarm() ) | 661 | if ( ev.hasAlarm() ) |
662 | delEventAlarm( ev ); | 662 | delEventAlarm( ev ); |
663 | if ( ev.hasRepeat() ) { | 663 | if ( ev.hasRepeat() ) { |
664 | removeRepeat( ev ); | 664 | removeRepeat( ev ); |
665 | } else { | 665 | } else { |
666 | QValueList<Event>::Iterator it = eventList.find( ev ); | 666 | QValueList<Event>::Iterator it = eventList.find( ev ); |
667 | if ( it != eventList.end() ) | 667 | if ( it != eventList.end() ) |
668 | eventList.remove( it ); | 668 | eventList.remove( it ); |
669 | } | 669 | } |
670 | } | 670 | } |
671 | 671 | ||
672 | // also handles journaling... | 672 | // also handles journaling... |
673 | void DateBookDB::loadFile( const QString &strFile ) | 673 | void DateBookDB::loadFile( const QString &strFile ) |
674 | { | 674 | { |
675 | 675 | ||
676 | QFile f( strFile ); | 676 | QFile f( strFile ); |
677 | if ( !f.open( IO_ReadOnly ) ) | 677 | if ( !f.open( IO_ReadOnly ) ) |
678 | return; | 678 | return; |
679 | 679 | ||
680 | enum Attribute { | 680 | enum Attribute { |
681 | FDescription = 0, | 681 | FDescription = 0, |
682 | FLocation, | 682 | FLocation, |
683 | FCategories, | 683 | FCategories, |
684 | FUid, | 684 | FUid, |
685 | FType, | 685 | FType, |
686 | FAlarm, | 686 | FAlarm, |
687 | FSound, | 687 | FSound, |
688 | FRType, | 688 | FRType, |
689 | FRWeekdays, | 689 | FRWeekdays, |
690 | FRPosition, | 690 | FRPosition, |
691 | FRFreq, | 691 | FRFreq, |
692 | FRHasEndDate, | 692 | FRHasEndDate, |
693 | FREndDate, | 693 | FREndDate, |
694 | FRStart, | 694 | FRStart, |
695 | FREnd, | 695 | FREnd, |
696 | FNote, | 696 | FNote, |
697 | FCreated, | 697 | FCreated, |
698 | FAction, | 698 | FAction, |
699 | FActionKey, | 699 | FActionKey, |
700 | FJournalOrigHadRepeat | 700 | FJournalOrigHadRepeat |
701 | }; | 701 | }; |
702 | 702 | ||
703 | QAsciiDict<int> dict( 97 ); | 703 | QAsciiDict<int> dict( 97 ); |
704 | dict.setAutoDelete( TRUE ); | 704 | dict.setAutoDelete( TRUE ); |
705 | dict.insert( "description", new int(FDescription) ); | 705 | dict.insert( "description", new int(FDescription) ); |
706 | dict.insert( "location", new int(FLocation) ); | 706 | dict.insert( "location", new int(FLocation) ); |
707 | dict.insert( "categories", new int(FCategories) ); | 707 | dict.insert( "categories", new int(FCategories) ); |
708 | dict.insert( "uid", new int(FUid) ); | 708 | dict.insert( "uid", new int(FUid) ); |
709 | dict.insert( "type", new int(FType) ); | 709 | dict.insert( "type", new int(FType) ); |
710 | dict.insert( "alarm", new int(FAlarm) ); | 710 | dict.insert( "alarm", new int(FAlarm) ); |
711 | dict.insert( "sound", new int(FSound) ); | 711 | dict.insert( "sound", new int(FSound) ); |
712 | dict.insert( "rtype", new int(FRType) ); | 712 | dict.insert( "rtype", new int(FRType) ); |
713 | dict.insert( "rweekdays", new int(FRWeekdays) ); | 713 | dict.insert( "rweekdays", new int(FRWeekdays) ); |
714 | dict.insert( "rposition", new int(FRPosition) ); | 714 | dict.insert( "rposition", new int(FRPosition) ); |
715 | dict.insert( "rfreq", new int(FRFreq) ); | 715 | dict.insert( "rfreq", new int(FRFreq) ); |
716 | dict.insert( "rhasenddate", new int(FRHasEndDate) ); | 716 | dict.insert( "rhasenddate", new int(FRHasEndDate) ); |
717 | dict.insert( "enddt", new int(FREndDate) ); | 717 | dict.insert( "enddt", new int(FREndDate) ); |
718 | dict.insert( "start", new int(FRStart) ); | 718 | dict.insert( "start", new int(FRStart) ); |
719 | dict.insert( "end", new int(FREnd) ); | 719 | dict.insert( "end", new int(FREnd) ); |
720 | dict.insert( "note", new int(FNote) ); | 720 | dict.insert( "note", new int(FNote) ); |
721 | dict.insert( "created", new int(FCreated) ); | 721 | dict.insert( "created", new int(FCreated) ); |
722 | dict.insert( "action", new int(FAction) ); | 722 | dict.insert( "action", new int(FAction) ); |
723 | dict.insert( "actionkey", new int(FActionKey) ); | 723 | dict.insert( "actionkey", new int(FActionKey) ); |
724 | dict.insert( "actionorig", new int (FJournalOrigHadRepeat) ); | 724 | dict.insert( "actionorig", new int (FJournalOrigHadRepeat) ); |
725 | 725 | ||
726 | 726 | ||
727 | QByteArray ba = f.readAll(); | 727 | QByteArray ba = f.readAll(); |
728 | char* dt = ba.data(); | 728 | char* dt = ba.data(); |
729 | int len = ba.size(); | 729 | int len = ba.size(); |
730 | int currentAction, | 730 | int currentAction, |
731 | journalKey, | 731 | journalKey, |
732 | origHadRepeat; // should be bool, but we need tri-state(not being used) | 732 | origHadRepeat; // should be bool, but we need tri-state(not being used) |
733 | 733 | ||
734 | int i = 0; | 734 | int i = 0; |
735 | char *point; | 735 | char *point; |
736 | // hack to get rid of segfaults after reading </DATEBOOK> | 736 | // hack to get rid of segfaults after reading </DATEBOOK> |
737 | while ( (dt+i != 0) && (( point = strstr( dt+i, "<event " ) ) != 0 )) { | 737 | while ( (dt+i != 0) && (( point = strstr( dt+i, "<event " ) ) != 0 )) { |
738 | i = point - dt; | 738 | i = point - dt; |
739 | // if we are reading in events in the general case, | 739 | // if we are reading in events in the general case, |
740 | // we are just adding them, so let the actions represent that... | 740 | // we are just adding them, so let the actions represent that... |
741 | currentAction = ACTION_ADD; | 741 | currentAction = ACTION_ADD; |
742 | journalKey = -1; | 742 | journalKey = -1; |
743 | origHadRepeat = -1; | 743 | origHadRepeat = -1; |
744 | // some temporary variables for dates and times ... | 744 | // some temporary variables for dates and times ... |
745 | //int startY = 0, startM = 0, startD = 0, starth = 0, startm = 0, starts = 0; | 745 | //int startY = 0, startM = 0, startD = 0, starth = 0, startm = 0, starts = 0; |
746 | //int endY = 0, endM = 0, endD = 0, endh = 0, endm = 0, ends = 0; | 746 | //int endY = 0, endM = 0, endD = 0, endh = 0, endm = 0, ends = 0; |
747 | //int enddtY = 0, enddtM = 0, enddtD = 0; | 747 | //int enddtY = 0, enddtM = 0, enddtD = 0; |
748 | 748 | ||
749 | // ... for the alarm settings ... | 749 | // ... for the alarm settings ... |
750 | int alarmTime = -1; Event::SoundTypeChoice alarmSound = Event::Silent; | 750 | int alarmTime = -1; Event::SoundTypeChoice alarmSound = Event::Silent; |
751 | // ... and for the recurrence | 751 | // ... and for the recurrence |
752 | Event::RepeatPattern rp; | 752 | Event::RepeatPattern rp; |
753 | Event e; | 753 | Event e; |
754 | 754 | ||
755 | i += 7; | 755 | i += 7; |
756 | 756 | ||
757 | while( 1 ) { | 757 | while( 1 ) { |
758 | while ( i < len && (dt[i] == ' ' || dt[i] == '\n' || dt[i] == '\r') ) | 758 | while ( i < len && (dt[i] == ' ' || dt[i] == '\n' || dt[i] == '\r') ) |
diff --git a/library/finddialog.cpp b/library/finddialog.cpp index d9f430a..ddf41a7 100644 --- a/library/finddialog.cpp +++ b/library/finddialog.cpp | |||
@@ -1,62 +1,69 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | 21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT |
22 | // have this class. | 22 | // have this class. |
23 | #define QTOPIA_INTERNAL_FD | 23 | #define QTOPIA_INTERNAL_FD |
24 | 24 | ||
25 | #include "finddialog.h" | 25 | #include "finddialog.h" |
26 | #include "findwidget_p.h" | 26 | #include "findwidget_p.h" |
27 | 27 | ||
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | 30 | ||
31 | /*! | ||
32 | \class FindDialog finddialog.h | ||
33 | \brief A simple FindDialog | ||
34 | |||
35 | A find dialog. FIXME!!!! | ||
36 | |||
37 | */ | ||
31 | FindDialog::FindDialog( const QString &appName, QWidget *parent, | 38 | FindDialog::FindDialog( const QString &appName, QWidget *parent, |
32 | const char *name, bool modal ) | 39 | const char *name, bool modal ) |
33 | : QDialog( parent, name, modal ) | 40 | : QDialog( parent, name, modal ) |
34 | { | 41 | { |
35 | setCaption( tr("Find") ); | 42 | setCaption( tr("Find") ); |
36 | QVBoxLayout *vb; | 43 | QVBoxLayout *vb; |
37 | vb = new QVBoxLayout( this ); | 44 | vb = new QVBoxLayout( this ); |
38 | fw = new FindWidget( appName, this, "Find Widget" ); | 45 | fw = new FindWidget( appName, this, "Find Widget" ); |
39 | vb->addWidget( fw ); | 46 | vb->addWidget( fw ); |
40 | QObject::connect( fw, SIGNAL(signalFindClicked(const QString&, | 47 | QObject::connect( fw, SIGNAL(signalFindClicked(const QString&, |
41 | bool,bool,int)), | 48 | bool,bool,int)), |
42 | this, SIGNAL(signalFindClicked(const QString&, | 49 | this, SIGNAL(signalFindClicked(const QString&, |
43 | bool,bool,int)) ); | 50 | bool,bool,int)) ); |
44 | QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,const QDate&, | 51 | QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,const QDate&, |
45 | bool,bool,int)), | 52 | bool,bool,int)), |
46 | this, SIGNAL(signalFindClicked(const QString&, | 53 | this, SIGNAL(signalFindClicked(const QString&, |
47 | const QDate&,bool,bool,int)) ); | 54 | const QDate&,bool,bool,int)) ); |
48 | d = 0; | 55 | d = 0; |
49 | } | 56 | } |
50 | 57 | ||
51 | FindDialog::~FindDialog() | 58 | FindDialog::~FindDialog() |
52 | { | 59 | { |
53 | } | 60 | } |
54 | 61 | ||
55 | QString FindDialog::findText() const | 62 | QString FindDialog::findText() const |
56 | { | 63 | { |
57 | return fw->findText(); | 64 | return fw->findText(); |
58 | } | 65 | } |
59 | 66 | ||
60 | void FindDialog::setUseDate( bool show ) | 67 | void FindDialog::setUseDate( bool show ) |
61 | { | 68 | { |
62 | fw->setUseDate( show ); | 69 | fw->setUseDate( show ); |
diff --git a/library/global.cpp b/library/global.cpp index 68a3a75..ce39751 100644 --- a/library/global.cpp +++ b/library/global.cpp | |||
@@ -81,65 +81,65 @@ public: | |||
81 | emit setDocument(document); | 81 | emit setDocument(document); |
82 | disconnect(this, SIGNAL(setDocument(const QString&)), | 82 | disconnect(this, SIGNAL(setDocument(const QString&)), |
83 | receiver, SLOT(setDocument(const QString&))); | 83 | receiver, SLOT(setDocument(const QString&))); |
84 | } | 84 | } |
85 | 85 | ||
86 | signals: | 86 | signals: |
87 | void setDocument(const QString&); | 87 | void setDocument(const QString&); |
88 | }; | 88 | }; |
89 | 89 | ||
90 | 90 | ||
91 | class StartingAppList : public QObject { | 91 | class StartingAppList : public QObject { |
92 | Q_OBJECT | 92 | Q_OBJECT |
93 | public: | 93 | public: |
94 | static void add( const QString& name ); | 94 | static void add( const QString& name ); |
95 | static bool isStarting( const QString name ); | 95 | static bool isStarting( const QString name ); |
96 | private slots: | 96 | private slots: |
97 | void handleNewChannel( const QString &); | 97 | void handleNewChannel( const QString &); |
98 | private: | 98 | private: |
99 | StartingAppList( QObject *parent=0, const char* name=0 ) ; | 99 | StartingAppList( QObject *parent=0, const char* name=0 ) ; |
100 | 100 | ||
101 | QDict<QTime> dict; | 101 | QDict<QTime> dict; |
102 | static StartingAppList *appl; | 102 | static StartingAppList *appl; |
103 | }; | 103 | }; |
104 | 104 | ||
105 | StartingAppList* StartingAppList::appl = 0; | 105 | StartingAppList* StartingAppList::appl = 0; |
106 | 106 | ||
107 | StartingAppList::StartingAppList( QObject *parent, const char* name ) | 107 | StartingAppList::StartingAppList( QObject *parent, const char* name ) |
108 | :QObject( parent, name ) | 108 | :QObject( parent, name ) |
109 | { | 109 | { |
110 | #if QT_VERSION >= 232 && defined(QWS) | 110 | #if QT_VERSION >= 232 && defined(QWS) |
111 | connect( qwsServer, SIGNAL( newChannel(const QString&)), | 111 | connect( qwsServer, SIGNAL( newChannel(const QString&)), |
112 | this, SLOT( handleNewChannel(const QString&)) ); | 112 | this, SLOT( handleNewChannel(const QString&)) ); |
113 | #endif | 113 | #endif |
114 | dict.setAutoDelete( TRUE ); | 114 | dict.setAutoDelete( TRUE ); |
115 | } | 115 | } |
116 | 116 | ||
117 | void StartingAppList::add( const QString& name ) | 117 | void StartingAppList::add( const QString& name ) |
118 | { | 118 | { |
119 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) | 119 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) |
120 | if ( !appl ) | 120 | if ( !appl ) |
121 | appl = new StartingAppList; | 121 | appl = new StartingAppList; |
122 | QTime *t = new QTime; | 122 | QTime *t = new QTime; |
123 | t->start(); | 123 | t->start(); |
124 | appl->dict.insert( "QPE/Application/" + name, t ); | 124 | appl->dict.insert( "QPE/Application/" + name, t ); |
125 | #endif | 125 | #endif |
126 | } | 126 | } |
127 | 127 | ||
128 | bool StartingAppList::isStarting( const QString name ) | 128 | bool StartingAppList::isStarting( const QString name ) |
129 | { | 129 | { |
130 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) | 130 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) |
131 | if ( appl ) { | 131 | if ( appl ) { |
132 | QTime *t = appl->dict.find( "QPE/Application/" + name ); | 132 | QTime *t = appl->dict.find( "QPE/Application/" + name ); |
133 | if ( !t ) | 133 | if ( !t ) |
134 | return FALSE; | 134 | return FALSE; |
135 | if ( t->elapsed() > 10000 ) { | 135 | if ( t->elapsed() > 10000 ) { |
136 | // timeout in case of crash or something | 136 | // timeout in case of crash or something |
137 | appl->dict.remove( "QPE/Application/" + name ); | 137 | appl->dict.remove( "QPE/Application/" + name ); |
138 | return FALSE; | 138 | return FALSE; |
139 | } | 139 | } |
140 | return TRUE; | 140 | return TRUE; |
141 | } | 141 | } |
142 | #endif | 142 | #endif |
143 | return FALSE; | 143 | return FALSE; |
144 | } | 144 | } |
145 | 145 | ||
@@ -359,65 +359,65 @@ QString Global::applicationFileName(const QString& appname, const QString& filen | |||
359 | QDir d; | 359 | QDir d; |
360 | QString r = getenv("HOME"); | 360 | QString r = getenv("HOME"); |
361 | r += "/Applications/"; | 361 | r += "/Applications/"; |
362 | if ( !QFile::exists( r ) ) | 362 | if ( !QFile::exists( r ) ) |
363 | if ( d.mkdir(r) == false ) | 363 | if ( d.mkdir(r) == false ) |
364 | return QString::null; | 364 | return QString::null; |
365 | r += appname; | 365 | r += appname; |
366 | if ( !QFile::exists( r ) ) | 366 | if ( !QFile::exists( r ) ) |
367 | if ( d.mkdir(r) == false ) | 367 | if ( d.mkdir(r) == false ) |
368 | return QString::null; | 368 | return QString::null; |
369 | r += "/"; r += filename; | 369 | r += "/"; r += filename; |
370 | return r; | 370 | return r; |
371 | } | 371 | } |
372 | 372 | ||
373 | /*! | 373 | /*! |
374 | \internal | 374 | \internal |
375 | */ | 375 | */ |
376 | void Global::createDocDir() | 376 | void Global::createDocDir() |
377 | { | 377 | { |
378 | if ( !docDirCreated ) { | 378 | if ( !docDirCreated ) { |
379 | docDirCreated = TRUE; | 379 | docDirCreated = TRUE; |
380 | mkdir( QPEApplication::documentDir().latin1(), 0755 ); | 380 | mkdir( QPEApplication::documentDir().latin1(), 0755 ); |
381 | } | 381 | } |
382 | } | 382 | } |
383 | 383 | ||
384 | 384 | ||
385 | /*! | 385 | /*! |
386 | Displays a status \a message to the user. This usually appears | 386 | Displays a status \a message to the user. This usually appears |
387 | in the taskbar for a short amount of time, then disappears. | 387 | in the taskbar for a short amount of time, then disappears. |
388 | */ | 388 | */ |
389 | void Global::statusMessage(const QString& message) | 389 | void Global::statusMessage(const QString& message) |
390 | { | 390 | { |
391 | #if!defined(QT_NO_COP) | 391 | #if !defined(QT_NO_COP) |
392 | QCopEnvelope e( "QPE/TaskBar", "message(QString)" ); | 392 | QCopEnvelope e( "QPE/TaskBar", "message(QString)" ); |
393 | e << message; | 393 | e << message; |
394 | #endif | 394 | #endif |
395 | } | 395 | } |
396 | 396 | ||
397 | /*! | 397 | /*! |
398 | \internal | 398 | \internal |
399 | */ | 399 | */ |
400 | void Global::applyStyle() | 400 | void Global::applyStyle() |
401 | { | 401 | { |
402 | #if !defined(QT_NO_COP) | 402 | #if !defined(QT_NO_COP) |
403 | QCopChannel::send( "QPE/System", "applyStyle()" ); | 403 | QCopChannel::send( "QPE/System", "applyStyle()" ); |
404 | #else | 404 | #else |
405 | ((QPEApplication *)qApp)->applyStyle(); // apply without needing QCop for floppy version | 405 | ((QPEApplication *)qApp)->applyStyle(); // apply without needing QCop for floppy version |
406 | #endif | 406 | #endif |
407 | } | 407 | } |
408 | 408 | ||
409 | /*! | 409 | /*! |
410 | \internal | 410 | \internal |
411 | */ | 411 | */ |
412 | QWidget *Global::shutdown( bool ) | 412 | QWidget *Global::shutdown( bool ) |
413 | { | 413 | { |
414 | #if !defined(QT_NO_COP) | 414 | #if !defined(QT_NO_COP) |
415 | QCopChannel::send( "QPE/System", "shutdown()" ); | 415 | QCopChannel::send( "QPE/System", "shutdown()" ); |
416 | #endif | 416 | #endif |
417 | return 0; | 417 | return 0; |
418 | } | 418 | } |
419 | 419 | ||
420 | /*! | 420 | /*! |
421 | \internal | 421 | \internal |
422 | */ | 422 | */ |
423 | QWidget *Global::restart( bool ) | 423 | QWidget *Global::restart( bool ) |
@@ -532,157 +532,157 @@ bool Global::terminateBuiltin( const QString& n ) | |||
532 | */ | 532 | */ |
533 | void Global::terminate( const AppLnk* app ) | 533 | void Global::terminate( const AppLnk* app ) |
534 | { | 534 | { |
535 | //if ( terminateBuiltin(app->exec()) ) return; // maybe? haven't tried this | 535 | //if ( terminateBuiltin(app->exec()) ) return; // maybe? haven't tried this |
536 | 536 | ||
537 | #ifndef QT_NO_COP | 537 | #ifndef QT_NO_COP |
538 | QCString channel = "QPE/Application/" + app->exec().utf8(); | 538 | QCString channel = "QPE/Application/" + app->exec().utf8(); |
539 | if ( QCopChannel::isRegistered(channel) ) { | 539 | if ( QCopChannel::isRegistered(channel) ) { |
540 | QCopEnvelope e(channel, "quit()"); | 540 | QCopEnvelope e(channel, "quit()"); |
541 | } | 541 | } |
542 | #endif | 542 | #endif |
543 | } | 543 | } |
544 | 544 | ||
545 | /*! | 545 | /*! |
546 | Low-level function to run command \a c. | 546 | Low-level function to run command \a c. |
547 | 547 | ||
548 | \warning Do not use this function. Use execute instead. | 548 | \warning Do not use this function. Use execute instead. |
549 | 549 | ||
550 | \sa execute() | 550 | \sa execute() |
551 | */ | 551 | */ |
552 | void Global::invoke(const QString &c) | 552 | void Global::invoke(const QString &c) |
553 | { | 553 | { |
554 | // Convert the command line in to a list of arguments | 554 | // Convert the command line in to a list of arguments |
555 | QStringList list = QStringList::split(QRegExp(" *"),c); | 555 | QStringList list = QStringList::split(QRegExp(" *"),c); |
556 | 556 | ||
557 | #if !defined(QT_NO_COP) | 557 | #if !defined(QT_NO_COP) |
558 | QString ap=list[0]; | 558 | QString ap=list[0]; |
559 | // see if the application is already running | 559 | // see if the application is already running |
560 | // XXX should lock file /tmp/qcop-msg-ap | 560 | // XXX should lock file /tmp/qcop-msg-ap |
561 | if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) { | 561 | if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) { |
562 | // If the channel is already register, the app is already running, so show it. | 562 | // If the channel is already register, the app is already running, so show it. |
563 | { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } | 563 | { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } |
564 | 564 | ||
565 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); | 565 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); |
566 | e << ap; | 566 | e << ap; |
567 | return; | 567 | return; |
568 | } | 568 | } |
569 | // XXX should unlock file /tmp/qcop-msg-ap | 569 | // XXX should unlock file /tmp/qcop-msg-ap |
570 | //see if it is being started | 570 | //see if it is being started |
571 | if ( StartingAppList::isStarting( ap ) ) { | 571 | if ( StartingAppList::isStarting( ap ) ) { |
572 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); | 572 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); |
573 | e << ap; | 573 | e << ap; |
574 | return; | 574 | return; |
575 | } | 575 | } |
576 | 576 | ||
577 | #endif | 577 | #endif |
578 | 578 | ||
579 | #ifdef QT_NO_QWS_MULTIPROCESS | 579 | #ifdef QT_NO_QWS_MULTIPROCESS |
580 | QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 ); | 580 | QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 ); |
581 | #else | 581 | #else |
582 | 582 | ||
583 | QStrList slist; | 583 | QStrList slist; |
584 | unsigned int j; | 584 | unsigned int j; |
585 | for ( j = 0; j < list.count(); j++ ) | 585 | for ( j = 0; j < list.count(); j++ ) |
586 | slist.append( list[j].utf8() ); | 586 | slist.append( list[j].utf8() ); |
587 | 587 | ||
588 | const char **args = new (const char *)[slist.count() + 1]; | 588 | const char **args = new (const char *)[slist.count() + 1]; |
589 | for ( j = 0; j < slist.count(); j++ ) | 589 | for ( j = 0; j < slist.count(); j++ ) |
590 | args[j] = slist.at(j); | 590 | args[j] = slist.at(j); |
591 | args[j] = NULL; | 591 | args[j] = NULL; |
592 | 592 | ||
593 | #if !defined(QT_NO_COP) | 593 | #if !defined(QT_NO_COP) |
594 | // an attempt to show a wait... | 594 | // an attempt to show a wait... |
595 | // more logic should be used, but this will be fine for the moment... | 595 | // more logic should be used, but this will be fine for the moment... |
596 | QCopEnvelope ( "QPE/System", "busy()" ); | 596 | QCopEnvelope ( "QPE/System", "busy()" ); |
597 | #endif | 597 | #endif |
598 | 598 | ||
599 | #ifdef HAVE_QUICKEXEC | 599 | #ifdef HAVE_QUICKEXEC |
600 | QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; | 600 | QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; |
601 | qDebug("libfile = %s", libexe.latin1() ); | 601 | qDebug("libfile = %s", libexe.latin1() ); |
602 | if ( QFile::exists( libexe ) ) { | 602 | if ( QFile::exists( libexe ) ) { |
603 | qDebug("calling quickexec %s", libexe.latin1() ); | 603 | qDebug("calling quickexec %s", libexe.latin1() ); |
604 | quickexecv( libexe.utf8().data(), (const char **)args ); | 604 | quickexecv( libexe.utf8().data(), (const char **)args ); |
605 | } else | 605 | } else |
606 | #endif | 606 | #endif |
607 | { | 607 | { |
608 | bool success = false; | 608 | bool success = false; |
609 | int pfd [2]; | 609 | int pfd [2]; |
610 | if ( ::pipe ( pfd ) < 0 ) | 610 | if ( ::pipe ( pfd ) < 0 ) |
611 | pfd [0] = pfd [1] = -1; | 611 | pfd [0] = pfd [1] = -1; |
612 | 612 | ||
613 | pid_t pid = ::fork ( ); | 613 | pid_t pid = ::fork ( ); |
614 | 614 | ||
615 | if ( pid == 0 ) { // child | 615 | if ( pid == 0 ) { // child |
616 | for ( int fd = 3; fd < 100; fd++ ) { | 616 | for ( int fd = 3; fd < 100; fd++ ) { |
617 | if ( fd != pfd [1] ) | 617 | if ( fd != pfd [1] ) |
618 | ::close ( fd ); | 618 | ::close ( fd ); |
619 | } | 619 | } |
620 | ::setpgid ( ::getpid ( ), ::getppid ( )); | 620 | ::setpgid ( ::getpid ( ), ::getppid ( )); |
621 | 621 | ||
622 | // Closing of fd[1] indicates that the execvp succeeded! | 622 | // Closing of fd[1] indicates that the execvp succeeded! |
623 | if ( pfd [1] >= 0 ) | 623 | if ( pfd [1] >= 0 ) |
624 | ::fcntl ( pfd [1], F_SETFD, FD_CLOEXEC ); | 624 | ::fcntl ( pfd [1], F_SETFD, FD_CLOEXEC ); |
625 | 625 | ||
626 | // Try bindir first, so that foo/bar works too | 626 | // Try bindir first, so that foo/bar works too |
627 | ::execv ( qpeDir ( ) + "/bin/" + args [0], (char * const *) args ); | 627 | ::execv ( qpeDir ( ) + "/bin/" + args [0], (char * const *) args ); |
628 | ::execvp ( args [0], (char * const *) args ); | 628 | ::execvp ( args [0], (char * const *) args ); |
629 | 629 | ||
630 | char resultByte = 1; | 630 | char resultByte = 1; |
631 | if ( pfd [1] >= 0 ) | 631 | if ( pfd [1] >= 0 ) |
632 | ::write ( pfd [1], &resultByte, 1 ); | 632 | ::write ( pfd [1], &resultByte, 1 ); |
633 | ::_exit ( -1 ); | 633 | ::_exit ( -1 ); |
634 | } | 634 | } |
635 | else if ( pid > 0 ) { | 635 | else if ( pid > 0 ) { |
636 | success = true; | 636 | success = true; |
637 | 637 | ||
638 | if ( pfd [1] >= 0 ) | 638 | if ( pfd [1] >= 0 ) |
639 | ::close ( pfd [1] ); | 639 | ::close ( pfd [1] ); |
640 | if ( pfd [0] >= 0 ) { | 640 | if ( pfd [0] >= 0 ) { |
641 | while ( true ) { | 641 | while ( true ) { |
642 | char resultByte; | 642 | char resultByte; |
643 | int n = ::read ( pfd [0], &resultByte, 1 ); | 643 | int n = ::read ( pfd [0], &resultByte, 1 ); |
644 | if ( n == 1 ) { | 644 | if ( n == 1 ) { |
645 | success = false; | 645 | success = false; |
646 | break; | 646 | break; |
647 | } | 647 | } |
648 | if (( n == -1 ) && (( errno == ECHILD ) || ( errno == EINTR ))) | 648 | if (( n == -1 ) && (( errno == ECHILD ) || ( errno == EINTR ))) |
649 | continue; | 649 | continue; |
650 | 650 | ||
651 | break; // success | 651 | break; // success |
652 | } | 652 | } |
653 | ::close ( pfd [0] ); | 653 | ::close ( pfd [0] ); |
654 | } | 654 | } |
655 | } | 655 | } |
656 | if ( success ) | 656 | if ( success ) |
657 | StartingAppList::add( list[0] ); | 657 | StartingAppList::add( list[0] ); |
658 | else | 658 | else |
659 | QMessageBox::warning( 0, "Error", "Could not start the application " + c, "Ok", 0, 0, 0, 1 ); | 659 | QMessageBox::warning( 0, "Error", "Could not start the application " + c, "Ok", 0, 0, 0, 1 ); |
660 | } | 660 | } |
661 | #endif //QT_NO_QWS_MULTIPROCESS | 661 | #endif //QT_NO_QWS_MULTIPROCESS |
662 | } | 662 | } |
663 | 663 | ||
664 | 664 | ||
665 | /*! | 665 | /*! |
666 | Executes the application identfied by \a c, passing \a | 666 | Executes the application identfied by \a c, passing \a |
667 | document if it isn't null. | 667 | document if it isn't null. |
668 | 668 | ||
669 | Note that a better approach might be to send a QCop message to the | 669 | Note that a better approach might be to send a QCop message to the |
670 | application's QPE/Application/\e{appname} channel. | 670 | application's QPE/Application/\e{appname} channel. |
671 | */ | 671 | */ |
672 | void Global::execute( const QString &c, const QString& document ) | 672 | void Global::execute( const QString &c, const QString& document ) |
673 | { | 673 | { |
674 | if ( qApp->type() != QApplication::GuiServer ) { | 674 | if ( qApp->type() != QApplication::GuiServer ) { |
675 | // ask the server to do the work | 675 | // ask the server to do the work |
676 | #if !defined(QT_NO_COP) | 676 | #if !defined(QT_NO_COP) |
677 | if ( document.isNull() ) { | 677 | if ( document.isNull() ) { |
678 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 678 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
679 | e << c; | 679 | e << c; |
680 | } else { | 680 | } else { |
681 | QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); | 681 | QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); |
682 | e << c << document; | 682 | e << c << document; |
683 | } | 683 | } |
684 | #endif | 684 | #endif |
685 | return; | 685 | return; |
686 | } | 686 | } |
687 | 687 | ||
688 | // Attempt to execute the app using a builtin class for the app first | 688 | // Attempt to execute the app using a builtin class for the app first |
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index c562f6c..2ef60d5 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -421,65 +421,65 @@ static void setTreble( int t = 0, int percent = -1 ) | |||
421 | 421 | ||
422 | /*! | 422 | /*! |
423 | \fn void QPEApplication::timeChanged(); | 423 | \fn void QPEApplication::timeChanged(); |
424 | This signal is emitted when the time changes outside the normal | 424 | This signal is emitted when the time changes outside the normal |
425 | passage of time, i.e. if the time is set backwards or forwards. | 425 | passage of time, i.e. if the time is set backwards or forwards. |
426 | */ | 426 | */ |
427 | 427 | ||
428 | /*! | 428 | /*! |
429 | \fn void QPEApplication::clockChanged( bool ampm ); | 429 | \fn void QPEApplication::clockChanged( bool ampm ); |
430 | 430 | ||
431 | This signal is emitted when the user changes the clock's style. If | 431 | This signal is emitted when the user changes the clock's style. If |
432 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, | 432 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, |
433 | they want a 24-hour clock. | 433 | they want a 24-hour clock. |
434 | */ | 434 | */ |
435 | 435 | ||
436 | /*! | 436 | /*! |
437 | \fn void QPEApplication::volumeChanged( bool muted ) | 437 | \fn void QPEApplication::volumeChanged( bool muted ) |
438 | 438 | ||
439 | This signal is emitted whenever the mute state is changed. If \a | 439 | This signal is emitted whenever the mute state is changed. If \a |
440 | muted is TRUE, then sound output has been muted. | 440 | muted is TRUE, then sound output has been muted. |
441 | */ | 441 | */ |
442 | 442 | ||
443 | /*! | 443 | /*! |
444 | \fn void QPEApplication::weekChanged( bool startOnMonday ) | 444 | \fn void QPEApplication::weekChanged( bool startOnMonday ) |
445 | 445 | ||
446 | This signal is emitted if the week start day is changed. If \a | 446 | This signal is emitted if the week start day is changed. If \a |
447 | startOnMonday is TRUE then the first day of the week is Monday; if | 447 | startOnMonday is TRUE then the first day of the week is Monday; if |
448 | \a startOnMonday is FALSE then the first day of the week is | 448 | \a startOnMonday is FALSE then the first day of the week is |
449 | Sunday. | 449 | Sunday. |
450 | */ | 450 | */ |
451 | 451 | ||
452 | /*! | 452 | /*! |
453 | \fn void QPEApplication::dateFormatChanged() | 453 | \fn void QPEApplication::dateFormatChanged(DateFormat) |
454 | 454 | ||
455 | This signal is emitted whenever the date format is changed. | 455 | This signal is emitted whenever the date format is changed. |
456 | */ | 456 | */ |
457 | 457 | ||
458 | /*! | 458 | /*! |
459 | \fn void QPEApplication::flush() | 459 | \fn void QPEApplication::flush() |
460 | 460 | ||
461 | ### | 461 | ### |
462 | */ | 462 | */ |
463 | 463 | ||
464 | /*! | 464 | /*! |
465 | \fn void QPEApplication::reload() | 465 | \fn void QPEApplication::reload() |
466 | 466 | ||
467 | */ | 467 | */ |
468 | 468 | ||
469 | /*! | 469 | /*! |
470 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 470 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
471 | 471 | ||
472 | This signal is emitted when a message is received on this | 472 | This signal is emitted when a message is received on this |
473 | application's QPE/Application/<i>appname</i> \link qcop.html | 473 | application's QPE/Application/<i>appname</i> \link qcop.html |
474 | QCop\endlink channel. | 474 | QCop\endlink channel. |
475 | 475 | ||
476 | The slot to which you connect this signal uses \a msg and \a data | 476 | The slot to which you connect this signal uses \a msg and \a data |
477 | in the following way: | 477 | in the following way: |
478 | 478 | ||
479 | \code | 479 | \code |
480 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 480 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
481 | { | 481 | { |
482 | QDataStream stream( data, IO_ReadOnly ); | 482 | QDataStream stream( data, IO_ReadOnly ); |
483 | if ( msg == "someMessage(int,int,int)" ) { | 483 | if ( msg == "someMessage(int,int,int)" ) { |
484 | int a,b,c; | 484 | int a,b,c; |
485 | stream >> a >> b >> c; | 485 | stream >> a >> b >> c; |
@@ -1739,64 +1739,65 @@ void QPEApplication::hideOrQuit() | |||
1739 | else | 1739 | else |
1740 | quit(); | 1740 | quit(); |
1741 | } | 1741 | } |
1742 | 1742 | ||
1743 | 1743 | ||
1744 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) | 1744 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
1745 | 1745 | ||
1746 | // The libraries with the skiff package (and possibly others) have | 1746 | // The libraries with the skiff package (and possibly others) have |
1747 | // completely useless implementations of builtin new and delete that | 1747 | // completely useless implementations of builtin new and delete that |
1748 | // use about 50% of your CPU. Here we revert to the simple libc | 1748 | // use about 50% of your CPU. Here we revert to the simple libc |
1749 | // functions. | 1749 | // functions. |
1750 | 1750 | ||
1751 | void* operator new[]( size_t size ) | 1751 | void* operator new[]( size_t size ) |
1752 | { | 1752 | { |
1753 | return malloc( size ); | 1753 | return malloc( size ); |
1754 | } | 1754 | } |
1755 | 1755 | ||
1756 | void* operator new( size_t size ) | 1756 | void* operator new( size_t size ) |
1757 | { | 1757 | { |
1758 | return malloc( size ); | 1758 | return malloc( size ); |
1759 | } | 1759 | } |
1760 | 1760 | ||
1761 | void operator delete[]( void* p ) | 1761 | void operator delete[]( void* p ) |
1762 | { | 1762 | { |
1763 | free( p ); | 1763 | free( p ); |
1764 | } | 1764 | } |
1765 | 1765 | ||
1766 | void operator delete[]( void* p, size_t /*size*/ ) | 1766 | void operator delete[]( void* p, size_t /*size*/ ) |
1767 | { | 1767 | { |
1768 | free( p ); | 1768 | free( p ); |
1769 | } | 1769 | } |
1770 | 1770 | ||
1771 | |||
1771 | void operator delete( void* p ) | 1772 | void operator delete( void* p ) |
1772 | { | 1773 | { |
1773 | free( p ); | 1774 | free( p ); |
1774 | } | 1775 | } |
1775 | 1776 | ||
1776 | void operator delete( void* p, size_t /*size*/ ) | 1777 | void operator delete( void* p, size_t /*size*/ ) |
1777 | { | 1778 | { |
1778 | free( p ); | 1779 | free( p ); |
1779 | } | 1780 | } |
1780 | 1781 | ||
1781 | #endif | 1782 | #endif |
1782 | 1783 | ||
1783 | #if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) | 1784 | #if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) |
1784 | #include <qwidgetlist.h> | 1785 | #include <qwidgetlist.h> |
1785 | #ifdef QWS | 1786 | #ifdef QWS |
1786 | #include <qgfx_qws.h> | 1787 | #include <qgfx_qws.h> |
1787 | extern QRect qt_maxWindowRect; | 1788 | extern QRect qt_maxWindowRect; |
1788 | void qt_setMaxWindowRect(const QRect& r ) | 1789 | void qt_setMaxWindowRect(const QRect& r ) |
1789 | { | 1790 | { |
1790 | qt_maxWindowRect = qt_screen->mapFromDevice( r, | 1791 | qt_maxWindowRect = qt_screen->mapFromDevice( r, |
1791 | qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); | 1792 | qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); |
1792 | // Re-resize any maximized windows | 1793 | // Re-resize any maximized windows |
1793 | QWidgetList* l = QApplication::topLevelWidgets(); | 1794 | QWidgetList* l = QApplication::topLevelWidgets(); |
1794 | if ( l ) { | 1795 | if ( l ) { |
1795 | QWidget * w = l->first(); | 1796 | QWidget * w = l->first(); |
1796 | while ( w ) { | 1797 | while ( w ) { |
1797 | if ( w->isVisible() && w->isMaximized() ) { | 1798 | if ( w->isVisible() && w->isMaximized() ) { |
1798 | w->showMaximized(); | 1799 | w->showMaximized(); |
1799 | } | 1800 | } |
1800 | w = l->next(); | 1801 | w = l->next(); |
1801 | } | 1802 | } |
1802 | delete l; | 1803 | delete l; |
diff --git a/library/storage.cpp b/library/storage.cpp index f4c1c02..12f9df9 100644 --- a/library/storage.cpp +++ b/library/storage.cpp | |||
@@ -171,85 +171,85 @@ void StorageInfo::update() | |||
171 | humanname = tr("Internal Memory"); | 171 | humanname = tr("Internal Memory"); |
172 | FileSystem *fs = new FileSystem( disk, *fsit, humanname, removable, opts ); | 172 | FileSystem *fs = new FileSystem( disk, *fsit, humanname, removable, opts ); |
173 | mFileSystems.append( fs ); | 173 | mFileSystems.append( fs ); |
174 | } | 174 | } |
175 | emit disksChanged(); | 175 | emit disksChanged(); |
176 | } else { | 176 | } else { |
177 | // just update them | 177 | // just update them |
178 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) | 178 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) |
179 | i.current()->update(); | 179 | i.current()->update(); |
180 | } | 180 | } |
181 | #endif | 181 | #endif |
182 | } | 182 | } |
183 | 183 | ||
184 | bool deviceTab( const char *device) { | 184 | bool deviceTab( const char *device) { |
185 | QString name = device; | 185 | QString name = device; |
186 | bool hasDevice=false; | 186 | bool hasDevice=false; |
187 | struct mntent *me; | 187 | struct mntent *me; |
188 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); | 188 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); |
189 | if ( mntfp ) { | 189 | if ( mntfp ) { |
190 | while ( (me = getmntent( mntfp )) != 0 ) { | 190 | while ( (me = getmntent( mntfp )) != 0 ) { |
191 | QString deviceName = me->mnt_fsname; | 191 | QString deviceName = me->mnt_fsname; |
192 | // qDebug(deviceName); | 192 | // qDebug(deviceName); |
193 | if( deviceName.left(name.length()) == name) { | 193 | if( deviceName.left(name.length()) == name) { |
194 | hasDevice = true; | 194 | hasDevice = true; |
195 | } | 195 | } |
196 | } | 196 | } |
197 | } | 197 | } |
198 | endmntent( mntfp ); | 198 | endmntent( mntfp ); |
199 | return hasDevice; | 199 | return hasDevice; |
200 | } | 200 | } |
201 | 201 | ||
202 | /*! | 202 | /*! |
203 | * @fn hasCf() | 203 | * @fn static bool StorageInfo::hasCf() |
204 | * @brief returns whether device has Cf mounted | 204 | * @brief returns whether device has Cf mounted |
205 | * | 205 | * |
206 | */ | 206 | */ |
207 | bool StorageInfo::hasCf() | 207 | bool StorageInfo::hasCf() |
208 | { | 208 | { |
209 | return deviceTab("/dev/hd"); | 209 | return deviceTab("/dev/hd"); |
210 | } | 210 | } |
211 | 211 | ||
212 | /*! | 212 | /*! |
213 | * @fn hasSd() | 213 | * @fn static bool StorageInfo::hasSd() |
214 | * @brief returns whether device has SD mounted | 214 | * @brief returns whether device has SD mounted |
215 | * | 215 | * |
216 | */ | 216 | */ |
217 | bool StorageInfo::hasSd() | 217 | bool StorageInfo::hasSd() |
218 | { | 218 | { |
219 | return deviceTab("/dev/mmcd"); | 219 | return deviceTab("/dev/mmcd"); |
220 | } | 220 | } |
221 | 221 | ||
222 | /*! | 222 | /*! |
223 | * @fn hasMmc() | 223 | * @fn static bool StorageInfo::hasMmc() |
224 | * @brief reutrns whether device has mmc mounted | 224 | * @brief reutrns whether device has mmc mounted |
225 | * | 225 | * |
226 | */ | 226 | */ |
227 | bool StorageInfo::hasMmc() | 227 | bool StorageInfo::hasMmc() |
228 | { | 228 | { |
229 | bool hasMmc=false; | 229 | bool hasMmc=false; |
230 | if( deviceTab("/dev/mmc/part")) | 230 | if( deviceTab("/dev/mmc/part")) |
231 | hasMmc=true; | 231 | hasMmc=true; |
232 | if( deviceTab("/dev/mmcd")) | 232 | if( deviceTab("/dev/mmcd")) |
233 | hasMmc=true; | 233 | hasMmc=true; |
234 | return hasMmc; | 234 | return hasMmc; |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
238 | //--------------------------------------------------------------------------- | 238 | //--------------------------------------------------------------------------- |
239 | 239 | ||
240 | FileSystem::FileSystem( const QString &disk, const QString &path, const QString &name, bool rem, const QString &o ) | 240 | FileSystem::FileSystem( const QString &disk, const QString &path, const QString &name, bool rem, const QString &o ) |
241 | : fsdisk( disk ), fspath( path ), humanname( name ), blkSize(512), totalBlks(0), availBlks(0), removable( rem ), opts( o ) | 241 | : fsdisk( disk ), fspath( path ), humanname( name ), blkSize(512), totalBlks(0), availBlks(0), removable( rem ), opts( o ) |
242 | { | 242 | { |
243 | update(); | 243 | update(); |
244 | } | 244 | } |
245 | 245 | ||
246 | void FileSystem::update() | 246 | void FileSystem::update() |
247 | { | 247 | { |
248 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 248 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
249 | struct statfs fs; | 249 | struct statfs fs; |
250 | if ( !statfs( fspath.latin1(), &fs ) ) { | 250 | if ( !statfs( fspath.latin1(), &fs ) ) { |
251 | blkSize = fs.f_bsize; | 251 | blkSize = fs.f_bsize; |
252 | totalBlks = fs.f_blocks; | 252 | totalBlks = fs.f_blocks; |
253 | availBlks = fs.f_bavail; | 253 | availBlks = fs.f_bavail; |
254 | } else { | 254 | } else { |
255 | blkSize = 0; | 255 | blkSize = 0; |