-rw-r--r-- | core/pim/datebook/datebook.cpp | 6 | ||||
-rw-r--r-- | core/pim/datebook/datebookweekheaderimpl.cpp | 8 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 4 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 6 |
4 files changed, 12 insertions, 12 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 3d1bc0c..0a47bb8 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -43,65 +43,65 @@ | |||
43 | 43 | ||
44 | #include <qaction.h> | 44 | #include <qaction.h> |
45 | #include <qcopchannel_qws.h> | 45 | #include <qcopchannel_qws.h> |
46 | #include <qlayout.h> | 46 | #include <qlayout.h> |
47 | #include <qmessagebox.h> | 47 | #include <qmessagebox.h> |
48 | #include <qtimer.h> | 48 | #include <qtimer.h> |
49 | #include <qtl.h> | 49 | #include <qtl.h> |
50 | #include <qtoolbar.h> | 50 | #include <qtoolbar.h> |
51 | #include <qwidgetstack.h> | 51 | #include <qwidgetstack.h> |
52 | 52 | ||
53 | #include <sys/stat.h> | 53 | #include <sys/stat.h> |
54 | #include <sys/types.h> | 54 | #include <sys/types.h> |
55 | #include <fcntl.h> | 55 | #include <fcntl.h> |
56 | #include <unistd.h> | 56 | #include <unistd.h> |
57 | 57 | ||
58 | #include <stdlib.h> | 58 | #include <stdlib.h> |
59 | 59 | ||
60 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | 60 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) |
61 | : QMainWindow( parent, "datebook", f ), | 61 | : QMainWindow( parent, "datebook", f ), |
62 | aPreset( FALSE ), | 62 | aPreset( FALSE ), |
63 | presetTime( -1 ), | 63 | presetTime( -1 ), |
64 | startTime( 8 ), // an acceptable default | 64 | startTime( 8 ), // an acceptable default |
65 | rowStyle( 0 ), | 65 | rowStyle( 0 ), |
66 | bJumpToCurTime(FALSE), | 66 | bJumpToCurTime(FALSE), |
67 | syncing(FALSE), | 67 | syncing(FALSE), |
68 | inSearch(FALSE), | 68 | inSearch(FALSE), |
69 | alarmCounter(0) | 69 | alarmCounter(0) |
70 | { | 70 | { |
71 | bool needEvilHack= false; // if we need an Evil Hack | 71 | bool needEvilHack= false; // if we need an Evil Hack |
72 | QTime t; | 72 | QTime t; |
73 | t.start(); | 73 | t.start(); |
74 | db = new DateBookDBHack; | 74 | db = new DateBookDBHack; |
75 | Opie::Core::odebug << "loading db t=" << t.elapsed() << oendl; | 75 | odebug << "loading db t=" << t.elapsed() << oendl; |
76 | loadSettings(); | 76 | loadSettings(); |
77 | setCaption( tr("Calendar") ); | 77 | setCaption( tr("Calendar") ); |
78 | setIcon( Resource::loadPixmap( "datebook_icon" ) ); | 78 | setIcon( Resource::loadPixmap( "datebook_icon" ) ); |
79 | 79 | ||
80 | setToolBarsMovable( FALSE ); | 80 | setToolBarsMovable( FALSE ); |
81 | 81 | ||
82 | views = new QWidgetStack( this ); | 82 | views = new QWidgetStack( this ); |
83 | setCentralWidget( views ); | 83 | setCentralWidget( views ); |
84 | 84 | ||
85 | dayView = 0; | 85 | dayView = 0; |
86 | weekView = 0; | 86 | weekView = 0; |
87 | weekLstView = 0; | 87 | weekLstView = 0; |
88 | monthView = 0; | 88 | monthView = 0; |
89 | 89 | ||
90 | // QToolBar *bar = new QToolBar( this ); | 90 | // QToolBar *bar = new QToolBar( this ); |
91 | // bar->setHorizontalStretchable( TRUE ); | 91 | // bar->setHorizontalStretchable( TRUE ); |
92 | 92 | ||
93 | // QMenuBar *mb = new QMenuBar( bar ); | 93 | // QMenuBar *mb = new QMenuBar( bar ); |
94 | // mb->setMargin( 0 ); | 94 | // mb->setMargin( 0 ); |
95 | 95 | ||
96 | // QPopupMenu *view = new QPopupMenu( this ); | 96 | // QPopupMenu *view = new QPopupMenu( this ); |
97 | // mb->insertItem( tr( "View" ), view ); | 97 | // mb->insertItem( tr( "View" ), view ); |
98 | 98 | ||
99 | QToolBar *sub_bar = new QToolBar(this); | 99 | QToolBar *sub_bar = new QToolBar(this); |
100 | sub_bar->setHorizontalStretchable(TRUE); | 100 | sub_bar->setHorizontalStretchable(TRUE); |
101 | 101 | ||
102 | QActionGroup *g = new QActionGroup( this ); | 102 | QActionGroup *g = new QActionGroup( this ); |
103 | g->setExclusive( TRUE ); | 103 | g->setExclusive( TRUE ); |
104 | 104 | ||
105 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 105 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
106 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 106 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
107 | a->addTo( sub_bar ); | 107 | a->addTo( sub_bar ); |
@@ -147,65 +147,65 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
147 | sub_bar->addSeparator(); | 147 | sub_bar->addSeparator(); |
148 | 148 | ||
149 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); | 149 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); |
150 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); | 150 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
151 | a->addTo( sub_bar ); | 151 | a->addTo( sub_bar ); |
152 | 152 | ||
153 | a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 ); | 153 | a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 ); |
154 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 154 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
155 | a->addTo( sub_bar ); | 155 | a->addTo( sub_bar ); |
156 | 156 | ||
157 | if(defaultView==DAY) viewDay(); | 157 | if(defaultView==DAY) viewDay(); |
158 | if(defaultView==WEEK) needEvilHack=true;// viewWeek(); | 158 | if(defaultView==WEEK) needEvilHack=true;// viewWeek(); |
159 | if(defaultView==WEEKLST) viewWeekLst(); | 159 | if(defaultView==WEEKLST) viewWeekLst(); |
160 | if(defaultView==MONTH) viewMonth(); | 160 | if(defaultView==MONTH) viewMonth(); |
161 | 161 | ||
162 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); | 162 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); |
163 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); | 163 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); |
164 | 164 | ||
165 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 165 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
166 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), this, SLOT(appMessage(const QCString&,const QByteArray&)) ); | 166 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), this, SLOT(appMessage(const QCString&,const QByteArray&)) ); |
167 | #endif | 167 | #endif |
168 | 168 | ||
169 | // listen on QPE/System | 169 | // listen on QPE/System |
170 | #if defined(Q_WS_QWS) | 170 | #if defined(Q_WS_QWS) |
171 | #if !defined(QT_NO_COP) | 171 | #if !defined(QT_NO_COP) |
172 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); | 172 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); |
173 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); | 173 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); |
174 | channel = new QCopChannel( "QPE/Datebook", this ); | 174 | channel = new QCopChannel( "QPE/Datebook", this ); |
175 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); | 175 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); |
176 | #endif | 176 | #endif |
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | Opie::Core::odebug << "done t=" << t.elapsed() << oendl; | 179 | odebug << "done t=" << t.elapsed() << oendl; |
180 | 180 | ||
181 | connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); | 181 | connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); |
182 | connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) ); | 182 | connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) ); |
183 | /* | 183 | /* |
184 | * Here is a problem description: | 184 | * Here is a problem description: |
185 | * When Weekview is the default view | 185 | * When Weekview is the default view |
186 | * a DateBookWeekView get's created | 186 | * a DateBookWeekView get's created |
187 | * redraw() get's called. So what? | 187 | * redraw() get's called. So what? |
188 | * Remember that we're still in the c'tor | 188 | * Remember that we're still in the c'tor |
189 | * and no final layout has happened? Ok | 189 | * and no final layout has happened? Ok |
190 | * now all Events get arranged. Their x | 190 | * now all Events get arranged. Their x |
191 | * position get's determined by a QHeader | 191 | * position get's determined by a QHeader |
192 | * position. But the QHeader isn't layouted or | 192 | * position. But the QHeader isn't layouted or |
193 | * at the right position. redraw() is a slot | 193 | * at the right position. redraw() is a slot |
194 | * so we'll call it then via a singleShot | 194 | * so we'll call it then via a singleShot |
195 | * from view() | 195 | * from view() |
196 | */ | 196 | */ |
197 | if( needEvilHack ){ | 197 | if( needEvilHack ){ |
198 | QTimer::singleShot( 500, this, SLOT(viewWeek()) ); | 198 | QTimer::singleShot( 500, this, SLOT(viewWeek()) ); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | void DateBook::receive( const QCString &msg, const QByteArray &data ) | 202 | void DateBook::receive( const QCString &msg, const QByteArray &data ) |
203 | { | 203 | { |
204 | QDataStream stream( data, IO_ReadOnly ); | 204 | QDataStream stream( data, IO_ReadOnly ); |
205 | if ( msg == "timeChange(QString)" ) { | 205 | if ( msg == "timeChange(QString)" ) { |
206 | // update active view! | 206 | // update active view! |
207 | if ( dayAction->isOn() ) | 207 | if ( dayAction->isOn() ) |
208 | viewDay(); | 208 | viewDay(); |
209 | else if ( weekAction->isOn() ) | 209 | else if ( weekAction->isOn() ) |
210 | viewWeek(); | 210 | viewWeek(); |
211 | else if ( monthAction->isOn() ) | 211 | else if ( monthAction->isOn() ) |
@@ -873,65 +873,65 @@ void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const | |||
873 | 873 | ||
874 | e = new DateEntry( onMonday, ev, ampm, &newDlg ); | 874 | e = new DateEntry( onMonday, ev, ampm, &newDlg ); |
875 | e->setAlarmEnabled( aPreset, presetTime, Event::Loud ); | 875 | e->setAlarmEnabled( aPreset, presetTime, Event::Loud ); |
876 | sv->addChild( e ); | 876 | sv->addChild( e ); |
877 | while ( QPEApplication::execDialog( &newDlg ) ) { | 877 | while ( QPEApplication::execDialog( &newDlg ) ) { |
878 | ev = e->event(); | 878 | ev = e->event(); |
879 | ev.assignUid(); | 879 | ev.assignUid(); |
880 | QString error = checkEvent( ev ); | 880 | QString error = checkEvent( ev ); |
881 | if ( !error.isNull() ) { | 881 | if ( !error.isNull() ) { |
882 | if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 ) | 882 | if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 ) |
883 | continue; | 883 | continue; |
884 | } | 884 | } |
885 | db->addEvent( ev ); | 885 | db->addEvent( ev ); |
886 | emit newEvent(); | 886 | emit newEvent(); |
887 | break; | 887 | break; |
888 | } | 888 | } |
889 | } | 889 | } |
890 | 890 | ||
891 | void DateBook::setDocument( const QString &filename ) | 891 | void DateBook::setDocument( const QString &filename ) |
892 | { | 892 | { |
893 | if ( filename.find(".vcs") != int(filename.length()) - 4 ) return; | 893 | if ( filename.find(".vcs") != int(filename.length()) - 4 ) return; |
894 | 894 | ||
895 | QValueList<Event> tl = Event::readVCalendar( filename ); | 895 | QValueList<Event> tl = Event::readVCalendar( filename ); |
896 | for( QValueList<Event>::Iterator it = tl.begin(); it != tl.end(); ++it ) { | 896 | for( QValueList<Event>::Iterator it = tl.begin(); it != tl.end(); ++it ) { |
897 | db->addEvent( *it ); | 897 | db->addEvent( *it ); |
898 | } | 898 | } |
899 | } | 899 | } |
900 | 900 | ||
901 | static const char * beamfile = "/tmp/obex/event.vcs"; | 901 | static const char * beamfile = "/tmp/obex/event.vcs"; |
902 | 902 | ||
903 | void DateBook::beamEvent( const Event &e ) | 903 | void DateBook::beamEvent( const Event &e ) |
904 | { | 904 | { |
905 | Opie::Core::odebug << "trying to beam" << oendl; | 905 | odebug << "trying to beam" << oendl; |
906 | unlink( beamfile ); // delete if exists | 906 | unlink( beamfile ); // delete if exists |
907 | mkdir("/tmp/obex/", 0755); | 907 | mkdir("/tmp/obex/", 0755); |
908 | Event::writeVCalendar( beamfile, e ); | 908 | Event::writeVCalendar( beamfile, e ); |
909 | Ir *ir = new Ir( this ); | 909 | Ir *ir = new Ir( this ); |
910 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 910 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
911 | QString description = e.description(); | 911 | QString description = e.description(); |
912 | ir->send( beamfile, description, "text/x-vCalendar" ); | 912 | ir->send( beamfile, description, "text/x-vCalendar" ); |
913 | } | 913 | } |
914 | 914 | ||
915 | void DateBook::beamDone( Ir *ir ) | 915 | void DateBook::beamDone( Ir *ir ) |
916 | { | 916 | { |
917 | delete ir; | 917 | delete ir; |
918 | unlink( beamfile ); | 918 | unlink( beamfile ); |
919 | } | 919 | } |
920 | 920 | ||
921 | void DateBook::slotFind() | 921 | void DateBook::slotFind() |
922 | { | 922 | { |
923 | // move it to the day view... | 923 | // move it to the day view... |
924 | viewDay(); | 924 | viewDay(); |
925 | FindDialog frmFind( "Calendar", this ); // no tr needed | 925 | FindDialog frmFind( "Calendar", this ); // no tr needed |
926 | frmFind.setUseDate( true ); | 926 | frmFind.setUseDate( true ); |
927 | frmFind.setDate( currentDate() ); | 927 | frmFind.setDate( currentDate() ); |
928 | QObject::connect( &frmFind, | 928 | QObject::connect( &frmFind, |
929 | SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)), | 929 | SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)), |
930 | this, | 930 | this, |
931 | SLOT(slotDoFind(const QString&,const QDate&,bool,bool,int)) ); | 931 | SLOT(slotDoFind(const QString&,const QDate&,bool,bool,int)) ); |
932 | QObject::connect( this, | 932 | QObject::connect( this, |
933 | SIGNAL(signalNotFound()), | 933 | SIGNAL(signalNotFound()), |
934 | &frmFind, | 934 | &frmFind, |
935 | SLOT(slotNotFound()) ); | 935 | SLOT(slotNotFound()) ); |
936 | QObject::connect( this, | 936 | QObject::connect( this, |
937 | SIGNAL(signalWrapAround()), | 937 | SIGNAL(signalWrapAround()), |
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp index 123a478..7462de7 100644 --- a/core/pim/datebook/datebookweekheaderimpl.cpp +++ b/core/pim/datebook/datebookweekheaderimpl.cpp | |||
@@ -40,80 +40,80 @@ DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, con | |||
40 | backmonth->setPixmap( Resource::loadPixmap("fastback") ); | 40 | backmonth->setPixmap( Resource::loadPixmap("fastback") ); |
41 | backweek->setPixmap( Resource::loadPixmap("back") ); | 41 | backweek->setPixmap( Resource::loadPixmap("back") ); |
42 | forwardweek->setPixmap( Resource::loadPixmap("forward") ); | 42 | forwardweek->setPixmap( Resource::loadPixmap("forward") ); |
43 | forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); | 43 | forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); |
44 | } | 44 | } |
45 | 45 | ||
46 | /* | 46 | /* |
47 | * Destroys the object and frees any allocated resources | 47 | * Destroys the object and frees any allocated resources |
48 | */ | 48 | */ |
49 | DateBookWeekHeader::~DateBookWeekHeader() | 49 | DateBookWeekHeader::~DateBookWeekHeader() |
50 | { | 50 | { |
51 | // no need to delete child widgets, Qt does it all for us | 51 | // no need to delete child widgets, Qt does it all for us |
52 | } | 52 | } |
53 | 53 | ||
54 | void DateBookWeekHeader::pickDate() | 54 | void DateBookWeekHeader::pickDate() |
55 | { | 55 | { |
56 | static QPopupMenu *m1 = 0; | 56 | static QPopupMenu *m1 = 0; |
57 | static DateBookMonth *picker = 0; | 57 | static DateBookMonth *picker = 0; |
58 | if ( !m1 ) { | 58 | if ( !m1 ) { |
59 | m1 = new QPopupMenu( this ); | 59 | m1 = new QPopupMenu( this ); |
60 | picker = new DateBookMonth( m1, 0, TRUE ); | 60 | picker = new DateBookMonth( m1, 0, TRUE ); |
61 | m1->insertItem( picker ); | 61 | m1->insertItem( picker ); |
62 | connect( picker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( setDate(int,int,int) ) ); | 62 | connect( picker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( setDate(int,int,int) ) ); |
63 | // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) ); | 63 | // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) ); |
64 | } | 64 | } |
65 | picker->setDate( date.year(), date.month(), date.day() ); | 65 | picker->setDate( date.year(), date.month(), date.day() ); |
66 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); | 66 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); |
67 | picker->setFocus(); | 67 | picker->setFocus(); |
68 | } | 68 | } |
69 | 69 | ||
70 | void DateBookWeekHeader::nextMonth() | 70 | void DateBookWeekHeader::nextMonth() |
71 | { | 71 | { |
72 | Opie::Core::owarn << "nextMonth()" << oendl; | 72 | owarn << "nextMonth()" << oendl; |
73 | setDate(date.addDays(28)); | 73 | setDate(date.addDays(28)); |
74 | } | 74 | } |
75 | void DateBookWeekHeader::prevMonth() | 75 | void DateBookWeekHeader::prevMonth() |
76 | { | 76 | { |
77 | Opie::Core::owarn << "prevMonth()" << oendl; | 77 | owarn << "prevMonth()" << oendl; |
78 | setDate(date.addDays(-28)); | 78 | setDate(date.addDays(-28)); |
79 | } | 79 | } |
80 | void DateBookWeekHeader::nextWeek() | 80 | void DateBookWeekHeader::nextWeek() |
81 | { | 81 | { |
82 | Opie::Core::owarn << "nextWeek()" << oendl; | 82 | owarn << "nextWeek()" << oendl; |
83 | setDate(date.addDays(7)); | 83 | setDate(date.addDays(7)); |
84 | } | 84 | } |
85 | void DateBookWeekHeader::prevWeek() | 85 | void DateBookWeekHeader::prevWeek() |
86 | { | 86 | { |
87 | Opie::Core::owarn << "prevWeek()" << oendl; | 87 | owarn << "prevWeek()" << oendl; |
88 | setDate(date.addDays(-7)); | 88 | setDate(date.addDays(-7)); |
89 | } | 89 | } |
90 | 90 | ||
91 | void DateBookWeekHeader::setDate( int y, int m, int d ) | 91 | void DateBookWeekHeader::setDate( int y, int m, int d ) |
92 | { | 92 | { |
93 | setDate(QDate(y,m,d)); | 93 | setDate(QDate(y,m,d)); |
94 | } | 94 | } |
95 | 95 | ||
96 | void DateBookWeekHeader::setDate(const QDate &d) { | 96 | void DateBookWeekHeader::setDate(const QDate &d) { |
97 | int year,week,dayofweek; | 97 | int year,week,dayofweek; |
98 | date=d; | 98 | date=d; |
99 | dayofweek=d.dayOfWeek(); | 99 | dayofweek=d.dayOfWeek(); |
100 | if(bStartOnMonday) | 100 | if(bStartOnMonday) |
101 | dayofweek--; | 101 | dayofweek--; |
102 | else if( dayofweek == 7 ) | 102 | else if( dayofweek == 7 ) |
103 | // we already have the right day -7 would lead to the current week.. | 103 | // we already have the right day -7 would lead to the current week.. |
104 | dayofweek = 0; | 104 | dayofweek = 0; |
105 | 105 | ||
106 | date=date.addDays(-dayofweek); | 106 | date=date.addDays(-dayofweek); |
107 | calcWeek(date,week,year,bStartOnMonday); | 107 | calcWeek(date,week,year,bStartOnMonday); |
108 | QDate start=date; | 108 | QDate start=date; |
109 | QDate stop=start.addDays(6); | 109 | QDate stop=start.addDays(6); |
110 | labelDate->setText( QString::number(start.day()) + "." + | 110 | labelDate->setText( QString::number(start.day()) + "." + |
111 | Calendar::nameOfMonth( start.month()) + "-" + | 111 | Calendar::nameOfMonth( start.month()) + "-" + |
112 | QString::number(stop.day()) + "." + | 112 | QString::number(stop.day()) + "." + |
113 | Calendar::nameOfMonth( stop.month()) +" ("+ | 113 | Calendar::nameOfMonth( stop.month()) +" ("+ |
114 | tr("w")+":"+QString::number( week ) +")"); | 114 | tr("w")+":"+QString::number( week ) +")"); |
115 | date = d; // bugfix: 0001126 - date has to be the selected date, not monday! | 115 | date = d; // bugfix: 0001126 - date has to be the selected date, not monday! |
116 | emit dateChanged(date); | 116 | emit dateChanged(date); |
117 | } | 117 | } |
118 | 118 | ||
119 | void DateBookWeekHeader::setStartOfWeek( bool onMonday ) | 119 | void DateBookWeekHeader::setStartOfWeek( bool onMonday ) |
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index de74d46..fe2ab51 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -131,114 +131,114 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, | |||
131 | */ | 131 | */ |
132 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday | 132 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday |
133 | QPalette pal=label->palette(); | 133 | QPalette pal=label->palette(); |
134 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); | 134 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); |
135 | label->setPalette(pal); | 135 | label->setPalette(pal); |
136 | } | 136 | } |
137 | 137 | ||
138 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); | 138 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); |
139 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); | 139 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); |
140 | } | 140 | } |
141 | 141 | ||
142 | void DateBookWeekLstDayHdr::showDay() { | 142 | void DateBookWeekLstDayHdr::showDay() { |
143 | emit showDate(date.year(), date.month(), date.day()); | 143 | emit showDate(date.year(), date.month(), date.day()); |
144 | } | 144 | } |
145 | 145 | ||
146 | void DateBookWeekLstDayHdr::newEvent() { | 146 | void DateBookWeekLstDayHdr::newEvent() { |
147 | QDateTime start, stop; | 147 | QDateTime start, stop; |
148 | start=stop=date; | 148 | start=stop=date; |
149 | start.setTime(QTime(10,0)); | 149 | start.setTime(QTime(10,0)); |
150 | stop.setTime(QTime(12,0)); | 150 | stop.setTime(QTime(12,0)); |
151 | 151 | ||
152 | emit addEvent(start,stop,"",0); | 152 | emit addEvent(start,stop,"",0); |
153 | } | 153 | } |
154 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | 154 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, |
155 | int weeklistviewconfig, | 155 | int weeklistviewconfig, |
156 | QWidget* parent, | 156 | QWidget* parent, |
157 | const char* name, | 157 | const char* name, |
158 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) | 158 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) |
159 | { | 159 | { |
160 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", | 160 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", |
161 | QString s,start,middle,end,day; | 161 | QString s,start,middle,end,day; |
162 | 162 | ||
163 | Opie::Core::odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl; | 163 | odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl; |
164 | if(weeklistviewconfig==NONE) {// No times displayed. | 164 | if(weeklistviewconfig==NONE) {// No times displayed. |
165 | // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | 165 | // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); |
166 | // middle.sprintf("<--->"); | 166 | // middle.sprintf("<--->"); |
167 | // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | 167 | // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); |
168 | // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | 168 | // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); |
169 | } else if(weeklistviewconfig==NORMAL) {// "Normal", only display start time. | 169 | } else if(weeklistviewconfig==NORMAL) {// "Normal", only display start time. |
170 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 170 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
171 | middle.sprintf(" |---"); | 171 | middle.sprintf(" |---"); |
172 | end.sprintf("__|__"); | 172 | end.sprintf("__|__"); |
173 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 173 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
174 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. | 174 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. |
175 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | 175 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); |
176 | middle.sprintf("<--->"); | 176 | middle.sprintf("<--->"); |
177 | end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | 177 | end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); |
178 | day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | 178 | day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); |
179 | } | 179 | } |
180 | 180 | ||
181 | if(ev.event().type() == Event::Normal) { | 181 | if(ev.event().type() == Event::Normal) { |
182 | if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) {// day event. | 182 | if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) {// day event. |
183 | s=day; | 183 | s=day; |
184 | } else if(ev.startDate()==ev.date()) {// start event. | 184 | } else if(ev.startDate()==ev.date()) {// start event. |
185 | s=start; | 185 | s=start; |
186 | } else if(ev.endDate()==ev.date()) { // end event. | 186 | } else if(ev.endDate()==ev.date()) { // end event. |
187 | s=end; | 187 | s=end; |
188 | } else {// middle day. | 188 | } else {// middle day. |
189 | s=middle; | 189 | s=middle; |
190 | } | 190 | } |
191 | } else { | 191 | } else { |
192 | s=""; | 192 | s=""; |
193 | } | 193 | } |
194 | setText(QString(s) + " " + ev.description()); | 194 | setText(QString(s) + " " + ev.description()); |
195 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 195 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
196 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 196 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
197 | } | 197 | } |
198 | void DateBookWeekLstEvent::editMe() { | 198 | void DateBookWeekLstEvent::editMe() { |
199 | emit editEvent(event.event()); | 199 | emit editEvent(event.event()); |
200 | } | 200 | } |
201 | 201 | ||
202 | 202 | ||
203 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | 203 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, |
204 | const QDate &d, bool onM, | 204 | const QDate &d, bool onM, |
205 | QWidget* parent, | 205 | QWidget* parent, |
206 | const char* name, WFlags fl) | 206 | const char* name, WFlags fl) |
207 | : QWidget( parent, name, fl ) | 207 | : QWidget( parent, name, fl ) |
208 | { | 208 | { |
209 | Config config("DateBook"); | 209 | Config config("DateBook"); |
210 | config.setGroup("Main"); | 210 | config.setGroup("Main"); |
211 | int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); | 211 | int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); |
212 | Opie::Core::odebug << "weeklistviewconfig: " << weeklistviewconfig << oendl; | 212 | odebug << "weeklistviewconfig: " << weeklistviewconfig << oendl; |
213 | 213 | ||
214 | bStartOnMonday=onM; | 214 | bStartOnMonday=onM; |
215 | setPalette(white); | 215 | setPalette(white); |
216 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); | 216 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); |
217 | 217 | ||
218 | QVBoxLayout *layout = new QVBoxLayout( this ); | 218 | QVBoxLayout *layout = new QVBoxLayout( this ); |
219 | 219 | ||
220 | qBubbleSort(ev); | 220 | qBubbleSort(ev); |
221 | QValueListIterator<EffectiveEvent> it; | 221 | QValueListIterator<EffectiveEvent> it; |
222 | it=ev.begin(); | 222 | it=ev.begin(); |
223 | 223 | ||
224 | int dayOrder[7]; | 224 | int dayOrder[7]; |
225 | if (bStartOnMonday) { | 225 | if (bStartOnMonday) { |
226 | for (int d=0; d<7; d++) dayOrder[d]=d+1; | 226 | for (int d=0; d<7; d++) dayOrder[d]=d+1; |
227 | } else { | 227 | } else { |
228 | for (int d=0; d<7; d++) dayOrder[d]=d; | 228 | for (int d=0; d<7; d++) dayOrder[d]=d; |
229 | dayOrder[0]=7; | 229 | dayOrder[0]=7; |
230 | } | 230 | } |
231 | 231 | ||
232 | // Calculate offset to first day of week. | 232 | // Calculate offset to first day of week. |
233 | int dayoffset=d.dayOfWeek(); | 233 | int dayoffset=d.dayOfWeek(); |
234 | if(bStartOnMonday) dayoffset--; | 234 | if(bStartOnMonday) dayoffset--; |
235 | else if( dayoffset == 7 ) dayoffset = 0; | 235 | else if( dayoffset == 7 ) dayoffset = 0; |
236 | 236 | ||
237 | for (int i=0; i<7; i++) { | 237 | for (int i=0; i<7; i++) { |
238 | // Header | 238 | // Header |
239 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); | 239 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); |
240 | connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 240 | connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
241 | connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | 241 | connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), |
242 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | 242 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); |
243 | layout->addWidget(hdr); | 243 | layout->addWidget(hdr); |
244 | 244 | ||
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index 42bdbe2..297da94 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp | |||
@@ -402,83 +402,83 @@ Event DateEntry::event() | |||
402 | Event ev; | 402 | Event ev; |
403 | Event::SoundTypeChoice st; | 403 | Event::SoundTypeChoice st; |
404 | ev.setDescription( comboDescription->currentText() ); | 404 | ev.setDescription( comboDescription->currentText() ); |
405 | ev.setLocation( comboLocation->currentText() ); | 405 | ev.setLocation( comboLocation->currentText() ); |
406 | ev.setCategories( comboCategory->currentCategories() ); | 406 | ev.setCategories( comboCategory->currentCategories() ); |
407 | ev.setType( checkAllDay->isChecked() ? Event::AllDay : Event::Normal ); | 407 | ev.setType( checkAllDay->isChecked() ? Event::AllDay : Event::Normal ); |
408 | if ( startDate > endDate ) { | 408 | if ( startDate > endDate ) { |
409 | QDate tmp = endDate; | 409 | QDate tmp = endDate; |
410 | endDate = startDate; | 410 | endDate = startDate; |
411 | startDate = tmp; | 411 | startDate = tmp; |
412 | } | 412 | } |
413 | 413 | ||
414 | // This is now done in the changed slots | 414 | // This is now done in the changed slots |
415 | // startTime = parseTime( comboStart->text(), ampm ); | 415 | // startTime = parseTime( comboStart->text(), ampm ); |
416 | //endTime = parseTime( comboEnd->text(), ampm ); | 416 | //endTime = parseTime( comboEnd->text(), ampm ); |
417 | 417 | ||
418 | if ( startTime > endTime && endDate == startDate ) { | 418 | if ( startTime > endTime && endDate == startDate ) { |
419 | QTime tmp = endTime; | 419 | QTime tmp = endTime; |
420 | endTime = startTime; | 420 | endTime = startTime; |
421 | startTime = tmp; | 421 | startTime = tmp; |
422 | } | 422 | } |
423 | // don't set the time if theres no need too | 423 | // don't set the time if theres no need too |
424 | if ( ev.type() == Event::AllDay ) { | 424 | if ( ev.type() == Event::AllDay ) { |
425 | startTime.setHMS( 0, 0, 0 ); | 425 | startTime.setHMS( 0, 0, 0 ); |
426 | endTime.setHMS( 23, 59, 59 ); | 426 | endTime.setHMS( 23, 59, 59 ); |
427 | } | 427 | } |
428 | 428 | ||
429 | // adjust start and end times based on timezone | 429 | // adjust start and end times based on timezone |
430 | QDateTime start( startDate, startTime ); | 430 | QDateTime start( startDate, startTime ); |
431 | QDateTime end( endDate, endTime ); | 431 | QDateTime end( endDate, endTime ); |
432 | time_t start_utc, end_utc; | 432 | time_t start_utc, end_utc; |
433 | 433 | ||
434 | //Opie::Core::odebug << "tz: " << timezone->currentZone() << oendl; | 434 | //odebug << "tz: " << timezone->currentZone() << oendl; |
435 | 435 | ||
436 | // get real timezone | 436 | // get real timezone |
437 | QString realTZ; | 437 | QString realTZ; |
438 | realTZ = QString::fromLocal8Bit( getenv("TZ") ); | 438 | realTZ = QString::fromLocal8Bit( getenv("TZ") ); |
439 | 439 | ||
440 | // set timezone | 440 | // set timezone |
441 | if ( setenv( "TZ", timezone->currentZone(), true ) != 0 ) | 441 | if ( setenv( "TZ", timezone->currentZone(), true ) != 0 ) |
442 | Opie::Core::owarn << "There was a problem setting the timezone." << oendl; | 442 | owarn << "There was a problem setting the timezone." << oendl; |
443 | 443 | ||
444 | // convert to UTC based on selected TZ (calling tzset internally) | 444 | // convert to UTC based on selected TZ (calling tzset internally) |
445 | start_utc = TimeConversion::toUTC( start ); | 445 | start_utc = TimeConversion::toUTC( start ); |
446 | end_utc = TimeConversion::toUTC( end ); | 446 | end_utc = TimeConversion::toUTC( end ); |
447 | 447 | ||
448 | // done playing around... put it all back | 448 | // done playing around... put it all back |
449 | unsetenv( "TZ" ); | 449 | unsetenv( "TZ" ); |
450 | if ( !realTZ.isNull() ) | 450 | if ( !realTZ.isNull() ) |
451 | if ( setenv( "TZ", realTZ, true ) != 0 ) | 451 | if ( setenv( "TZ", realTZ, true ) != 0 ) |
452 | Opie::Core::owarn << "There was a problem setting the timezone." << oendl; | 452 | owarn << "There was a problem setting the timezone." << oendl; |
453 | 453 | ||
454 | // convert UTC to local time (calling tzset internally) | 454 | // convert UTC to local time (calling tzset internally) |
455 | ev.setStart( TimeConversion::fromUTC( start_utc ) ); | 455 | ev.setStart( TimeConversion::fromUTC( start_utc ) ); |
456 | ev.setEnd( TimeConversion::fromUTC( end_utc ) ); | 456 | ev.setEnd( TimeConversion::fromUTC( end_utc ) ); |
457 | 457 | ||
458 | // we only have one type of sound at the moment... LOUD!!! | 458 | // we only have one type of sound at the moment... LOUD!!! |
459 | if ( comboSound->currentItem() != 0 ) | 459 | if ( comboSound->currentItem() != 0 ) |
460 | st = Event::Loud; | 460 | st = Event::Loud; |
461 | else | 461 | else |
462 | st = Event::Silent; | 462 | st = Event::Silent; |
463 | ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st ); | 463 | ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st ); |
464 | if ( rp.type != Event::NoRepeat ) | 464 | if ( rp.type != Event::NoRepeat ) |
465 | ev.setRepeat( TRUE, rp ); | 465 | ev.setRepeat( TRUE, rp ); |
466 | ev.setNotes( noteStr ); | 466 | ev.setNotes( noteStr ); |
467 | 467 | ||
468 | //cout << "Start: " << comboStart->currentText() << endl; | 468 | //cout << "Start: " << comboStart->currentText() << endl; |
469 | 469 | ||
470 | return ev; | 470 | return ev; |
471 | } | 471 | } |
472 | 472 | ||
473 | void DateEntry::setRepeatLabel() | 473 | void DateEntry::setRepeatLabel() |
474 | { | 474 | { |
475 | 475 | ||
476 | switch( rp.type ) { | 476 | switch( rp.type ) { |
477 | case Event::Daily: | 477 | case Event::Daily: |
478 | cmdRepeat->setText( tr("Daily...") ); | 478 | cmdRepeat->setText( tr("Daily...") ); |
479 | break; | 479 | break; |
480 | case Event::Weekly: | 480 | case Event::Weekly: |
481 | cmdRepeat->setText( tr("Weekly...") ); | 481 | cmdRepeat->setText( tr("Weekly...") ); |
482 | break; | 482 | break; |
483 | case Event::MonthlyDay: | 483 | case Event::MonthlyDay: |
484 | case Event::MonthlyDate: | 484 | case Event::MonthlyDate: |