-rw-r--r-- | libopie/pim/ocontactaccess.cpp | 13 | ||||
-rw-r--r-- | libopie/pim/opimmainwindow.cpp | 8 |
2 files changed, 13 insertions, 8 deletions
diff --git a/libopie/pim/ocontactaccess.cpp b/libopie/pim/ocontactaccess.cpp index 2e3ec1f..bc359f7 100644 --- a/libopie/pim/ocontactaccess.cpp +++ b/libopie/pim/ocontactaccess.cpp | |||
@@ -1,47 +1,52 @@ | |||
1 | /* | 1 | /* |
2 | * Class to manage the Contacts. | 2 | * Class to manage the Contacts. |
3 | * | 3 | * |
4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) | 4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) |
5 | * | 5 | * |
6 | * ===================================================================== | 6 | * ===================================================================== |
7 | *This program is free software; you can redistribute it and/or | 7 | *This program is free software; you can redistribute it and/or |
8 | *modify it under the terms of the GNU Library General Public | 8 | *modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; either | 9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. | 10 | * version 2 of the License, or (at your option) any later version. |
11 | * ===================================================================== | 11 | * ===================================================================== |
12 | * Info: This class could just work with a change in the header-file | 12 | * Info: This class could just work with a change in the header-file |
13 | * of the Contact class ! Therefore our libopie only compiles | 13 | * of the Contact class ! Therefore our libopie only compiles |
14 | * with our version of libqpe | 14 | * with our version of libqpe |
15 | * ===================================================================== | 15 | * ===================================================================== |
16 | * ToDo: XML-Backend: Automatic reload if something was changed... | 16 | * ToDo: XML-Backend: Automatic reload if something was changed... |
17 | * | 17 | * |
18 | * | 18 | * |
19 | * ===================================================================== | 19 | * ===================================================================== |
20 | * Version: $Id$ | 20 | * Version: $Id$ |
21 | * ===================================================================== | 21 | * ===================================================================== |
22 | * History: | 22 | * History: |
23 | * $Log$ | 23 | * $Log$ |
24 | * Revision 1.9 2004/03/02 12:14:22 alwin | ||
25 | * run the optimize_connect script | ||
26 | * the whole cvs is tagged with "before_optimize_connect" if there are problems you | ||
27 | * can check the diff (but it had compiled and run here) | ||
28 | * | ||
24 | * Revision 1.8 2003/05/08 13:55:09 tille | 29 | * Revision 1.8 2003/05/08 13:55:09 tille |
25 | * search stuff | 30 | * search stuff |
26 | * and match, toRichText & toShortText in oevent | 31 | * and match, toRichText & toShortText in oevent |
27 | * | 32 | * |
28 | * Revision 1.7 2002/11/13 14:14:51 eilers | 33 | * Revision 1.7 2002/11/13 14:14:51 eilers |
29 | * Added sorted for Contacts.. | 34 | * Added sorted for Contacts.. |
30 | * | 35 | * |
31 | * Revision 1.6 2002/11/01 15:10:42 eilers | 36 | * Revision 1.6 2002/11/01 15:10:42 eilers |
32 | * Added regExp-search in database for all fields in a contact. | 37 | * Added regExp-search in database for all fields in a contact. |
33 | * | 38 | * |
34 | * Revision 1.5 2002/10/16 10:52:40 eilers | 39 | * Revision 1.5 2002/10/16 10:52:40 eilers |
35 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) | 40 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) |
36 | * | 41 | * |
37 | * Revision 1.4 2002/10/14 16:21:54 eilers | 42 | * Revision 1.4 2002/10/14 16:21:54 eilers |
38 | * Some minor interface updates | 43 | * Some minor interface updates |
39 | * | 44 | * |
40 | * Revision 1.3 2002/10/07 17:34:24 eilers | 45 | * Revision 1.3 2002/10/07 17:34:24 eilers |
41 | * added OBackendFactory for advanced backend access | 46 | * added OBackendFactory for advanced backend access |
42 | * | 47 | * |
43 | * Revision 1.2 2002/10/02 16:18:11 eilers | 48 | * Revision 1.2 2002/10/02 16:18:11 eilers |
44 | * debugged and seems to work almost perfectly .. | 49 | * debugged and seems to work almost perfectly .. |
45 | * | 50 | * |
46 | * Revision 1.1 2002/09/27 17:11:44 eilers | 51 | * Revision 1.1 2002/09/27 17:11:44 eilers |
47 | * Added API for accessing the Contact-Database ! It is compiling, but | 52 | * Added API for accessing the Contact-Database ! It is compiling, but |
@@ -70,54 +75,54 @@ | |||
70 | #include <unistd.h> | 75 | #include <unistd.h> |
71 | #include <stdlib.h> | 76 | #include <stdlib.h> |
72 | 77 | ||
73 | #include "ocontactaccessbackend_xml.h" | 78 | #include "ocontactaccessbackend_xml.h" |
74 | 79 | ||
75 | 80 | ||
76 | OContactAccess::OContactAccess ( const QString appname, const QString , | 81 | OContactAccess::OContactAccess ( const QString appname, const QString , |
77 | OContactAccessBackend* end, bool autosync ): | 82 | OContactAccessBackend* end, bool autosync ): |
78 | OPimAccessTemplate<OContact>( end ) | 83 | OPimAccessTemplate<OContact>( end ) |
79 | { | 84 | { |
80 | /* take care of the backend. If there is no one defined, we | 85 | /* take care of the backend. If there is no one defined, we |
81 | * will use the XML-Backend as default (until we have a cute SQL-Backend..). | 86 | * will use the XML-Backend as default (until we have a cute SQL-Backend..). |
82 | */ | 87 | */ |
83 | if( end == 0 ) { | 88 | if( end == 0 ) { |
84 | qWarning ("Using BackendFactory !"); | 89 | qWarning ("Using BackendFactory !"); |
85 | end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname ); | 90 | end = OBackendFactory<OContactAccessBackend>::Default( "contact", appname ); |
86 | } | 91 | } |
87 | // Set backend locally and in template | 92 | // Set backend locally and in template |
88 | m_backEnd = end; | 93 | m_backEnd = end; |
89 | OPimAccessTemplate<OContact>::setBackEnd (end); | 94 | OPimAccessTemplate<OContact>::setBackEnd (end); |
90 | 95 | ||
91 | 96 | ||
92 | /* Connect signal of external db change to function */ | 97 | /* Connect signal of external db change to function */ |
93 | QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); | 98 | QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); |
94 | connect( dbchannel, SIGNAL(received(const QCString &, const QByteArray &)), | 99 | connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)), |
95 | this, SLOT(copMessage( const QCString &, const QByteArray &)) ); | 100 | this, SLOT(copMessage(const QCString&,const QByteArray&)) ); |
96 | if ( autosync ){ | 101 | if ( autosync ){ |
97 | QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); | 102 | QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); |
98 | connect( syncchannel, SIGNAL(received(const QCString &, const QByteArray &)), | 103 | connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)), |
99 | this, SLOT(copMessage( const QCString &, const QByteArray &)) ); | 104 | this, SLOT(copMessage(const QCString&,const QByteArray&)) ); |
100 | } | 105 | } |
101 | 106 | ||
102 | 107 | ||
103 | } | 108 | } |
104 | OContactAccess::~OContactAccess () | 109 | OContactAccess::~OContactAccess () |
105 | { | 110 | { |
106 | /* The user may forget to save the changed database, therefore try to | 111 | /* The user may forget to save the changed database, therefore try to |
107 | * do it for him.. | 112 | * do it for him.. |
108 | */ | 113 | */ |
109 | save(); | 114 | save(); |
110 | // delete m_backEnd; is done by template.. | 115 | // delete m_backEnd; is done by template.. |
111 | } | 116 | } |
112 | 117 | ||
113 | 118 | ||
114 | bool OContactAccess::save () | 119 | bool OContactAccess::save () |
115 | { | 120 | { |
116 | /* If the database was changed externally, we could not save the | 121 | /* If the database was changed externally, we could not save the |
117 | * Data. This will remove added items which is unacceptable ! | 122 | * Data. This will remove added items which is unacceptable ! |
118 | * Therefore: Reload database and merge the data... | 123 | * Therefore: Reload database and merge the data... |
119 | */ | 124 | */ |
120 | if ( OPimAccessTemplate<OContact>::wasChangedExternally() ) | 125 | if ( OPimAccessTemplate<OContact>::wasChangedExternally() ) |
121 | reload(); | 126 | reload(); |
122 | 127 | ||
123 | bool status = OPimAccessTemplate<OContact>::save(); | 128 | bool status = OPimAccessTemplate<OContact>::save(); |
diff --git a/libopie/pim/opimmainwindow.cpp b/libopie/pim/opimmainwindow.cpp index 2739e26..99a0333 100644 --- a/libopie/pim/opimmainwindow.cpp +++ b/libopie/pim/opimmainwindow.cpp | |||
@@ -1,48 +1,48 @@ | |||
1 | #include <qapplication.h> | 1 | #include <qapplication.h> |
2 | #include <qdatetime.h> | 2 | #include <qdatetime.h> |
3 | #include <qcopchannel_qws.h> | 3 | #include <qcopchannel_qws.h> |
4 | 4 | ||
5 | #include <qpe/sound.h> | 5 | #include <qpe/sound.h> |
6 | #include <qpe/qcopenvelope_qws.h> | 6 | #include <qpe/qcopenvelope_qws.h> |
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | 8 | ||
9 | #include "opimresolver.h" | 9 | #include "opimresolver.h" |
10 | #include "opimmainwindow.h" | 10 | #include "opimmainwindow.h" |
11 | 11 | ||
12 | OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, | 12 | OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, |
13 | const char* name, WFlags flag ) | 13 | const char* name, WFlags flag ) |
14 | : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { | 14 | : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * let's generate our QCopChannel | 17 | * let's generate our QCopChannel |
18 | */ | 18 | */ |
19 | m_str = QString("QPE/"+m_service).local8Bit(); | 19 | m_str = QString("QPE/"+m_service).local8Bit(); |
20 | m_channel= new QCopChannel(m_str, this ); | 20 | m_channel= new QCopChannel(m_str, this ); |
21 | connect(m_channel, SIGNAL(received(const QCString&, const QByteArray& ) ), | 21 | connect(m_channel, SIGNAL(received(const QCString&,const QByteArray&) ), |
22 | this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); | 22 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
23 | connect(qApp, SIGNAL(appMessage(const QCString&, const QByteArray& ) ), | 23 | connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&) ), |
24 | this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); | 24 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
25 | 25 | ||
26 | /* connect flush and reload */ | 26 | /* connect flush and reload */ |
27 | connect(qApp, SIGNAL(flush() ), | 27 | connect(qApp, SIGNAL(flush() ), |
28 | this, SLOT(flush() ) ); | 28 | this, SLOT(flush() ) ); |
29 | connect(qApp, SIGNAL(reload() ), | 29 | connect(qApp, SIGNAL(reload() ), |
30 | this, SLOT(reload() ) ); | 30 | this, SLOT(reload() ) ); |
31 | } | 31 | } |
32 | OPimMainWindow::~OPimMainWindow() { | 32 | OPimMainWindow::~OPimMainWindow() { |
33 | delete m_channel; | 33 | delete m_channel; |
34 | } | 34 | } |
35 | QCopChannel* OPimMainWindow::channel() { | 35 | QCopChannel* OPimMainWindow::channel() { |
36 | return m_channel; | 36 | return m_channel; |
37 | } | 37 | } |
38 | void OPimMainWindow::doSetDocument( const QString& ) { | 38 | void OPimMainWindow::doSetDocument( const QString& ) { |
39 | 39 | ||
40 | } | 40 | } |
41 | void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) { | 41 | void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) { |
42 | bool needShow = false; | 42 | bool needShow = false; |
43 | /* | 43 | /* |
44 | * create demands to create | 44 | * create demands to create |
45 | * a new record... | 45 | * a new record... |
46 | */ | 46 | */ |
47 | QDataStream stream(array, IO_ReadOnly); | 47 | QDataStream stream(array, IO_ReadOnly); |
48 | if ( cmd == "create()" ) { | 48 | if ( cmd == "create()" ) { |