Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebook.cpp | 6 |
1 files changed, 3 insertions, 3 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 | |||
@@ -51,49 +51,49 @@ | |||
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); |
@@ -155,49 +155,49 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
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 | { |
@@ -881,49 +881,49 @@ void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const | |||
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)), |