author | harlekin <harlekin> | 2002-09-18 15:03:24 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-18 15:03:24 (UTC) |
commit | dd4b256d39e7a438a7d688471d257dd10a75d138 (patch) (unidiff) | |
tree | d2e4a84f5b150ff0dc85b47a5ac9cee82d135cff | |
parent | 6008e7d286293a87fca4ff43729bdfa66d700989 (diff) | |
download | opie-dd4b256d39e7a438a7d688471d257dd10a75d138.zip opie-dd4b256d39e7a438a7d688471d257dd10a75d138.tar.gz opie-dd4b256d39e7a438a7d688471d257dd10a75d138.tar.bz2 |
use bool where bool is ment
4 files changed, 22 insertions, 18 deletions
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp index d4e8e1e..c37813b 100644 --- a/core/pim/today/plugins/datebook/datebookevent.cpp +++ b/core/pim/today/plugins/datebook/datebookevent.cpp | |||
@@ -1,118 +1,122 @@ | |||
1 | /* | 1 | /* |
2 | * datebookevent.cpp | 2 | * datebookevent.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include "datebookevent.h" | 17 | #include "datebookevent.h" |
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qpe/timestring.h> | 19 | #include <qpe/timestring.h> |
20 | #include <qpe/qcopenvelope_qws.h> | 20 | #include <qpe/qcopenvelope_qws.h> |
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | 22 | ||
23 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | 23 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, |
24 | QWidget* parent, | 24 | QWidget* parent, |
25 | int show_location, | 25 | bool show_location, |
26 | int show_notes, | 26 | bool show_notes, |
27 | // int onlyLater, | ||
28 | int maxCharClip, | 27 | int maxCharClip, |
29 | const char* name, | 28 | const char* name, |
30 | WFlags fl) : | 29 | WFlags fl) : |
31 | OClickableLabel(parent,name,fl), event(ev) { | 30 | OClickableLabel(parent,name,fl), event(ev) { |
32 | 31 | ||
33 | setAlignment( AlignTop ); | 32 | setAlignment( AlignTop ); |
34 | 33 | ||
35 | QString msg; | 34 | QString msg; |
36 | 35 | ||
37 | Config config( "qpe" ); | 36 | Config config( "qpe" ); |
38 | config.setGroup( "Time" ); | 37 | config.setGroup( "Time" ); |
39 | // if 24 h format | 38 | // if 24 h format |
40 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 39 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
41 | 40 | ||
42 | msg += "<B>" + (ev).description() + "</B>"; | 41 | msg += "<B>" + (ev).description() + "</B>"; |
43 | if ( (ev).event().hasAlarm() ) { | 42 | if ( (ev).event().hasAlarm() ) { |
44 | msg += " <b>[with alarm]</b>"; | 43 | msg += " <b>[with alarm]</b>"; |
45 | } | 44 | } |
46 | 45 | ||
47 | // include location or not | 46 | // include location or not |
48 | if ( show_location == 1) { | 47 | if ( show_location ) { |
49 | msg += "<BR><i>" + (ev).location() + "</i>"; | 48 | msg += "<BR><i>" + (ev).location() + "</i>"; |
50 | } | 49 | } |
51 | 50 | ||
52 | if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) | 51 | if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) |
53 | && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59") ) { | 52 | && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) { |
54 | msg += "<br>All day"; | 53 | msg += "<br>All day"; |
55 | } else { | 54 | } else { |
56 | // start time of event | 55 | // start time of event |
57 | msg += "<br>" + ampmTime(QTime( (ev).event().start().time() ) ) | 56 | msg += "<br>" + ampmTime(QTime( (ev).event().start().time() ) ) |
58 | // end time of event | 57 | // end time of event |
59 | + "<b> - </b>" + ampmTime(QTime( (ev).event().end().time() ) ); | 58 | + "<b> - </b>" + ampmTime(QTime( (ev).event().end().time() ) ); |
60 | } | 59 | } |
61 | 60 | ||
62 | // include possible note or not | 61 | // include possible note or not |
63 | if ( show_notes == 1) { | 62 | if ( show_notes ) { |
64 | msg += "<br> <i>note</i>:" +( (ev).notes() ).mid( 0, maxCharClip ); | 63 | msg += "<br> <i>note</i>:" +( (ev).notes() ).mid( 0, maxCharClip ); |
65 | } | 64 | } |
66 | 65 | ||
67 | setText( msg ); | 66 | setText( msg ); |
68 | connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) ); | 67 | connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) ); |
69 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 68 | // setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
70 | } | 69 | } |
71 | 70 | ||
72 | 71 | ||
72 | /** | ||
73 | * AM/PM timestring conversion. | ||
74 | * @param tm the timestring | ||
75 | * @return formatted to am/pm is system is set to it | ||
76 | */ | ||
73 | QString DateBookEvent::ampmTime( QTime tm ) { | 77 | QString DateBookEvent::ampmTime( QTime tm ) { |
74 | 78 | ||
75 | QString s; | 79 | QString s; |
76 | if( ampm ) { | 80 | if( ampm ) { |
77 | int hour = tm.hour(); | 81 | int hour = tm.hour(); |
78 | if ( hour == 0 ) { | 82 | if ( hour == 0 ) { |
79 | hour = 12; | 83 | hour = 12; |
80 | } | 84 | } |
81 | if ( hour > 12 ) { | 85 | if ( hour > 12 ) { |
82 | hour -= 12; | 86 | hour -= 12; |
83 | } | 87 | } |
84 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | 88 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), |
85 | (tm.hour() >= 12) ? "PM" : "AM" ); | 89 | (tm.hour() >= 12) ? "PM" : "AM" ); |
86 | return s; | 90 | return s; |
87 | } else { | 91 | } else { |
88 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | 92 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); |
89 | return s; | 93 | return s; |
90 | } | 94 | } |
91 | 95 | ||
92 | } | 96 | } |
93 | 97 | ||
94 | 98 | ||
95 | /* | 99 | /** |
96 | * starts the edit dialog as known from datebook | 100 | * starts the edit dialog as known from datebook |
97 | */ | 101 | */ |
98 | void DateBookEvent::editEventSlot( const Event &e ) { | 102 | void DateBookEvent::editEventSlot( const Event &e ) { |
99 | startDatebook(); | 103 | startDatebook(); |
100 | 104 | ||
101 | while( !QCopChannel::isRegistered( "QPE/Datebook" ) ) qApp->processEvents(); | 105 | while( !QCopChannel::isRegistered( "QPE/Datebook" ) ) qApp->processEvents(); |
102 | QCopEnvelope env( "QPE/Datebook", "editEvent(int)" ); | 106 | QCopEnvelope env( "QPE/Datebook", "editEvent(int)" ); |
103 | env << e.uid(); | 107 | env << e.uid(); |
104 | } | 108 | } |
105 | 109 | ||
106 | 110 | ||
107 | /** | 111 | /** |
108 | * launches datebook | 112 | * launches datebook |
109 | */ | 113 | */ |
110 | void DateBookEvent::startDatebook() { | 114 | void DateBookEvent::startDatebook() { |
111 | QCopEnvelope e("QPE/System", "execute(QString)"); | 115 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
112 | e << QString("datebook"); | 116 | e << QString( "datebook" ); |
113 | } | 117 | } |
114 | 118 | ||
115 | void DateBookEvent::editMe() { | 119 | void DateBookEvent::editMe() { |
116 | emit editEvent(event.event()); | 120 | emit editEvent( event.event() ); |
117 | } | 121 | } |
118 | 122 | ||
diff --git a/core/pim/today/plugins/datebook/datebookevent.h b/core/pim/today/plugins/datebook/datebookevent.h index 1168f7c..61c64f1 100644 --- a/core/pim/today/plugins/datebook/datebookevent.h +++ b/core/pim/today/plugins/datebook/datebookevent.h | |||
@@ -1,50 +1,49 @@ | |||
1 | /* | 1 | /* |
2 | * datebookplugin.h | 2 | * datebookplugin.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #ifndef DATEBOOKEVENT_PLUGIN_H | 17 | #ifndef DATEBOOKEVENT_PLUGIN_H |
18 | #define DATEBOOKEVENT_PLUGIN_H | 18 | #define DATEBOOKEVENT_PLUGIN_H |
19 | 19 | ||
20 | #include <opie/oclickablelabel.h> | 20 | #include <opie/oclickablelabel.h> |
21 | #include <qpe/datebookdb.h> | 21 | #include <qpe/datebookdb.h> |
22 | 22 | ||
23 | 23 | ||
24 | class DateBookEvent: public OClickableLabel { | 24 | class DateBookEvent: public OClickableLabel { |
25 | 25 | ||
26 | Q_OBJECT | 26 | Q_OBJECT |
27 | 27 | ||
28 | public: | 28 | public: |
29 | DateBookEvent(const EffectiveEvent &ev, | 29 | DateBookEvent(const EffectiveEvent &ev, |
30 | QWidget* parent = 0, | 30 | QWidget* parent = 0, |
31 | int show_location = 0, | 31 | bool show_location = 0, |
32 | int show_notes = 0, | 32 | bool show_notes = 0, |
33 | // int onlyLater = 0, | ||
34 | int maxCharClip = 0, | 33 | int maxCharClip = 0, |
35 | const char* name = 0, | 34 | const char* name = 0, |
36 | WFlags fl = 0); | 35 | WFlags fl = 0); |
37 | signals: | 36 | signals: |
38 | void editEvent(const Event &e); | 37 | void editEvent(const Event &e); |
39 | private slots: | 38 | private slots: |
40 | void editEventSlot(const Event &e); | 39 | void editEventSlot(const Event &e); |
41 | void editMe(); | 40 | void editMe(); |
42 | private: | 41 | private: |
43 | void startDatebook(); | 42 | void startDatebook(); |
44 | DateBookDB *db; | 43 | DateBookDB *db; |
45 | QString ampmTime(QTime); | 44 | QString ampmTime(QTime); |
46 | const EffectiveEvent event; | 45 | const EffectiveEvent event; |
47 | bool ampm; | 46 | bool ampm; |
48 | }; | 47 | }; |
49 | 48 | ||
50 | #endif | 49 | #endif |
diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp index 9800e61..07f5005 100644 --- a/core/pim/today/plugins/datebook/datebookplugin.cpp +++ b/core/pim/today/plugins/datebook/datebookplugin.cpp | |||
@@ -1,69 +1,70 @@ | |||
1 | |||
1 | /* | 2 | /* |
2 | * datebookplugin.cpp | 3 | * datebookplugin.cpp |
3 | * | 4 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 5 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 6 | * email : harlekin@handhelds.org |
6 | * | 7 | * |
7 | */ | 8 | */ |
8 | /*************************************************************************** | 9 | /*************************************************************************** |
9 | * * | 10 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
14 | * * | 15 | * * |
15 | ***************************************************************************/ | 16 | ***************************************************************************/ |
16 | 17 | ||
17 | 18 | ||
18 | 19 | ||
19 | #include "datebookevent.h" | 20 | #include "datebookevent.h" |
20 | #include "datebookplugin.h" | 21 | #include "datebookplugin.h" |
21 | #include "datebookpluginwidget.h" | 22 | #include "datebookpluginwidget.h" |
22 | #include "datebookpluginconfig.h" | 23 | #include "datebookpluginconfig.h" |
23 | 24 | ||
24 | 25 | ||
25 | DatebookPlugin::DatebookPlugin() { | 26 | DatebookPlugin::DatebookPlugin() { |
26 | } | 27 | } |
27 | 28 | ||
28 | DatebookPlugin::~DatebookPlugin() { | 29 | DatebookPlugin::~DatebookPlugin() { |
29 | } | 30 | } |
30 | 31 | ||
31 | QString DatebookPlugin::pluginName() const { | 32 | QString DatebookPlugin::pluginName() const { |
32 | return "Datebook plugin"; | 33 | return "Datebook plugin"; |
33 | } | 34 | } |
34 | 35 | ||
35 | double DatebookPlugin::versionNumber() const { | 36 | double DatebookPlugin::versionNumber() const { |
36 | return 0.1; | 37 | return 1.0; |
37 | } | 38 | } |
38 | 39 | ||
39 | QString DatebookPlugin::pixmapNameWidget() const { | 40 | QString DatebookPlugin::pixmapNameWidget() const { |
40 | return "DateBook"; | 41 | return "DateBook"; |
41 | } | 42 | } |
42 | 43 | ||
43 | QWidget* DatebookPlugin::widget( QWidget* wid ) { | 44 | QWidget* DatebookPlugin::widget( QWidget* wid ) { |
44 | return new DatebookPluginWidget( wid, "Datebook" ); | 45 | return new DatebookPluginWidget( wid, "Datebook" ); |
45 | } | 46 | } |
46 | 47 | ||
47 | QString DatebookPlugin::pixmapNameConfig() const { | 48 | QString DatebookPlugin::pixmapNameConfig() const { |
48 | return "DateBook"; | 49 | return "DateBook"; |
49 | } | 50 | } |
50 | 51 | ||
51 | ConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { | 52 | ConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { |
52 | return new DatebookPluginConfig( wid , "Datebook" ); | 53 | return new DatebookPluginConfig( wid , "Datebook" ); |
53 | } | 54 | } |
54 | 55 | ||
55 | QString DatebookPlugin::appName() const { | 56 | QString DatebookPlugin::appName() const { |
56 | return "datebook"; | 57 | return "datebook"; |
57 | } | 58 | } |
58 | 59 | ||
59 | int DatebookPlugin::minHeight() const { | 60 | int DatebookPlugin::minHeight() const { |
60 | return 10; | 61 | return 10; |
61 | } | 62 | } |
62 | 63 | ||
63 | int DatebookPlugin::maxHeight() const { | 64 | int DatebookPlugin::maxHeight() const { |
64 | return 100; | 65 | return 100; |
65 | } | 66 | } |
66 | 67 | ||
67 | 68 | ||
68 | int main() { | 69 | int main() { |
69 | } | 70 | } |
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h index e0213ec..1720bb2 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.h +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h | |||
@@ -1,52 +1,52 @@ | |||
1 | /* | 1 | /* |
2 | * datebookpluginwidget.h | 2 | * datebookpluginwidget.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #ifndef DATEBOOK_PLUGIN_WIDGET_H | 17 | #ifndef DATEBOOK_PLUGIN_WIDGET_H |
18 | #define DATEBOOK_PLUGIN_WIDGET_H | 18 | #define DATEBOOK_PLUGIN_WIDGET_H |
19 | 19 | ||
20 | #include <qstring.h> | 20 | #include <qstring.h> |
21 | #include <qwidget.h> | 21 | #include <qwidget.h> |
22 | 22 | ||
23 | #include <qpe/datebookdb.h> | 23 | #include <qpe/datebookdb.h> |
24 | #include <opie/oclickablelabel.h> | 24 | #include <opie/oclickablelabel.h> |
25 | 25 | ||
26 | 26 | ||
27 | class DatebookPluginWidget : public QWidget { | 27 | class DatebookPluginWidget : public QWidget { |
28 | 28 | ||
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | 30 | ||
31 | public: | 31 | public: |
32 | DatebookPluginWidget( QWidget *parent, const char *name ); | 32 | DatebookPluginWidget( QWidget *parent, const char *name ); |
33 | ~DatebookPluginWidget(); | 33 | ~DatebookPluginWidget(); |
34 | 34 | ||
35 | 35 | ||
36 | private: | 36 | private: |
37 | DateBookDB* db; | 37 | DateBookDB* db; |
38 | void readConfig(); | 38 | void readConfig(); |
39 | void getDates(); | 39 | void getDates(); |
40 | 40 | ||
41 | // how many lines should be showed in the datebook section | 41 | // how many lines should be showed in the datebook section |
42 | int m_max_lines_meet; | 42 | int m_max_lines_meet; |
43 | // If location is to be showed too, 1 to activate it. | 43 | // If location is to be showed too, 1 to activate it. |
44 | int m_show_location; | 44 | bool m_show_location; |
45 | // if notes should be shown | 45 | // if notes should be shown |
46 | int m_show_notes; | 46 | bool m_show_notes; |
47 | // should only later appointments be shown or all for the current day. | 47 | // should only later appointments be shown or all for the current day. |
48 | int m_onlyLater; | 48 | bool m_onlyLater; |
49 | 49 | ||
50 | }; | 50 | }; |
51 | 51 | ||
52 | #endif | 52 | #endif |