summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/ui/opimmainwindow.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/ui/opimmainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/ui/opimmainwindow.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/libopie2/opiepim/ui/opimmainwindow.cpp b/libopie2/opiepim/ui/opimmainwindow.cpp
index 40dc297..8ce2062 100644
--- a/libopie2/opiepim/ui/opimmainwindow.cpp
+++ b/libopie2/opiepim/ui/opimmainwindow.cpp
@@ -5,58 +5,65 @@
5 .=l. 5 .=l.
6 .>+-= 6 .>+-=
7 _;:, .> :=|. This program is free software; you can 7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License, 11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21 : = ...= . :.=- 21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU 22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29#include <qapplication.h> 29
30#include <qdatetime.h> 30#include "opimmainwindow.h"
31#include <qcopchannel_qws.h> 31
32/* OPIE */
33#include <opie2/opimresolver.h>
34#include <opie2/odebug.h>
32 35
33#include <qpe/sound.h> 36#include <qpe/sound.h>
34#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
35#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
36 39
37#include <opie2/opimresolver.h> 40/* QT */
38#include "opimmainwindow.h" 41#include <qapplication.h>
42#include <qdatetime.h>
43#include <qcopchannel_qws.h>
44
45
39 46
40namespace Opie { 47namespace Opie {
41OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, 48OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent,
42 const char* name, WFlags flag ) 49 const char* name, WFlags flag )
43 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { 50 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) {
44 51
45 /* 52 /*
46 * let's generate our QCopChannel 53 * let's generate our QCopChannel
47 */ 54 */
48 m_str = QString("QPE/"+m_service).local8Bit(); 55 m_str = QString("QPE/"+m_service).local8Bit();
49 m_channel= new QCopChannel(m_str, this ); 56 m_channel= new QCopChannel(m_str, this );
50 connect(m_channel, SIGNAL(received(const QCString&,const QByteArray&) ), 57 connect(m_channel, SIGNAL(received(const QCString&,const QByteArray&) ),
51 this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); 58 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
52 connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&) ), 59 connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&) ),
53 this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); 60 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
54 61
55 /* connect flush and reload */ 62 /* connect flush and reload */
56 connect(qApp, SIGNAL(flush() ), 63 connect(qApp, SIGNAL(flush() ),
57 this, SLOT(flush() ) ); 64 this, SLOT(flush() ) );
58 connect(qApp, SIGNAL(reload() ), 65 connect(qApp, SIGNAL(reload() ),
59 this, SLOT(reload() ) ); 66 this, SLOT(reload() ) );
60} 67}
61OPimMainWindow::~OPimMainWindow() { 68OPimMainWindow::~OPimMainWindow() {
62 delete m_channel; 69 delete m_channel;
@@ -95,49 +102,49 @@ void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array )
95 raise(); 102 raise();
96 int uid; 103 int uid;
97 stream >> uid; 104 stream >> uid;
98 show( uid ); 105 show( uid );
99 needShow = true; 106 needShow = true;
100 }else if ( cmd == "edit(int)" ) { 107 }else if ( cmd == "edit(int)" ) {
101 raise(); 108 raise();
102 int uid; 109 int uid;
103 stream >> uid; 110 stream >> uid;
104 edit( uid ); 111 edit( uid );
105 }else if ( cmd == "add(int,QByteArray)" ) { 112 }else if ( cmd == "add(int,QByteArray)" ) {
106 int rtti; 113 int rtti;
107 QByteArray array; 114 QByteArray array;
108 stream >> rtti; 115 stream >> rtti;
109 stream >> array; 116 stream >> array;
110 m_fallBack = record(rtti, array ); 117 m_fallBack = record(rtti, array );
111 if (!m_fallBack) return; 118 if (!m_fallBack) return;
112 add( *m_fallBack ); 119 add( *m_fallBack );
113 delete m_fallBack; 120 delete m_fallBack;
114 }else if ( cmd == "alarm(QDateTime,int)" ) { 121 }else if ( cmd == "alarm(QDateTime,int)" ) {
115 raise(); 122 raise();
116 QDateTime dt; int uid; 123 QDateTime dt; int uid;
117 stream >> dt; 124 stream >> dt;
118 stream >> uid; 125 stream >> uid;
119 qWarning(" Date: %s Uid: %d", dt.toString().latin1(), uid ); 126 owarn << " Date: " << dt.toString() << " Uid: " << uid << "" << oendl;
120 QDateTime current = QDateTime::currentDateTime(); 127 QDateTime current = QDateTime::currentDateTime();
121 if ( current.time().hour() != dt.time().hour() && current.time().minute() != dt.time().minute() ) 128 if ( current.time().hour() != dt.time().hour() && current.time().minute() != dt.time().minute() )
122 return; 129 return;
123 doAlarm( dt, uid ); 130 doAlarm( dt, uid );
124 needShow = true; 131 needShow = true;
125 } 132 }
126 133
127 if (needShow ) 134 if (needShow )
128 QPEApplication::setKeepRunning(); 135 QPEApplication::setKeepRunning();
129} 136}
130/* implement the url scripting here */ 137/* implement the url scripting here */
131void OPimMainWindow::setDocument( const QString& str) { 138void OPimMainWindow::setDocument( const QString& str) {
132 doSetDocument( str ); 139 doSetDocument( str );
133} 140}
134/* 141/*
135 * we now try to get the array demarshalled 142 * we now try to get the array demarshalled
136 * check if the rtti matches this one 143 * check if the rtti matches this one
137 */ 144 */
138OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) { 145OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) {
139 if ( service() != rtti ) 146 if ( service() != rtti )
140 return 0l; 147 return 0l;
141 148
142 OPimRecord* record = OPimResolver::self()->record( rtti ); 149 OPimRecord* record = OPimResolver::self()->record( rtti );
143 QDataStream str(array, IO_ReadOnly ); 150 QDataStream str(array, IO_ReadOnly );