summaryrefslogtreecommitdiff
path: root/libopie2/opiepim
Unidiff
Diffstat (limited to 'libopie2/opiepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/ocontactaccess.cpp8
-rw-r--r--libopie2/opiepim/ui/opimmainwindow.cpp8
-rw-r--r--libopie2/opiepim/ui/opimrecurrencewidget.cpp4
3 files changed, 10 insertions, 10 deletions
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp
index c12e138..4f9b504 100644
--- a/libopie2/opiepim/core/ocontactaccess.cpp
+++ b/libopie2/opiepim/core/ocontactaccess.cpp
@@ -28,102 +28,102 @@
28*/ 28*/
29/* 29/*
30 * ===================================================================== 30 * =====================================================================
31 * ToDo: XML-Backend: Automatic reload if something was changed... 31 * ToDo: XML-Backend: Automatic reload if something was changed...
32 * 32 *
33 * 33 *
34 */ 34 */
35 35
36#include "ocontactaccess.h" 36#include "ocontactaccess.h"
37#include "obackendfactory.h" 37#include "obackendfactory.h"
38 38
39#include <qasciidict.h> 39#include <qasciidict.h>
40#include <qdatetime.h> 40#include <qdatetime.h>
41#include <qfile.h> 41#include <qfile.h>
42#include <qregexp.h> 42#include <qregexp.h>
43#include <qlist.h> 43#include <qlist.h>
44#include <qcopchannel_qws.h> 44#include <qcopchannel_qws.h>
45 45
46//#include <qpe/qcopenvelope_qws.h> 46//#include <qpe/qcopenvelope_qws.h>
47#include <qpe/global.h> 47#include <qpe/global.h>
48 48
49#include <errno.h> 49#include <errno.h>
50#include <fcntl.h> 50#include <fcntl.h>
51#include <unistd.h> 51#include <unistd.h>
52#include <stdlib.h> 52#include <stdlib.h>
53 53
54#include <opie2/ocontactaccessbackend_xml.h> 54#include <opie2/ocontactaccessbackend_xml.h>
55 55
56namespace Opie { 56namespace Opie {
57 57
58OPimContactAccess::OPimContactAccess ( const QString appname, const QString , 58OPimContactAccess::OPimContactAccess ( const QString appname, const QString ,
59 OPimContactAccessBackend* end, bool autosync ): 59 OPimContactAccessBackend* end, bool autosync ):
60 OPimAccessTemplate<OPimContact>( end ) 60 OPimAccessTemplate<OPimContact>( end )
61{ 61{
62 /* take care of the backend. If there is no one defined, we 62 /* take care of the backend. If there is no one defined, we
63 * will use the XML-Backend as default (until we have a cute SQL-Backend..). 63 * will use the XML-Backend as default (until we have a cute SQL-Backend..).
64 */ 64 */
65 if( end == 0 ) { 65 if( end == 0 ) {
66 qWarning ("Using BackendFactory !"); 66 qWarning ("Using BackendFactory !");
67 end = OBackendFactory<OPimContactAccessBackend>::Default( "contact", appname ); 67 end = OBackendFactory<OPimContactAccessBackend>::Default( "contact", appname );
68 } 68 }
69 // Set backend locally and in template 69 // Set backend locally and in template
70 m_backEnd = end; 70 m_backEnd = end;
71 OPimAccessTemplate<OPimContact>::setBackEnd (end); 71 OPimAccessTemplate<OPimContact>::setBackEnd (end);
72 72
73 73
74 /* Connect signal of external db change to function */ 74 /* Connect signal of external db change to function */
75 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); 75 QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this );
76 connect( dbchannel, SIGNAL(received(const QCString &, const QByteArray &)), 76 connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)),
77 this, SLOT(copMessage( const QCString &, const QByteArray &)) ); 77 this, SLOT(copMessage(const QCString&,const QByteArray&)) );
78 if ( autosync ){ 78 if ( autosync ){
79 QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); 79 QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this );
80 connect( syncchannel, SIGNAL(received(const QCString &, const QByteArray &)), 80 connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)),
81 this, SLOT(copMessage( const QCString &, const QByteArray &)) ); 81 this, SLOT(copMessage(const QCString&,const QByteArray&)) );
82 } 82 }
83 83
84 84
85} 85}
86OPimContactAccess::~OPimContactAccess () 86OPimContactAccess::~OPimContactAccess ()
87{ 87{
88 /* The user may forget to save the changed database, therefore try to 88 /* The user may forget to save the changed database, therefore try to
89 * do it for him.. 89 * do it for him..
90 */ 90 */
91 save(); 91 save();
92 // delete m_backEnd; is done by template.. 92 // delete m_backEnd; is done by template..
93} 93}
94 94
95 95
96bool OPimContactAccess::save () 96bool OPimContactAccess::save ()
97{ 97{
98 /* If the database was changed externally, we could not save the 98 /* If the database was changed externally, we could not save the
99 * Data. This will remove added items which is unacceptable ! 99 * Data. This will remove added items which is unacceptable !
100 * Therefore: Reload database and merge the data... 100 * Therefore: Reload database and merge the data...
101 */ 101 */
102 if ( OPimAccessTemplate<OPimContact>::wasChangedExternally() ) 102 if ( OPimAccessTemplate<OPimContact>::wasChangedExternally() )
103 reload(); 103 reload();
104 104
105 bool status = OPimAccessTemplate<OPimContact>::save(); 105 bool status = OPimAccessTemplate<OPimContact>::save();
106 if ( !status ) return false; 106 if ( !status ) return false;
107 107
108 /* Now tell everyone that new data is available. 108 /* Now tell everyone that new data is available.
109 */ 109 */
110 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); 110 QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" );
111 111
112 return true; 112 return true;
113} 113}
114 114
115const uint OPimContactAccess::querySettings() 115const uint OPimContactAccess::querySettings()
116{ 116{
117 return ( m_backEnd->querySettings() ); 117 return ( m_backEnd->querySettings() );
118} 118}
119 119
120bool OPimContactAccess::hasQuerySettings ( int querySettings ) const 120bool OPimContactAccess::hasQuerySettings ( int querySettings ) const
121{ 121{
122 return ( m_backEnd->hasQuerySettings ( querySettings ) ); 122 return ( m_backEnd->hasQuerySettings ( querySettings ) );
123} 123}
124OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const 124OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const
125{ 125{
126 QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat ); 126 QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat );
127 return ( OPimRecordList<OPimContact>(matchingContacts, this) ); 127 return ( OPimRecordList<OPimContact>(matchingContacts, this) );
128} 128}
129 129
diff --git a/libopie2/opiepim/ui/opimmainwindow.cpp b/libopie2/opiepim/ui/opimmainwindow.cpp
index 10ed743..40dc297 100644
--- a/libopie2/opiepim/ui/opimmainwindow.cpp
+++ b/libopie2/opiepim/ui/opimmainwindow.cpp
@@ -2,100 +2,100 @@
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) 3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
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#include <qapplication.h>
30#include <qdatetime.h> 30#include <qdatetime.h>
31#include <qcopchannel_qws.h> 31#include <qcopchannel_qws.h>
32 32
33#include <qpe/sound.h> 33#include <qpe/sound.h>
34#include <qpe/qcopenvelope_qws.h> 34#include <qpe/qcopenvelope_qws.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36 36
37#include <opie2/opimresolver.h> 37#include <opie2/opimresolver.h>
38#include "opimmainwindow.h" 38#include "opimmainwindow.h"
39 39
40namespace Opie { 40namespace Opie {
41OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, 41OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent,
42 const char* name, WFlags flag ) 42 const char* name, WFlags flag )
43 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { 43 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) {
44 44
45 /* 45 /*
46 * let's generate our QCopChannel 46 * let's generate our QCopChannel
47 */ 47 */
48 m_str = QString("QPE/"+m_service).local8Bit(); 48 m_str = QString("QPE/"+m_service).local8Bit();
49 m_channel= new QCopChannel(m_str, this ); 49 m_channel= new QCopChannel(m_str, this );
50 connect(m_channel, SIGNAL(received(const QCString&, const QByteArray& ) ), 50 connect(m_channel, SIGNAL(received(const QCString&,const QByteArray&) ),
51 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 51 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
52 connect(qApp, SIGNAL(appMessage(const QCString&, const QByteArray& ) ), 52 connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&) ),
53 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 53 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
54 54
55 /* connect flush and reload */ 55 /* connect flush and reload */
56 connect(qApp, SIGNAL(flush() ), 56 connect(qApp, SIGNAL(flush() ),
57 this, SLOT(flush() ) ); 57 this, SLOT(flush() ) );
58 connect(qApp, SIGNAL(reload() ), 58 connect(qApp, SIGNAL(reload() ),
59 this, SLOT(reload() ) ); 59 this, SLOT(reload() ) );
60} 60}
61OPimMainWindow::~OPimMainWindow() { 61OPimMainWindow::~OPimMainWindow() {
62 delete m_channel; 62 delete m_channel;
63} 63}
64QCopChannel* OPimMainWindow::channel() { 64QCopChannel* OPimMainWindow::channel() {
65 return m_channel; 65 return m_channel;
66} 66}
67void OPimMainWindow::doSetDocument( const QString& ) { 67void OPimMainWindow::doSetDocument( const QString& ) {
68 68
69} 69}
70void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) { 70void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) {
71 bool needShow = false; 71 bool needShow = false;
72 /* 72 /*
73 * create demands to create 73 * create demands to create
74 * a new record... 74 * a new record...
75 */ 75 */
76 QDataStream stream(array, IO_ReadOnly); 76 QDataStream stream(array, IO_ReadOnly);
77 if ( cmd == "create()" ) { 77 if ( cmd == "create()" ) {
78 raise(); 78 raise();
79 int uid = create(); 79 int uid = create();
80 QCopEnvelope e(m_str, "created(int)" ); 80 QCopEnvelope e(m_str, "created(int)" );
81 e << uid; 81 e << uid;
82 needShow = true; 82 needShow = true;
83 }else if ( cmd == "remove(int)" ) { 83 }else if ( cmd == "remove(int)" ) {
84 int uid; 84 int uid;
85 stream >> uid; 85 stream >> uid;
86 bool rem = remove( uid ); 86 bool rem = remove( uid );
87 QCopEnvelope e(m_str, "removed(bool)" ); 87 QCopEnvelope e(m_str, "removed(bool)" );
88 e << rem; 88 e << rem;
89 needShow = true; 89 needShow = true;
90 }else if ( cmd == "beam(int)" ) { 90 }else if ( cmd == "beam(int)" ) {
91 int uid; 91 int uid;
92 stream >> uid; 92 stream >> uid;
93 beam( uid); 93 beam( uid);
94 }else if ( cmd == "show(int)" ) { 94 }else if ( cmd == "show(int)" ) {
95 raise(); 95 raise();
96 int uid; 96 int uid;
97 stream >> uid; 97 stream >> uid;
98 show( uid ); 98 show( uid );
99 needShow = true; 99 needShow = true;
100 }else if ( cmd == "edit(int)" ) { 100 }else if ( cmd == "edit(int)" ) {
101 raise(); 101 raise();
diff --git a/libopie2/opiepim/ui/opimrecurrencewidget.cpp b/libopie2/opiepim/ui/opimrecurrencewidget.cpp
index 569bdd5..90c1a5f 100644
--- a/libopie2/opiepim/ui/opimrecurrencewidget.cpp
+++ b/libopie2/opiepim/ui/opimrecurrencewidget.cpp
@@ -507,98 +507,98 @@ void OPimRecurrenceWidget::setupWeekly() {
507 // might as well set the day too... 507 // might as well set the day too...
508 if ( startWeekOnMonday ) { 508 if ( startWeekOnMonday ) {
509 fraExtra->setButton( start.dayOfWeek() - 1 ); 509 fraExtra->setButton( start.dayOfWeek() - 1 );
510 } else { 510 } else {
511 fraExtra->setButton( start.dayOfWeek() % 7 ); 511 fraExtra->setButton( start.dayOfWeek() % 7 );
512 } 512 }
513 lblFreq->setText( tr("week(s)") ); 513 lblFreq->setText( tr("week(s)") );
514 lblVar2->show(); 514 lblVar2->show();
515 showRepeatStuff(); 515 showRepeatStuff();
516 setupRepeatLabel( 1 ); 516 setupRepeatLabel( 1 );
517} 517}
518void OPimRecurrenceWidget::setupMonthly() { 518void OPimRecurrenceWidget::setupMonthly() {
519 hideExtras(); 519 hideExtras();
520 lblWeekVar->hide(); 520 lblWeekVar->hide();
521 fraExtra->setTitle( tr("Repeat By") ); 521 fraExtra->setTitle( tr("Repeat By") );
522 fraExtra->setExclusive( TRUE ); 522 fraExtra->setExclusive( TRUE );
523 fraExtra->show(); 523 fraExtra->show();
524 cmdExtra1->setText( tr("Day") ); 524 cmdExtra1->setText( tr("Day") );
525 cmdExtra1->show(); 525 cmdExtra1->show();
526 cmdExtra2->setText( tr("Date") ); 526 cmdExtra2->setText( tr("Date") );
527 cmdExtra2->show(); 527 cmdExtra2->show();
528 spinFreq->setValue( 1 ); 528 spinFreq->setValue( 1 );
529 lblFreq->setText( tr("month(s)") ); 529 lblFreq->setText( tr("month(s)") );
530 lblVar2->show(); 530 lblVar2->show();
531 showRepeatStuff(); 531 showRepeatStuff();
532 setupRepeatLabel( 1 ); 532 setupRepeatLabel( 1 );
533} 533}
534void OPimRecurrenceWidget::setupYearly() { 534void OPimRecurrenceWidget::setupYearly() {
535hideExtras(); 535hideExtras();
536 lblWeekVar->hide(); 536 lblWeekVar->hide();
537 spinFreq->setValue( 1 ); 537 spinFreq->setValue( 1 );
538 lblFreq->setText( tr("year(s)") ); 538 lblFreq->setText( tr("year(s)") );
539 lblFreq->show(); 539 lblFreq->show();
540 lblFreq->show(); 540 lblFreq->show();
541 showRepeatStuff(); 541 showRepeatStuff();
542 lblVar2->show(); 542 lblVar2->show();
543 QString strEvery = strYearTemplate.arg( start.monthName(start.month()) ).arg( numberPlacing(start.day()) ); 543 QString strEvery = strYearTemplate.arg( start.monthName(start.month()) ).arg( numberPlacing(start.day()) );
544 lblRepeat->setText( strEvery ); 544 lblRepeat->setText( strEvery );
545 setupRepeatLabel( 1 ); 545 setupRepeatLabel( 1 );
546 546
547} 547}
548void OPimRecurrenceWidget::init() { 548void OPimRecurrenceWidget::init() {
549 QPopupMenu *m1 = new QPopupMenu( this ); 549 QPopupMenu *m1 = new QPopupMenu( this );
550 repeatPicker = new DateBookMonth( m1, 0, TRUE ); 550 repeatPicker = new DateBookMonth( m1, 0, TRUE );
551 m1->insertItem( repeatPicker ); 551 m1->insertItem( repeatPicker );
552 cmdEnd->setPopup( m1 ); 552 cmdEnd->setPopup( m1 );
553 cmdEnd->setPopupDelay( 0 ); 553 cmdEnd->setPopupDelay( 0 );
554 554
555 QObject::connect( repeatPicker, SIGNAL(dateClicked(int, int, int)), 555 QObject::connect( repeatPicker, SIGNAL(dateClicked(int,int,int)),
556 this, SLOT(endDateChanged(int, int, int)) ); 556 this, SLOT(endDateChanged(int,int,int)) );
557 QObject::connect( qApp, SIGNAL(weekChanged(bool)), 557 QObject::connect( qApp, SIGNAL(weekChanged(bool)),
558 this, SLOT(slotChangeStartOfWeek(bool)) ); 558 this, SLOT(slotChangeStartOfWeek(bool)) );
559 559
560 listRTypeButtons.setAutoDelete( TRUE ); 560 listRTypeButtons.setAutoDelete( TRUE );
561 listRTypeButtons.append( cmdNone ); 561 listRTypeButtons.append( cmdNone );
562 listRTypeButtons.append( cmdDay ); 562 listRTypeButtons.append( cmdDay );
563 listRTypeButtons.append( cmdWeek ); 563 listRTypeButtons.append( cmdWeek );
564 listRTypeButtons.append( cmdMonth ); 564 listRTypeButtons.append( cmdMonth );
565 listRTypeButtons.append( cmdYear ); 565 listRTypeButtons.append( cmdYear );
566 566
567 listExtra.setAutoDelete( TRUE ); 567 listExtra.setAutoDelete( TRUE );
568 listExtra.append( cmdExtra1 ); 568 listExtra.append( cmdExtra1 );
569 listExtra.append( cmdExtra2 ); 569 listExtra.append( cmdExtra2 );
570 listExtra.append( cmdExtra3 ); 570 listExtra.append( cmdExtra3 );
571 listExtra.append( cmdExtra4 ); 571 listExtra.append( cmdExtra4 );
572 listExtra.append( cmdExtra5 ); 572 listExtra.append( cmdExtra5 );
573 listExtra.append( cmdExtra6 ); 573 listExtra.append( cmdExtra6 );
574 listExtra.append( cmdExtra7 ); 574 listExtra.append( cmdExtra7 );
575} 575}
576void OPimRecurrenceWidget::hideExtras() { 576void OPimRecurrenceWidget::hideExtras() {
577 // hide the extra buttons... 577 // hide the extra buttons...
578 fraExtra->hide(); 578 fraExtra->hide();
579 chkNoEnd->hide(); 579 chkNoEnd->hide();
580 QListIterator<QToolButton> it( listExtra ); 580 QListIterator<QToolButton> it( listExtra );
581 for ( ; *it; ++it ) { 581 for ( ; *it; ++it ) {
582 (*it)->hide(); 582 (*it)->hide();
583 (*it)->setOn( FALSE ); 583 (*it)->setOn( FALSE );
584 } 584 }
585} 585}
586void OPimRecurrenceWidget::showRepeatStuff() { 586void OPimRecurrenceWidget::showRepeatStuff() {
587 cmdEnd->show(); 587 cmdEnd->show();
588 chkNoEnd->show(); 588 chkNoEnd->show();
589 lblFreq->show(); 589 lblFreq->show();
590 lblEvery->show(); 590 lblEvery->show();
591 lblFreq->show(); 591 lblFreq->show();
592 spinFreq->show(); 592 spinFreq->show();
593 lblEnd->show(); 593 lblEnd->show();
594 lblRepeat->setText( tr("Every") ); 594 lblRepeat->setText( tr("Every") );
595} 595}
596 596
597 597
598static int week( const QDate &start ) 598static int week( const QDate &start )
599{ 599{
600 // figure out the week... 600 // figure out the week...
601 int stop = start.day(), 601 int stop = start.day(),
602 sentinel = start.dayOfWeek(), 602 sentinel = start.dayOfWeek(),
603 dayOfWeek = QDate( start.year(), start.month(), 1 ).dayOfWeek(), 603 dayOfWeek = QDate( start.year(), start.month(), 1 ).dayOfWeek(),
604 week = 1, 604 week = 1,