summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/libopie.pro33
-rw-r--r--libopie/ofileselector/ofileselector.cpp345
-rw-r--r--libopie/ofileselector/ofileselector.h125
-rw-r--r--libopie/ofileselector/olister.h1
-rw-r--r--libopie/pim/opimrecord.cpp26
-rw-r--r--libopie/pim/opimrecord.h4
-rw-r--r--libopie/pim/otodo.cpp265
-rw-r--r--libopie/pim/otodo.h26
-rw-r--r--libopie2/opiepim/core/opimrecord.cpp26
-rw-r--r--libopie2/opiepim/core/opimrecord.h4
-rw-r--r--libopie2/opiepim/otodo.cpp265
-rw-r--r--libopie2/opiepim/otodo.h26
12 files changed, 443 insertions, 703 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro
index 6c47e86..70be6ac 100644
--- a/libopie/libopie.pro
+++ b/libopie/libopie.pro
@@ -2,4 +2,4 @@ TEMPLATE = lib
2CONFIG += qte warn_on release 2CONFIG += qte warn_on release
3HEADERS = ofontmenu.h ofileselector.h \ 3HEADERS = ofontmenu.h \
4 ofiledialog.h tododb.h \ 4 tododb.h \
5 todoevent.h todoresource.h \ 5 todoevent.h todoresource.h \
@@ -10,5 +10,16 @@ HEADERS = ofontmenu.h ofileselector.h \
10 otimepicker.h otabwidget.h \ 10 otimepicker.h otabwidget.h \
11 otabbar.h otabinfo.h 11 otabbar.h otabinfo.h \
12SOURCES = ofontmenu.cc ofileselector.cc \ 12 ofileselector/ofiledialog.h \
13 ofiledialog.cc xmltree.cc \ 13 ofileselector/ofilelistview.h \
14 ofileselector/ofileselector.h \
15 ofileselector/ofileselectoritem.h \
16 ofileselector/ofileview.h \
17 ofileselector/olister.h \
18 ofileselector/olocallister.h \
19 ofileselector/ofileselectormain.h \
20 pim/opimrecord.h \
21 pim/otodo.h
22
23SOURCES = ofontmenu.cc \
24 xmltree.cc \
14 tododb.cpp todoevent.cpp \ 25 tododb.cpp todoevent.cpp \
@@ -18,3 +29,13 @@ SOURCES = ofontmenu.cc ofileselector.cc \
18 odevice.cpp otimepicker.cpp \ 29 odevice.cpp otimepicker.cpp \
19 otabwidget.cpp otabbar.cpp 30 otabwidget.cpp otabbar.cpp \
31 ofileselector/ofiledialog.cpp \
32 ofileselector/ofilelistview.cpp \
33 ofileselector/ofileselector.cpp \
34 ofileselector/ofileselectoritem.cpp \
35 ofileselector/ofileview.cpp \
36 ofileselector/olister.cpp \
37 ofileselector/olocallister.cpp \
38 ofileselector/ofileselectormain.cpp \
39 pim/opimrecord.cpp \
40 pim/otodo.cpp
20TARGET = opie 41TARGET = opie
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp
index 98b61f7..c52aa62 100644
--- a/libopie/ofileselector/ofileselector.cpp
+++ b/libopie/ofileselector/ofileselector.cpp
@@ -32,3 +32,5 @@
32#include "ofileview.h" 32#include "ofileview.h"
33#include "ofileselectormain.h"
33#include "ofileselector.h" 34#include "ofileselector.h"
35#include "olocallister.h"
34#include "olister.h" 36#include "olister.h"
@@ -103,19 +105,4 @@ void OFileSelector::setNewVisible( bool visible )
103 m_shNew = visible; 105 m_shNew = visible;
104 if( m_selector == Normal ){ 106 if (m_new )
105 delete m_select; 107 m_new->show();
106 // we need to initialize but keep the selected mimetype
107 QString mime = currentMimeType();
108 m_select = new FileSelector( mime ,
109 m_stack, "fileselector",
110 m_shNew, m_shClose);
111
112 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
113 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
114 connect(m_select, SIGNAL(closeMe() ),
115 this, SIGNAL(closeMe() ) );
116 //connect to close me and other signals as well
117 m_stack->addWidget( m_select, Normal );
118 }else{
119 m_new->show();
120 }
121} 108}
@@ -124,7 +111,5 @@ void OFileSelector::setCloseVisible( bool visible )
124 m_shClose = visible; 111 m_shClose = visible;
125 if( m_selector == Normal ){ 112
126 setNewVisible( m_shNew ); // yeah baby 113 if( m_close )
127 }else{
128 m_close->show(); 114 m_close->show();
129 }
130} 115}
@@ -132,7 +117,6 @@ void OFileSelector::reread()
132{ 117{
133 if( m_selector == Normal ){ 118 if( m_selector == Normal )
134 setNewVisible( m_shNew ); // make it a initializeSelector 119 initializeOldSelector();
135 }else { 120 else
136 reparse(); 121 reparse();
137 }
138} 122}
@@ -149,2 +133,3 @@ void OFileSelector::setYesCancelVisible( bool show )
149 m_shYesNo = show; 133 m_shYesNo = show;
134
150 if( m_shYesNo ) 135 if( m_shYesNo )
@@ -158,3 +143,2 @@ void OFileSelector::setToolbarVisible( bool show )
158 m_shTool = show; 143 m_shTool = show;
159 initializeListView(); // FIXME see above waste of memory
160 144
@@ -176,2 +160,3 @@ void OFileSelector::setPermissionBarVisible( bool show )
176 initializePerm(); 160 initializePerm();
161
177 if( m_shPerm ) 162 if( m_shPerm )
@@ -187,5 +172,5 @@ void OFileSelector::setLineEditVisible( bool show )
187 }else{ 172 }else{
188 if( m_shLne && m_boxName != 0 ){ // check if we showed before this is the way to go 173 // check if we showed before this is the way to go
189 m_boxName->hide(); 174 if( m_shLne && m_boxName != 0 )
190 } 175 m_boxName->hide();
191 } 176 }
@@ -198,7 +183,8 @@ void OFileSelector::setChooserVisible( bool show )
198 initializeChooser(); 183 initializeChooser();
199 if( m_shChooser ){ 184
200 m_boxView->hide(); 185 if( m_shChooser )
201 }else{ 186 m_boxView->hide();
202 m_boxView->show(); 187 else
203 } 188 m_boxView->show();
189
204} 190}
@@ -228,6 +214,7 @@ void OFileSelector::setMode(int mode) // FIXME do direct raising
228} 214}
229void OFileSelector::setShowDirs(bool ) 215void OFileSelector::setShowDirs(bool dir)
230{ 216{
231 m_dir = true; 217 m_dir = dir;
232 reparse(); 218 if ( m_selector != Fileselector )
219 reparse();
233} 220}
@@ -236,3 +223,5 @@ void OFileSelector::setCaseSensetive(bool caSe )
236 m_case = caSe; 223 m_case = caSe;
237 reparse(); 224
225 if ( m_selector != Fileselector )
226 reparse();
238} 227}
@@ -382,29 +371,14 @@ void OFileSelector::slotViewCheck(const QString &sel)
382 if( sel == tr("Documents" ) ){ 371 if( sel == tr("Documents" ) ){
383 if( m_select == 0 ){ 372 initializeOldSelector();
384 // autMime? fix cause now we use All and not the current 373 m_selector = Normal;
385 // yes currentMime fixes that for us 374
386 QString mime = currentMimeType();
387 m_select = new FileSelector(mime,
388 m_stack, "fileselector",
389 m_shNew, m_shClose);
390 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
391 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
392 connect(m_select, SIGNAL(closeMe() ),
393 this, SIGNAL(closeMe() ) );
394 //connect to close me and other signals as well
395
396 m_stack->addWidget( m_select, Normal );
397 }
398 m_stack->raiseWidget( Normal );
399 m_selector = Normal;
400 }else if( sel == tr("Files") ){ 375 }else if( sel == tr("Files") ){
401 m_selector = Extended; 376 m_selector = Extended;
402 initializeListView(); 377
403 reparse(); 378 // FIXME call the factory
404 m_stack->raiseWidget( Extended ); 379 //reparse();
405 }else if( sel == tr("All Files") ){ 380 }else if( sel == tr("All Files") ){
406 m_selector = ExtendedAll; 381 m_selector = ExtendedAll;
407 initializeListView(); 382/* see above
408 reparse(); 383 reparse(); */
409 m_stack->raiseWidget( Extended ); // same widget other QFileFilter
410 } 384 }
@@ -415,5 +389,6 @@ QString OFileSelector::currentMimeType() const{
415 QString currentText; 389 QString currentText;
416 if (m_shChooser ) 390 if (m_shChooser && m_mimeCheck )
417 currentText = m_mimeCheck->currentText(); 391 currentText = m_mimeCheck->currentText();
418 392
393 qWarning("CurrentText" + currentText );
419 if (tr("All") == currentText ) return QString::null; 394 if (tr("All") == currentText ) return QString::null;
@@ -424,3 +399,3 @@ QString OFileSelector::currentMimeType() const{
424 it = m_mimetypes.find( currentText ); 399 it = m_mimetypes.find( currentText );
425 if ( it == m_mimetypes.end() ) { 400 if ( it != m_mimetypes.end() ) {
426 mime = it.data().join(";"); 401 mime = it.data().join(";");
@@ -435,25 +410,4 @@ void OFileSelector::slotMimeCheck(const QString &mime)
435 if( m_selector == Normal ){ 410 if( m_selector == Normal ){
436 //if( m_autoMime ){ 411 initializeOldSelector();
437 QString newMimeType; 412
438 if (mime != tr("All") ) {
439 QMap<QString, QStringList>::Iterator it;
440 it = m_mimetypes.find(mime);
441 if ( it != m_mimetypes.end() ) {
442 newMimeType = it.data().join(";");
443 }else{
444 newMimeType = mime;
445 }
446 }
447 delete m_select;
448 m_select = new FileSelector( newMimeType,
449 m_stack, "fileselector",
450 m_shNew, m_shClose);
451
452 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
453 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
454 connect(m_select, SIGNAL(closeMe() ),
455 this, SIGNAL(closeMe() ) );
456 //connect to close me and other signals as well
457 m_stack->addWidget( m_select, Normal );
458 m_stack->raiseWidget( Normal );
459 updateMimes(); 413 updateMimes();
@@ -461,3 +415,2 @@ void OFileSelector::slotMimeCheck(const QString &mime)
461 m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); 415 m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
462 //}
463 }else{ // others 416 }else{ // others
@@ -526,3 +479,7 @@ void OFileSelector::init()
526 479
527 m_stack = new QWidgetStack( this ); 480 /* take care of the main view... */
481 initToolbar();
482
483 /* initialize the file lister */
484 initLister();
528 if( m_selector == Normal ){ 485 if( m_selector == Normal ){
@@ -536,21 +493,6 @@ void OFileSelector::init()
536 } 493 }
537 m_select = new FileSelector(mime, 494 initializeOldSelector();
538 m_stack, "fileselector", 495 }else{
539 m_shNew, m_shClose); 496 initializeView();
540
541 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
542 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
543 connect(m_select, SIGNAL(closeMe() ),
544 this, SIGNAL( closeMe() ) );
545 //connect to close me and other signals as well
546
547 m_stack->addWidget( m_select, Normal );
548 m_stack->raiseWidget( Normal );
549 }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL
550 // and initializeListview will take care of those
551 // toolbar get's generade in initializeListView
552 initializeListView( ); // will raise the widget as well
553 m_stack->raiseWidget( Extended );
554 } 497 }
555 m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch
556 498
@@ -605,2 +547,5 @@ void OFileSelector::initVars()
605 m_showPopup = false; 547 m_showPopup = false;
548 m_mainView = 0l;
549 m_fileView = 0l;
550 m_lister = 0l;
606 551
@@ -625,3 +570,2 @@ void OFileSelector::initVars()
625 m_select = 0; 570 m_select = 0;
626 m_stack = 0;
627 m_lay = 0; 571 m_lay = 0;
@@ -632,3 +576,2 @@ void OFileSelector::initVars()
632 m_boxView = 0; 576 m_boxView = 0;
633 m_custom = 0;
634 m_edit = 0; 577 m_edit = 0;
@@ -716,2 +659,3 @@ void OFileSelector::initializeChooser()
716 /* update to custom views */ 659 /* update to custom views */
660
717 updateMimeCheck(); 661 updateMimeCheck();
@@ -724,57 +668,82 @@ void OFileSelector::initializeChooser()
724} 668}
725void OFileSelector::initializeListView() 669/* generate the buttons for the toolbar */
726{ 670void OFileSelector::initToolbar() {
727 qWarning("initializeListView"); 671 m_mainView = new OFileSelectorMain( this );
728 if( m_pseudo == 0 ){ 672
729 qWarning("init"); 673 /* now generate the tool bar */
730 m_pseudo = new QWidget( m_stack, "Pseudo Widget"); 674 qWarning( "toolbar" );
675 m_pseudo = new QWidget( m_mainView, "Pseudo Widget" );
731 m_pseudoLayout = new QVBoxLayout( m_pseudo ); 676 m_pseudoLayout = new QVBoxLayout( m_pseudo );
732 // toolbar 677
733 m_boxToolbar = new QHBox( m_pseudo ); 678 m_boxToolbar = new QHBox( m_pseudo );
734 m_boxToolbar->setSpacing(0 ); // next to each other please 679 m_boxToolbar->setSpacing( 0 );
735 680
736 // toolbar members 681 // tool bar members now
737 { 682 m_location = new QComboBox( m_boxToolbar );
738 // location QComboBox 683 m_location->setEditable( TRUE );
739 m_location = new QComboBox( m_boxToolbar ); 684 m_location->setDuplicatesEnabled( FALSE );
740 m_location->setEditable( TRUE ); 685 connect( m_location, SIGNAL(activated(const QString& ) ),
741 m_location->setDuplicatesEnabled( FALSE ); 686 this, SLOT(slotLocationActivated(const QString& )) );
742 connect( m_location, SIGNAL(activated(const QString &) ), 687 connect( m_location->lineEdit(), SIGNAL(returnPressed() ) ,
743 this, SLOT( slotLocationActivated(const QString &) ) ); 688 this, SLOT(locationComboChanged() ) );
744 connect( m_location->lineEdit(), SIGNAL(returnPressed() ), 689
745 this, SLOT(locationComboChanged() ) ); 690 // UP Button
746 // UP Button 691 m_up = new QPushButton( Resource::loadIconSet("up"), QString::null,
747 m_up = new QPushButton(Resource::loadIconSet("up"),"", 692 m_boxToolbar, "cdUpButton" );
748 m_boxToolbar,"cdUpButton"); 693 m_up->setFixedSize( QSize(20, 20 ) );
749 m_up->setFixedSize( QSize( 20, 20 ) ); 694 connect( m_up, SIGNAL( clicked() ), this, SLOT(cdUP() ) );
750 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); 695 m_up->setFlat( TRUE );
751 m_up->setFlat(TRUE); 696
752 697 // Home Button
753 // Home Button 698 m_homeButton = new QPushButton(Resource::loadIconSet("home"),
754 m_homeButton = new QPushButton(Resource::loadIconSet("home") , 699 QString::null, m_boxToolbar );
755 "", m_boxToolbar); 700 m_homeButton->setFixedSize( QSize(20, 20 ) );
756 m_homeButton->setFixedSize( QSize( 20, 20 ) ); 701 connect(m_homeButton, SIGNAL(clicked() ), this, SLOT(slotHome() ) );
757 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); 702 m_homeButton->setFlat( TRUE );
758 m_homeButton->setFlat(TRUE); 703
759 // Documents Button 704 // Documents Button
760 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", 705 m_docButton = new QPushButton( Resource::loadIconSet("DocsIcon"),
761 m_boxToolbar,"docsButton"); 706 QString::null, m_boxToolbar,
762 m_docButton->setFixedSize( QSize( 20, 20 ) ); 707 "docsButton" );
763 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); 708 m_docButton->setFixedSize( QSize(20, 20 ) );
764 m_docButton->setFlat(TRUE); 709 m_docButton->setFlat( true );
765 710 connect( m_docButton, SIGNAL(clicked() ),
766 // Close button 711 this, SLOT(slotDoc() ) );
767 m_close = new QPushButton( Resource::loadIconSet( "close"), "", 712
768 m_boxToolbar ); 713 // close button
769 connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); 714 m_close = new QPushButton( Resource::loadIconSet( "close"), "",
770 m_close->setFixedSize( 20, 20 ); 715 m_boxToolbar );
771 716 connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) );
772 m_boxToolbar->setFixedHeight( 20 ); 717 m_close->setFixedSize( 20, 20 );
773 m_pseudoLayout->addWidget(m_boxToolbar ); 718
774 719 m_boxToolbar->setFixedHeight( 20 );
775 // let;s fill the Location ComboBox 720 m_pseudoLayout->addWidget(m_boxToolbar );
776 StorageInfo storage; 721
777 const QList<FileSystem> &fs = storage.fileSystems(); 722 /* init the locations */
778 QListIterator<FileSystem> it ( fs ); 723 initLocations();
779 for( ; it.current(); ++it ){ 724
725 if( !m_shTool ){
726 m_location->hide( );
727 m_up->hide( );
728 m_homeButton->hide( );
729 m_docButton->hide( );
730 }
731 if(!m_shClose )
732 m_close->hide();
733
734 m_mainView->setToolbar( m_pseudo );
735 m_lay->addWidget( m_mainView, 100 );
736}
737/* initialize the OLocalLister */
738void OFileSelector::initLister() {
739 m_lister = new OLocalLister(this);
740}
741/* put default locations into the bar */
742void OFileSelector::initLocations () {
743
744 // let;s fill the Location ComboBox
745 StorageInfo storage;
746 const QList<FileSystem> &fs = storage.fileSystems();
747 QListIterator<FileSystem> it ( fs );
748 for( ; it.current(); ++it ){
780 const QString disk = (*it)->name(); 749 const QString disk = (*it)->name();
@@ -782,25 +751,7 @@ void OFileSelector::initializeListView()
782 m_location->insertItem(path+ "<-"+disk ); 751 m_location->insertItem(path+ "<-"+disk );
783 } 752 }
784 int count = m_location->count(); 753 int count = m_location->count();
785 m_location->insertItem( m_currentDir ); 754 m_location->insertItem( m_currentDir );
786 m_location->setCurrentItem( count ); 755 m_location->setCurrentItem( count );
787 // due to the New and Close button we can not simply hide m_boxToolBar to not show it
788 if( !m_shTool ){
789 m_location->hide( );
790 m_up->hide( );
791 m_homeButton->hide( );
792 m_docButton->hide( );
793 }
794 if(!m_shClose )
795 m_close->hide();
796 //if(!m_shNew)
797 //m_close->hide();
798
799 } // off toolbar
800 // the Main ListView
801 // make a QWidgetStack first so Views can share the Toolbar
802 756
803 // m_pseudoLayout->addWidget( m_View, 288 );
804 m_stack->addWidget( m_pseudo, Extended );
805 }
806} 757}
@@ -1004,6 +955,6 @@ void OFileSelector::reparse()
1004OFileView* OFileSelector::currentView() { 955OFileView* OFileSelector::currentView() {
1005 return 0l; 956 return m_fileView;
1006} 957}
1007OFileView* OFileSelector::currentView() const{ 958OFileView* OFileSelector::currentView() const{
1008 return 0l; 959 return m_fileView;
1009} 960}
@@ -1049,3 +1000,23 @@ QPixmap OFileSelector::pixmap( const QString& s ) {
1049OLister* OFileSelector::currentLister()const { 1000OLister* OFileSelector::currentLister()const {
1050 return 0l; 1001 return m_lister;
1002}
1003void OFileSelector::initializeOldSelector() {
1004 qWarning("initializeOldSelector");
1005
1006 delete m_select;
1007
1008 // we need to initialize but keep the selected mimetype
1009 /* we default not to show close and new buttons */
1010 QString mime = currentMimeType();
1011 qWarning("MimeType " + mime );
1012 m_select = new FileSelector( mime ,
1013 m_mainView, "fileselector",
1014 FALSE, FALSE);
1015
1016 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
1017 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
1018 connect(m_select, SIGNAL(closeMe() ),
1019 this, SIGNAL(closeMe() ) );
1020 //connect to close me and other signals as well
1021 m_mainView->setWidget( m_select );
1051} 1022}
diff --git a/libopie/ofileselector/ofileselector.h b/libopie/ofileselector/ofileselector.h
index a7b363f..bf9a26b 100644
--- a/libopie/ofileselector/ofileselector.h
+++ b/libopie/ofileselector/ofileselector.h
@@ -71,2 +71,3 @@ class OFileView;
71class OLister; 71class OLister;
72class OFileSelectorMain;
72// 73//
@@ -110,3 +111,3 @@ class OFileSelector : public QWidget {
110 */ 111 */
111 enum Selector{Normal=0, Extended = 1, ExtendedAll =2 }; 112 enum Selector{Normal=0, Extended = 1, ExtendedAll = 2};
112 113
@@ -344,2 +345,4 @@ class OFileSelector : public QWidget {
344 QPixmap pixmap( const QString& ); 345 QPixmap pixmap( const QString& );
346 /* our tool bar */
347 QWidget* toolBar();
345 348
@@ -371,2 +374,5 @@ class OFileSelector : public QWidget {
371 374
375 OFileSelectorMain* m_mainView;
376 OLister* m_lister;
377 OFileView* m_fileView;
372 FileSelector* m_select; 378 FileSelector* m_select;
@@ -392,45 +398,43 @@ class OFileSelector : public QWidget {
392 QString m_name; 398 QString m_name;
393 QMap<QString, QStringList> m_mimetypes; 399
394 400 QMap<QString, QStringList> m_mimetypes;
395 401
396 QWidgetStack *m_stack; 402 QVBoxLayout *m_lay;
397 QVBoxLayout *m_lay; 403 QGridLayout *m_Oselector;
398 QGridLayout *m_Oselector; 404
399 405 QHBox *m_boxToolbar;
400 QHBox *m_boxToolbar; 406 QHBox *m_boxOk;
401 QHBox *m_boxOk; 407 QHBox *m_boxName;
402 QHBox *m_boxName; 408 QHBox *m_boxView;
403 QHBox *m_boxView; 409
404 410
405 QPopupMenu *m_custom; 411 QLineEdit *m_edit;
406 412 QLabel *m_fnLabel;
407 QLineEdit *m_edit; 413
408 QLabel *m_fnLabel; 414 bool m_shClose : 1;
409 415 bool m_shNew : 1;
410 bool m_shClose : 1; 416 bool m_shTool : 1;
411 bool m_shNew : 1; 417 bool m_shPerm : 1;
412 bool m_shTool : 1; 418 bool m_shLne : 1;
413 bool m_shPerm : 1; 419 bool m_shChooser : 1;
414 bool m_shLne : 1; 420 bool m_shYesNo : 1;
415 bool m_shChooser : 1; 421 bool m_boCheckPerm : 1;
416 bool m_shYesNo : 1; 422 bool m_autoMime : 1;
417 bool m_boCheckPerm : 1; 423 bool m_case : 1;
418 bool m_autoMime : 1; 424 bool m_dir : 1;
419 bool m_case : 1; 425 bool m_files : 1;
420 bool m_dir : 1; 426 bool m_showPopup : 1;
421 bool m_files : 1; 427 bool m_showHidden : 1;
422 bool m_showPopup : 1; 428
423 429 void initVars();
424 void initVars(); 430
425 431 void delItems();
426 void delItems(); 432 void initializeName();
427 void initializeName(); 433 void initializeYes();
428 void initializeYes(); 434 void initializeChooser();
429 void initializeChooser(); 435 void initializePerm();
430 void initializeListView(); 436 void initPics();
431 void initializePerm(); 437 bool compliesMime(const QString &path,
432 void initPics(); 438 const QString &mime);
433 bool compliesMime(const QString &path, 439 bool compliesMime(const QString& mime );
434 const QString &mime);
435 bool compliesMime(const QString& mime );
436 /** 440 /**
@@ -438,4 +442,9 @@ class OFileSelector : public QWidget {
438 */ 442 */
439 void updateMimeCheck(); 443 void updateMimeCheck();
440 444
445 void initializeOldSelector();
446 void initLister();
447 void initToolbar();
448 void initLocations();
449 void initializeView() {}; // FIXME
441 /** 450 /**
@@ -443,17 +452,17 @@ class OFileSelector : public QWidget {
443 */ 452 */
444 QString currentMimeType()const; 453 QString currentMimeType()const;
445 class OFileSelectorPrivate; 454 class OFileSelectorPrivate;
446 OFileSelectorPrivate *d; 455 OFileSelectorPrivate *d;
447 static QMap<QString,QPixmap> *m_pixmaps; 456 static QMap<QString,QPixmap> *m_pixmaps;
448 457
449private slots: 458private slots:
450 void slotFileSelected(const QString & ); // not really meant to be a slot 459 void slotFileSelected(const QString & ); // not really meant to be a slot
451 void slotFileBridgeSelected( const DocLnk & ); 460 void slotFileBridgeSelected( const DocLnk & );
452 // listview above 461 // listview above
453 // popup below 462 // popup below
454 virtual void slotDelete(); 463 virtual void slotDelete();
455 virtual void cdUP(); 464 virtual void cdUP();
456 virtual void slotHome(); 465 virtual void slotHome();
457 virtual void slotDoc(); 466 virtual void slotDoc();
458 virtual void slotNavigate( ); 467 virtual void slotNavigate( );
459 468
diff --git a/libopie/ofileselector/olister.h b/libopie/ofileselector/olister.h
index 081b876..ef61cab 100644
--- a/libopie/ofileselector/olister.h
+++ b/libopie/ofileselector/olister.h
@@ -6,2 +6,3 @@
6#include <qstring.h> 6#include <qstring.h>
7#include <qstringlist.h>
7 8
diff --git a/libopie/pim/opimrecord.cpp b/libopie/pim/opimrecord.cpp
index 95de1df..d8f73c7 100644
--- a/libopie/pim/opimrecord.cpp
+++ b/libopie/pim/opimrecord.cpp
@@ -4,3 +4,5 @@ OPimRecord::OPimRecord( int uid )
4 : Qtopia::Record() { 4 : Qtopia::Record() {
5
5 setUid( uid ); 6 setUid( uid );
7 /* assign a new UID */
6 if ( uid == 1 ) 8 if ( uid == 1 )
@@ -10,3 +12,3 @@ OPimRecord::~OPimRecord() {
10} 12}
11OPimRecord::OPimRecord( OPimRecord& rec ) 13OPimRecord::OPimRecord( const OPimRecord& rec )
12 : Qtopia::Record( rec ) 14 : Qtopia::Record( rec )
@@ -17,5 +19,5 @@ OPimRecord::OPimRecord( OPimRecord& rec )
17OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { 19OPimRecord &OPimRecord::operator=( const OPimRecord& rec) {
18 /* how do I call the parent copy operator ? */ 20 Qtopia::Record::operator=( rec );
19 setUid( rec.uid() ); 21 m_relations = rec.m_relations;
20 setCategories( rec.categories() ); 22
21 return *this; 23 return *this;
@@ -27,3 +29,3 @@ QStringList OPimRecord::categoryNames()const {
27} 29}
28void OPimRecord::setCategoryName( const QStringList& ) { 30void OPimRecord::setCategoryNames( const QStringList& ) {
29 31
@@ -90 +92,15 @@ void OPimRecord::setRelations( const QString& app, QArray<int> ids ) {
90} 92}
93QString OPimRecord::crossToString()const {
94 QString str;
95 QMap<QString, QArray<int> >::ConstIterator it;
96 for (it = m_relations.begin(); it != m_relations.end(); ++it ) {
97 QArray<int> id = it.data();
98 for ( uint i = 0; i < id.size(); ++i ) {
99 str += it.key() + "," + QString::number( i ) + ";";
100 }
101 }
102 str = str.remove( str.length()-1, 1); // strip the ;
103 //qWarning("IDS " + str );
104
105 return str;
106}
diff --git a/libopie/pim/opimrecord.h b/libopie/pim/opimrecord.h
index a0e0413..18112d4 100644
--- a/libopie/pim/opimrecord.h
+++ b/libopie/pim/opimrecord.h
@@ -21,3 +21,3 @@ public:
21 */ 21 */
22 OPimRecord( OPimRecord& rec ); 22 OPimRecord( const OPimRecord& rec );
23 23
@@ -36,3 +36,3 @@ public:
36 */ 36 */
37 void setCategoryName( const QStringList& ); 37 void setCategoryNames( const QStringList& );
38 38
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp
index d8e0447..3c93838 100644
--- a/libopie/pim/otodo.cpp
+++ b/libopie/pim/otodo.cpp
@@ -13,10 +13,9 @@
13 13
14#include "todoevent.h"
15 14
16using namespace Opie;
17 15
18Qtopia::UidGen ToDoEvent::m_gen; 16#include "otodo.h"
19 17
20struct ToDoEvent::ToDoEventData : public QShared { 18
21 ToDoEventData() : QShared() { 19struct OTodo::OTodoData : public QShared {
20 OTodoData() : QShared() {
22 }; 21 };
@@ -31,4 +30,2 @@ struct ToDoEvent::ToDoEventData : public QShared {
31 QMap<QString, QString> extra; 30 QMap<QString, QString> extra;
32 QMap<QString, QArray<int> > relations;
33 int uid;
34 ushort prog; 31 ushort prog;
@@ -38,4 +35,4 @@ struct ToDoEvent::ToDoEventData : public QShared {
38 35
39ToDoEvent::ToDoEvent(const ToDoEvent &event ) 36OTodo::OTodo(const OTodo &event )
40 : data( event.data ) 37 : OPimRecord( event ), data( event.data )
41{ 38{
@@ -44,5 +41,5 @@ ToDoEvent::ToDoEvent(const ToDoEvent &event )
44} 41}
45ToDoEvent::~ToDoEvent() { 42OTodo::~OTodo() {
46 if ( data->deref() ) { 43 if ( data->deref() ) {
47 //qWarning("ToDoEvent::dereffing"); 44 //qWarning("OTodo::dereffing");
48 delete data; 45 delete data;
@@ -52,3 +49,3 @@ ToDoEvent::~ToDoEvent() {
52 49
53ToDoEvent::ToDoEvent(bool completed, int priority, 50OTodo::OTodo(bool completed, int priority,
54 const QStringList &category, 51 const QStringList &category,
@@ -58,5 +55,7 @@ ToDoEvent::ToDoEvent(bool completed, int priority,
58 bool hasDate, QDate date, int uid ) 55 bool hasDate, QDate date, int uid )
56 : OPimRecord( uid )
59{ 57{
60 //qWarning("ToDoEventData"); 58 //qWarning("OTodoData");
61 data = new ToDoEventData; 59 setCategories( idsFromString( category.join(";") ) );
60 data = new OTodoData;
62 data->date = date; 61 data->date = date;
@@ -65,3 +64,2 @@ ToDoEvent::ToDoEvent(bool completed, int priority,
65 data->priority = priority; 64 data->priority = priority;
66 data->category = category;
67 data->sum = summary; 65 data->sum = summary;
@@ -69,9 +67,2 @@ ToDoEvent::ToDoEvent(bool completed, int priority,
69 data->desc = Qtopia::simplifyMultiLineSpace(description ); 67 data->desc = Qtopia::simplifyMultiLineSpace(description );
70 if (uid == -1 ) {
71 uid = m_gen.generate();
72
73 }// generated the ids
74 m_gen.store( uid );
75
76 data->uid = uid;
77 data->hasAlarmDateTime = false; 68 data->hasAlarmDateTime = false;
@@ -79,10 +70,3 @@ ToDoEvent::ToDoEvent(bool completed, int priority,
79} 70}
80QArray<int> ToDoEvent::categories()const 71bool OTodo::match( const QRegExp &regExp )const
81{
82 qWarning( "ToDoEvent:cats" + data->category.join(";") );
83 QArray<int> array(data->category.count() ); // currently the datebook can be only in one category
84 array = Qtopia::Record::idsFromString( data->category.join(";") );
85 return array;
86}
87bool ToDoEvent::match( const QRegExp &regExp )const
88{ 72{
@@ -94,2 +78,4 @@ bool ToDoEvent::match( const QRegExp &regExp )const
94 return true; 78 return true;
79 }else if(data->sum.find( regExp ) != -1 ) {
80 return true;
95 } 81 }
@@ -97,3 +83,3 @@ bool ToDoEvent::match( const QRegExp &regExp )const
97} 83}
98bool ToDoEvent::isCompleted() const 84bool OTodo::isCompleted() const
99{ 85{
@@ -101,3 +87,3 @@ bool ToDoEvent::isCompleted() const
101} 87}
102bool ToDoEvent::hasDueDate() const 88bool OTodo::hasDueDate() const
103{ 89{
@@ -105,3 +91,3 @@ bool ToDoEvent::hasDueDate() const
105} 91}
106bool ToDoEvent::hasAlarmDateTime() const 92bool OTodo::hasAlarmDateTime() const
107{ 93{
@@ -109,3 +95,3 @@ bool ToDoEvent::hasAlarmDateTime() const
109} 95}
110int ToDoEvent::priority()const 96int OTodo::priority()const
111{ 97{
@@ -113,11 +99,3 @@ int ToDoEvent::priority()const
113} 99}
114QStringList ToDoEvent::allCategories()const 100QString OTodo::summary() const
115{
116 return data->category;
117}
118QString ToDoEvent::extra(const QString& )const
119{
120 return QString::null;
121}
122QString ToDoEvent::summary() const
123{ 101{
@@ -125,3 +103,3 @@ QString ToDoEvent::summary() const
125} 103}
126ushort ToDoEvent::progress() const 104ushort OTodo::progress() const
127{ 105{
@@ -129,38 +107,3 @@ ushort ToDoEvent::progress() const
129} 107}
130QStringList ToDoEvent::relatedApps() const 108QDate OTodo::dueDate()const
131{
132 QStringList list;
133 QMap<QString, QArray<int> >::ConstIterator it;
134 for ( it = data->relations.begin(); it != data->relations.end(); ++it ) {
135 list << it.key();
136 }
137 return list;
138}
139QArray<int> ToDoEvent::relations( const QString& app)const
140{
141 QArray<int> tmp;
142 QMap<QString, QArray<int> >::ConstIterator it;
143 it = data->relations.find( app);
144 if ( it != data->relations.end() )
145 tmp = it.data();
146 return tmp;
147}
148void ToDoEvent::insertCategory(const QString &str )
149{
150 changeOrModify();
151 qWarning("insert category;" + str );
152 data->category.append( str );
153}
154void ToDoEvent::clearCategories()
155{
156 changeOrModify();
157 data->category.clear();
158}
159void ToDoEvent::setCategories(const QStringList &list )
160{
161 changeOrModify();
162 qWarning("set categories" + list.join(";") );
163 data->category = list;
164}
165QDate ToDoEvent::dueDate()const
166{ 109{
@@ -169,3 +112,3 @@ QDate ToDoEvent::dueDate()const
169 112
170QDateTime ToDoEvent::alarmDateTime() const 113QDateTime OTodo::alarmDateTime() const
171{ 114{
@@ -174,3 +117,3 @@ QDateTime ToDoEvent::alarmDateTime() const
174 117
175QString ToDoEvent::description()const 118QString OTodo::description()const
176{ 119{
@@ -178,3 +121,3 @@ QString ToDoEvent::description()const
178} 121}
179void ToDoEvent::setCompleted( bool completed ) 122void OTodo::setCompleted( bool completed )
180{ 123{
@@ -183,3 +126,3 @@ void ToDoEvent::setCompleted( bool completed )
183} 126}
184void ToDoEvent::setHasDueDate( bool hasDate ) 127void OTodo::setHasDueDate( bool hasDate )
185{ 128{
@@ -188,3 +131,3 @@ void ToDoEvent::setHasDueDate( bool hasDate )
188} 131}
189void ToDoEvent::setHasAlarmDateTime( bool hasAlarmDateTime ) 132void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime )
190{ 133{
@@ -193,3 +136,3 @@ void ToDoEvent::setHasAlarmDateTime( bool hasAlarmDateTime )
193} 136}
194void ToDoEvent::setDescription(const QString &desc ) 137void OTodo::setDescription(const QString &desc )
195{ 138{
@@ -198,7 +141,3 @@ void ToDoEvent::setDescription(const QString &desc )
198} 141}
199void ToDoEvent::setExtra( const QString&, const QString& ) 142void OTodo::setSummary( const QString& sum )
200{
201
202}
203void ToDoEvent::setSummary( const QString& sum )
204{ 143{
@@ -207,10 +146,3 @@ void ToDoEvent::setSummary( const QString& sum )
207} 146}
208void ToDoEvent::setCategory( const QString &cat ) 147void OTodo::setPriority(int prio )
209{
210 changeOrModify();
211 //qWarning("setCategory %s", cat.latin1() );
212 data->category.clear();
213 data->category << cat;
214}
215void ToDoEvent::setPriority(int prio )
216{ 148{
@@ -219,3 +151,3 @@ void ToDoEvent::setPriority(int prio )
219} 151}
220void ToDoEvent::setDueDate( QDate date ) 152void OTodo::setDueDate( QDate date )
221{ 153{
@@ -224,3 +156,3 @@ void ToDoEvent::setDueDate( QDate date )
224} 156}
225void ToDoEvent::setAlarmDateTime( const QDateTime& alarm ) 157void OTodo::setAlarmDateTime( const QDateTime& alarm )
226{ 158{
@@ -229,47 +161,3 @@ void ToDoEvent::setAlarmDateTime( const QDateTime& alarm )
229} 161}
230void ToDoEvent::addRelated( const QString &app, int id ) 162bool OTodo::isOverdue( )
231{
232 changeOrModify();
233
234 QMap<QString, QArray<int> >::Iterator it;
235 QArray<int> tmp;
236 it = data->relations.find( app );
237 if ( it == data->relations.end() ) {
238 tmp.resize(1 );
239 tmp[0] = id;
240 }else{
241 tmp = it.data();
242 tmp.resize( tmp.size() + 1 );
243 tmp[tmp.size() - 1] = id;
244 }
245 data->relations.replace( app, tmp );
246}
247void ToDoEvent::addRelated(const QString& app, QArray<int> ids )
248{
249 changeOrModify();
250
251 QMap<QString, QArray<int> >::Iterator it;
252 QArray<int> tmp;
253 it = data->relations.find( app);
254 if ( it == data->relations.end() ) { // not there
255 /** tmp.resize( ids.size() ); stupid??
256 */
257 tmp = ids;
258 }else{
259 tmp = it.data();
260 int offset = tmp.size()-1;
261 tmp.resize( tmp.size() + ids.size() );
262 for (uint i = 0; i < ids.size(); i++ ) {
263 tmp[offset+i] = ids[i];
264 }
265
266 }
267 data->relations.replace( app, tmp );
268}
269void ToDoEvent::clearRelated( const QString& app )
270{
271 changeOrModify();
272 data->relations.remove( app );
273}
274bool ToDoEvent::isOverdue( )
275{ 163{
@@ -279,3 +167,3 @@ bool ToDoEvent::isOverdue( )
279} 167}
280void ToDoEvent::setProgress(ushort progress ) 168void OTodo::setProgress(ushort progress )
281{ 169{
@@ -284,2 +172,5 @@ void ToDoEvent::setProgress(ushort progress )
284} 172}
173QString OTodo::toShortText() const {
174 return summary();
175}
285/*! 176/*!
@@ -287,3 +178,3 @@ void ToDoEvent::setProgress(ushort progress )
287*/ 178*/
288QString ToDoEvent::richText() const 179QString OTodo::toRichText() const
289{ 180{
@@ -318,20 +209,6 @@ QString ToDoEvent::richText() const
318 209
319 // Open database of all categories and get the list of
320 // the categories this todoevent belongs to.
321 // Then print them...
322 // I am not sure whether there is no better way doing this !?
323 Categories catdb;
324 bool firstloop = true;
325 catdb.load( categoryFileName() );
326 catlist = allCategories();
327
328 text += "<b>" + QObject::tr( "Category:") + "</b> "; 210 text += "<b>" + QObject::tr( "Category:") + "</b> ";
329 for ( QStringList::Iterator it = catlist.begin(); it != catlist.end(); ++it ) { 211 text += categoryNames().join(", ");
330 if (!firstloop){
331 text += ", ";
332 }
333 firstloop = false;
334 text += catdb.label ("todo", (*it).toInt());
335 }
336 text += "<br>"; 212 text += "<br>";
213
337 return text; 214 return text;
@@ -339,3 +216,3 @@ QString ToDoEvent::richText() const
339 216
340bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{ 217bool OTodo::operator<( const OTodo &toDoEvent )const{
341 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; 218 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
@@ -351,3 +228,3 @@ bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{
351} 228}
352bool ToDoEvent::operator<=(const ToDoEvent &toDoEvent )const 229bool OTodo::operator<=(const OTodo &toDoEvent )const
353{ 230{
@@ -364,3 +241,3 @@ bool ToDoEvent::operator<=(const ToDoEvent &toDoEvent )const
364} 241}
365bool ToDoEvent::operator>(const ToDoEvent &toDoEvent )const 242bool OTodo::operator>(const OTodo &toDoEvent )const
366{ 243{
@@ -377,3 +254,3 @@ bool ToDoEvent::operator>(const ToDoEvent &toDoEvent )const
377} 254}
378bool ToDoEvent::operator>=(const ToDoEvent &toDoEvent )const 255bool OTodo::operator>=(const OTodo &toDoEvent )const
379{ 256{
@@ -390,3 +267,3 @@ bool ToDoEvent::operator>=(const ToDoEvent &toDoEvent )const
390} 267}
391bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const 268bool OTodo::operator==(const OTodo &toDoEvent )const
392{ 269{
@@ -406,3 +283,3 @@ bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const
406} 283}
407void ToDoEvent::deref() { 284void OTodo::deref() {
408 285
@@ -415,4 +292,5 @@ void ToDoEvent::deref() {
415} 292}
416ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item ) 293OTodo &OTodo::operator=(const OTodo &item )
417{ 294{
295 OPimRecord::operator=( item );
418 //qWarning("operator= ref "); 296 //qWarning("operator= ref ");
@@ -421,5 +299,2 @@ ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item )
421 299
422 data = item.data;
423
424
425 return *this; 300 return *this;
@@ -427,7 +302,7 @@ ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item )
427 302
428QMap<int, QString> ToDoEvent::toMap() const { 303QMap<int, QString> OTodo::toMap() const {
429 QMap<int, QString> map; 304 QMap<int, QString> map;
430 305
431 map.insert( Uid, QString::number( data->uid ) ); 306 map.insert( Uid, QString::number( uid() ) );
432 map.insert( Category, data->category.join(";") ); 307 map.insert( Category, idsToString( categories() ) );
433 map.insert( HasDate, QString::number( data->hasDate ) ); 308 map.insert( HasDate, QString::number( data->hasDate ) );
@@ -448,28 +323,3 @@ QMap<int, QString> ToDoEvent::toMap() const {
448 323
449 324QMap<QString, QString> OTodo::toExtraMap()const {
450QString ToDoEvent::crossToString()const {
451 QString str;
452 QMap<QString, QArray<int> >::ConstIterator it;
453 for (it = data->relations.begin(); it != data->relations.end(); ++it ) {
454 QArray<int> id = it.data();
455 for ( uint i = 0; i < id.size(); ++i ) {
456 str += it.key() + "," + QString::number( i ) + ";";
457 }
458 }
459 str = str.remove( str.length()-1, 1); // strip the ;
460 //qWarning("IDS " + str );
461
462 return str;
463}
464int ToDoEvent::uid()const {
465 return data->uid;
466}
467void ToDoEvent::setUid( int id ) {
468 if ( id == -1 )
469 id = m_gen.generate();
470 m_gen.store(id );
471 changeOrModify();
472 data->uid = id;
473}
474QMap<QString, QString> ToDoEvent::extras()const {
475 return data->extra; 325 return data->extra;
@@ -481,3 +331,3 @@ QMap<QString, QString> ToDoEvent::extras()const {
481 */ 331 */
482void ToDoEvent::changeOrModify() { 332void OTodo::changeOrModify() {
483 if ( data->count != 1 ) { 333 if ( data->count != 1 ) {
@@ -485,3 +335,3 @@ void ToDoEvent::changeOrModify() {
485 data->deref(); 335 data->deref();
486 ToDoEventData* d2 = new ToDoEventData(); 336 OTodoData* d2 = new OTodoData();
487 copy(data, d2 ); 337 copy(data, d2 );
@@ -490,3 +340,3 @@ void ToDoEvent::changeOrModify() {
490} 340}
491void ToDoEvent::copy( ToDoEventData* src, ToDoEventData* dest ) { 341void OTodo::copy( OTodoData* src, OTodoData* dest ) {
492 dest->date = src->date; 342 dest->date = src->date;
@@ -495,3 +345,2 @@ void ToDoEvent::copy( ToDoEventData* src, ToDoEventData* dest ) {
495 dest->priority = src->priority; 345 dest->priority = src->priority;
496 dest->category = src->category;
497 dest->desc = src->desc; 346 dest->desc = src->desc;
@@ -499,4 +348,2 @@ void ToDoEvent::copy( ToDoEventData* src, ToDoEventData* dest ) {
499 dest->extra = src->extra; 348 dest->extra = src->extra;
500 dest->relations = src->relations;
501 dest->uid = src->uid;
502 dest->prog = src->prog; 349 dest->prog = src->prog;
diff --git a/libopie/pim/otodo.h b/libopie/pim/otodo.h
index 429108a..e1729db 100644
--- a/libopie/pim/otodo.h
+++ b/libopie/pim/otodo.h
@@ -20,3 +20,3 @@ class OTodo : public OPimRecord {
20public: 20public:
21 typedef QValueList<ToDoEvent> ValueList; 21 typedef QValueList<OTodo> ValueList;
22 enum RecordFields { 22 enum RecordFields {
@@ -120,2 +120,9 @@ public:
120 120
121 /**
122 * reimplementation
123 */
124 QString type()const;
125 QString toShortText()const;
126 QMap<QString, QString> toExtraMap()const;
127 QString recordField(int id )const;
121 128
@@ -185,3 +192,3 @@ public:
185 bool operator==(const OTodo &toDoEvent )const; 192 bool operator==(const OTodo &toDoEvent )const;
186 ToDoEvent &operator=(const OTodo &toDoEvent ); 193 OTodo &operator=(const OTodo &toDoEvent );
187 194
@@ -189,3 +196,3 @@ public:
189 class OTodoPrivate; 196 class OTodoPrivate;
190 struct OTodoEventData; 197 struct OTodoData;
191 198
@@ -194,11 +201,10 @@ public:
194 void copy( OTodoData* src, OTodoData* dest ); 201 void copy( OTodoData* src, OTodoData* dest );
195 ToDoEventPrivate *d; 202 OTodoPrivate *d;
196 ToDoEventData *data; 203 OTodoData *data;
197 204
198 static Qtopia::UidGen m_gen;
199};
200 inline bool ToDoEvent::operator!=(const ToDoEvent &toDoEvent )const {
201 return !(*this == toDoEvent);
202 }
203}; 205};
206inline bool OTodo::operator!=(const OTodo &toDoEvent )const {
207 return !(*this == toDoEvent);
208}
209
204 210
diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp
index 95de1df..d8f73c7 100644
--- a/libopie2/opiepim/core/opimrecord.cpp
+++ b/libopie2/opiepim/core/opimrecord.cpp
@@ -4,3 +4,5 @@ OPimRecord::OPimRecord( int uid )
4 : Qtopia::Record() { 4 : Qtopia::Record() {
5
5 setUid( uid ); 6 setUid( uid );
7 /* assign a new UID */
6 if ( uid == 1 ) 8 if ( uid == 1 )
@@ -10,3 +12,3 @@ OPimRecord::~OPimRecord() {
10} 12}
11OPimRecord::OPimRecord( OPimRecord& rec ) 13OPimRecord::OPimRecord( const OPimRecord& rec )
12 : Qtopia::Record( rec ) 14 : Qtopia::Record( rec )
@@ -17,5 +19,5 @@ OPimRecord::OPimRecord( OPimRecord& rec )
17OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { 19OPimRecord &OPimRecord::operator=( const OPimRecord& rec) {
18 /* how do I call the parent copy operator ? */ 20 Qtopia::Record::operator=( rec );
19 setUid( rec.uid() ); 21 m_relations = rec.m_relations;
20 setCategories( rec.categories() ); 22
21 return *this; 23 return *this;
@@ -27,3 +29,3 @@ QStringList OPimRecord::categoryNames()const {
27} 29}
28void OPimRecord::setCategoryName( const QStringList& ) { 30void OPimRecord::setCategoryNames( const QStringList& ) {
29 31
@@ -90 +92,15 @@ void OPimRecord::setRelations( const QString& app, QArray<int> ids ) {
90} 92}
93QString OPimRecord::crossToString()const {
94 QString str;
95 QMap<QString, QArray<int> >::ConstIterator it;
96 for (it = m_relations.begin(); it != m_relations.end(); ++it ) {
97 QArray<int> id = it.data();
98 for ( uint i = 0; i < id.size(); ++i ) {
99 str += it.key() + "," + QString::number( i ) + ";";
100 }
101 }
102 str = str.remove( str.length()-1, 1); // strip the ;
103 //qWarning("IDS " + str );
104
105 return str;
106}
diff --git a/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h
index a0e0413..18112d4 100644
--- a/libopie2/opiepim/core/opimrecord.h
+++ b/libopie2/opiepim/core/opimrecord.h
@@ -21,3 +21,3 @@ public:
21 */ 21 */
22 OPimRecord( OPimRecord& rec ); 22 OPimRecord( const OPimRecord& rec );
23 23
@@ -36,3 +36,3 @@ public:
36 */ 36 */
37 void setCategoryName( const QStringList& ); 37 void setCategoryNames( const QStringList& );
38 38
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp
index d8e0447..3c93838 100644
--- a/libopie2/opiepim/otodo.cpp
+++ b/libopie2/opiepim/otodo.cpp
@@ -13,10 +13,9 @@
13 13
14#include "todoevent.h"
15 14
16using namespace Opie;
17 15
18Qtopia::UidGen ToDoEvent::m_gen; 16#include "otodo.h"
19 17
20struct ToDoEvent::ToDoEventData : public QShared { 18
21 ToDoEventData() : QShared() { 19struct OTodo::OTodoData : public QShared {
20 OTodoData() : QShared() {
22 }; 21 };
@@ -31,4 +30,2 @@ struct ToDoEvent::ToDoEventData : public QShared {
31 QMap<QString, QString> extra; 30 QMap<QString, QString> extra;
32 QMap<QString, QArray<int> > relations;
33 int uid;
34 ushort prog; 31 ushort prog;
@@ -38,4 +35,4 @@ struct ToDoEvent::ToDoEventData : public QShared {
38 35
39ToDoEvent::ToDoEvent(const ToDoEvent &event ) 36OTodo::OTodo(const OTodo &event )
40 : data( event.data ) 37 : OPimRecord( event ), data( event.data )
41{ 38{
@@ -44,5 +41,5 @@ ToDoEvent::ToDoEvent(const ToDoEvent &event )
44} 41}
45ToDoEvent::~ToDoEvent() { 42OTodo::~OTodo() {
46 if ( data->deref() ) { 43 if ( data->deref() ) {
47 //qWarning("ToDoEvent::dereffing"); 44 //qWarning("OTodo::dereffing");
48 delete data; 45 delete data;
@@ -52,3 +49,3 @@ ToDoEvent::~ToDoEvent() {
52 49
53ToDoEvent::ToDoEvent(bool completed, int priority, 50OTodo::OTodo(bool completed, int priority,
54 const QStringList &category, 51 const QStringList &category,
@@ -58,5 +55,7 @@ ToDoEvent::ToDoEvent(bool completed, int priority,
58 bool hasDate, QDate date, int uid ) 55 bool hasDate, QDate date, int uid )
56 : OPimRecord( uid )
59{ 57{
60 //qWarning("ToDoEventData"); 58 //qWarning("OTodoData");
61 data = new ToDoEventData; 59 setCategories( idsFromString( category.join(";") ) );
60 data = new OTodoData;
62 data->date = date; 61 data->date = date;
@@ -65,3 +64,2 @@ ToDoEvent::ToDoEvent(bool completed, int priority,
65 data->priority = priority; 64 data->priority = priority;
66 data->category = category;
67 data->sum = summary; 65 data->sum = summary;
@@ -69,9 +67,2 @@ ToDoEvent::ToDoEvent(bool completed, int priority,
69 data->desc = Qtopia::simplifyMultiLineSpace(description ); 67 data->desc = Qtopia::simplifyMultiLineSpace(description );
70 if (uid == -1 ) {
71 uid = m_gen.generate();
72
73 }// generated the ids
74 m_gen.store( uid );
75
76 data->uid = uid;
77 data->hasAlarmDateTime = false; 68 data->hasAlarmDateTime = false;
@@ -79,10 +70,3 @@ ToDoEvent::ToDoEvent(bool completed, int priority,
79} 70}
80QArray<int> ToDoEvent::categories()const 71bool OTodo::match( const QRegExp &regExp )const
81{
82 qWarning( "ToDoEvent:cats" + data->category.join(";") );
83 QArray<int> array(data->category.count() ); // currently the datebook can be only in one category
84 array = Qtopia::Record::idsFromString( data->category.join(";") );
85 return array;
86}
87bool ToDoEvent::match( const QRegExp &regExp )const
88{ 72{
@@ -94,2 +78,4 @@ bool ToDoEvent::match( const QRegExp &regExp )const
94 return true; 78 return true;
79 }else if(data->sum.find( regExp ) != -1 ) {
80 return true;
95 } 81 }
@@ -97,3 +83,3 @@ bool ToDoEvent::match( const QRegExp &regExp )const
97} 83}
98bool ToDoEvent::isCompleted() const 84bool OTodo::isCompleted() const
99{ 85{
@@ -101,3 +87,3 @@ bool ToDoEvent::isCompleted() const
101} 87}
102bool ToDoEvent::hasDueDate() const 88bool OTodo::hasDueDate() const
103{ 89{
@@ -105,3 +91,3 @@ bool ToDoEvent::hasDueDate() const
105} 91}
106bool ToDoEvent::hasAlarmDateTime() const 92bool OTodo::hasAlarmDateTime() const
107{ 93{
@@ -109,3 +95,3 @@ bool ToDoEvent::hasAlarmDateTime() const
109} 95}
110int ToDoEvent::priority()const 96int OTodo::priority()const
111{ 97{
@@ -113,11 +99,3 @@ int ToDoEvent::priority()const
113} 99}
114QStringList ToDoEvent::allCategories()const 100QString OTodo::summary() const
115{
116 return data->category;
117}
118QString ToDoEvent::extra(const QString& )const
119{
120 return QString::null;
121}
122QString ToDoEvent::summary() const
123{ 101{
@@ -125,3 +103,3 @@ QString ToDoEvent::summary() const
125} 103}
126ushort ToDoEvent::progress() const 104ushort OTodo::progress() const
127{ 105{
@@ -129,38 +107,3 @@ ushort ToDoEvent::progress() const
129} 107}
130QStringList ToDoEvent::relatedApps() const 108QDate OTodo::dueDate()const
131{
132 QStringList list;
133 QMap<QString, QArray<int> >::ConstIterator it;
134 for ( it = data->relations.begin(); it != data->relations.end(); ++it ) {
135 list << it.key();
136 }
137 return list;
138}
139QArray<int> ToDoEvent::relations( const QString& app)const
140{
141 QArray<int> tmp;
142 QMap<QString, QArray<int> >::ConstIterator it;
143 it = data->relations.find( app);
144 if ( it != data->relations.end() )
145 tmp = it.data();
146 return tmp;
147}
148void ToDoEvent::insertCategory(const QString &str )
149{
150 changeOrModify();
151 qWarning("insert category;" + str );
152 data->category.append( str );
153}
154void ToDoEvent::clearCategories()
155{
156 changeOrModify();
157 data->category.clear();
158}
159void ToDoEvent::setCategories(const QStringList &list )
160{
161 changeOrModify();
162 qWarning("set categories" + list.join(";") );
163 data->category = list;
164}
165QDate ToDoEvent::dueDate()const
166{ 109{
@@ -169,3 +112,3 @@ QDate ToDoEvent::dueDate()const
169 112
170QDateTime ToDoEvent::alarmDateTime() const 113QDateTime OTodo::alarmDateTime() const
171{ 114{
@@ -174,3 +117,3 @@ QDateTime ToDoEvent::alarmDateTime() const
174 117
175QString ToDoEvent::description()const 118QString OTodo::description()const
176{ 119{
@@ -178,3 +121,3 @@ QString ToDoEvent::description()const
178} 121}
179void ToDoEvent::setCompleted( bool completed ) 122void OTodo::setCompleted( bool completed )
180{ 123{
@@ -183,3 +126,3 @@ void ToDoEvent::setCompleted( bool completed )
183} 126}
184void ToDoEvent::setHasDueDate( bool hasDate ) 127void OTodo::setHasDueDate( bool hasDate )
185{ 128{
@@ -188,3 +131,3 @@ void ToDoEvent::setHasDueDate( bool hasDate )
188} 131}
189void ToDoEvent::setHasAlarmDateTime( bool hasAlarmDateTime ) 132void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime )
190{ 133{
@@ -193,3 +136,3 @@ void ToDoEvent::setHasAlarmDateTime( bool hasAlarmDateTime )
193} 136}
194void ToDoEvent::setDescription(const QString &desc ) 137void OTodo::setDescription(const QString &desc )
195{ 138{
@@ -198,7 +141,3 @@ void ToDoEvent::setDescription(const QString &desc )
198} 141}
199void ToDoEvent::setExtra( const QString&, const QString& ) 142void OTodo::setSummary( const QString& sum )
200{
201
202}
203void ToDoEvent::setSummary( const QString& sum )
204{ 143{
@@ -207,10 +146,3 @@ void ToDoEvent::setSummary( const QString& sum )
207} 146}
208void ToDoEvent::setCategory( const QString &cat ) 147void OTodo::setPriority(int prio )
209{
210 changeOrModify();
211 //qWarning("setCategory %s", cat.latin1() );
212 data->category.clear();
213 data->category << cat;
214}
215void ToDoEvent::setPriority(int prio )
216{ 148{
@@ -219,3 +151,3 @@ void ToDoEvent::setPriority(int prio )
219} 151}
220void ToDoEvent::setDueDate( QDate date ) 152void OTodo::setDueDate( QDate date )
221{ 153{
@@ -224,3 +156,3 @@ void ToDoEvent::setDueDate( QDate date )
224} 156}
225void ToDoEvent::setAlarmDateTime( const QDateTime& alarm ) 157void OTodo::setAlarmDateTime( const QDateTime& alarm )
226{ 158{
@@ -229,47 +161,3 @@ void ToDoEvent::setAlarmDateTime( const QDateTime& alarm )
229} 161}
230void ToDoEvent::addRelated( const QString &app, int id ) 162bool OTodo::isOverdue( )
231{
232 changeOrModify();
233
234 QMap<QString, QArray<int> >::Iterator it;
235 QArray<int> tmp;
236 it = data->relations.find( app );
237 if ( it == data->relations.end() ) {
238 tmp.resize(1 );
239 tmp[0] = id;
240 }else{
241 tmp = it.data();
242 tmp.resize( tmp.size() + 1 );
243 tmp[tmp.size() - 1] = id;
244 }
245 data->relations.replace( app, tmp );
246}
247void ToDoEvent::addRelated(const QString& app, QArray<int> ids )
248{
249 changeOrModify();
250
251 QMap<QString, QArray<int> >::Iterator it;
252 QArray<int> tmp;
253 it = data->relations.find( app);
254 if ( it == data->relations.end() ) { // not there
255 /** tmp.resize( ids.size() ); stupid??
256 */
257 tmp = ids;
258 }else{
259 tmp = it.data();
260 int offset = tmp.size()-1;
261 tmp.resize( tmp.size() + ids.size() );
262 for (uint i = 0; i < ids.size(); i++ ) {
263 tmp[offset+i] = ids[i];
264 }
265
266 }
267 data->relations.replace( app, tmp );
268}
269void ToDoEvent::clearRelated( const QString& app )
270{
271 changeOrModify();
272 data->relations.remove( app );
273}
274bool ToDoEvent::isOverdue( )
275{ 163{
@@ -279,3 +167,3 @@ bool ToDoEvent::isOverdue( )
279} 167}
280void ToDoEvent::setProgress(ushort progress ) 168void OTodo::setProgress(ushort progress )
281{ 169{
@@ -284,2 +172,5 @@ void ToDoEvent::setProgress(ushort progress )
284} 172}
173QString OTodo::toShortText() const {
174 return summary();
175}
285/*! 176/*!
@@ -287,3 +178,3 @@ void ToDoEvent::setProgress(ushort progress )
287*/ 178*/
288QString ToDoEvent::richText() const 179QString OTodo::toRichText() const
289{ 180{
@@ -318,20 +209,6 @@ QString ToDoEvent::richText() const
318 209
319 // Open database of all categories and get the list of
320 // the categories this todoevent belongs to.
321 // Then print them...
322 // I am not sure whether there is no better way doing this !?
323 Categories catdb;
324 bool firstloop = true;
325 catdb.load( categoryFileName() );
326 catlist = allCategories();
327
328 text += "<b>" + QObject::tr( "Category:") + "</b> "; 210 text += "<b>" + QObject::tr( "Category:") + "</b> ";
329 for ( QStringList::Iterator it = catlist.begin(); it != catlist.end(); ++it ) { 211 text += categoryNames().join(", ");
330 if (!firstloop){
331 text += ", ";
332 }
333 firstloop = false;
334 text += catdb.label ("todo", (*it).toInt());
335 }
336 text += "<br>"; 212 text += "<br>";
213
337 return text; 214 return text;
@@ -339,3 +216,3 @@ QString ToDoEvent::richText() const
339 216
340bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{ 217bool OTodo::operator<( const OTodo &toDoEvent )const{
341 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; 218 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
@@ -351,3 +228,3 @@ bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{
351} 228}
352bool ToDoEvent::operator<=(const ToDoEvent &toDoEvent )const 229bool OTodo::operator<=(const OTodo &toDoEvent )const
353{ 230{
@@ -364,3 +241,3 @@ bool ToDoEvent::operator<=(const ToDoEvent &toDoEvent )const
364} 241}
365bool ToDoEvent::operator>(const ToDoEvent &toDoEvent )const 242bool OTodo::operator>(const OTodo &toDoEvent )const
366{ 243{
@@ -377,3 +254,3 @@ bool ToDoEvent::operator>(const ToDoEvent &toDoEvent )const
377} 254}
378bool ToDoEvent::operator>=(const ToDoEvent &toDoEvent )const 255bool OTodo::operator>=(const OTodo &toDoEvent )const
379{ 256{
@@ -390,3 +267,3 @@ bool ToDoEvent::operator>=(const ToDoEvent &toDoEvent )const
390} 267}
391bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const 268bool OTodo::operator==(const OTodo &toDoEvent )const
392{ 269{
@@ -406,3 +283,3 @@ bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const
406} 283}
407void ToDoEvent::deref() { 284void OTodo::deref() {
408 285
@@ -415,4 +292,5 @@ void ToDoEvent::deref() {
415} 292}
416ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item ) 293OTodo &OTodo::operator=(const OTodo &item )
417{ 294{
295 OPimRecord::operator=( item );
418 //qWarning("operator= ref "); 296 //qWarning("operator= ref ");
@@ -421,5 +299,2 @@ ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item )
421 299
422 data = item.data;
423
424
425 return *this; 300 return *this;
@@ -427,7 +302,7 @@ ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item )
427 302
428QMap<int, QString> ToDoEvent::toMap() const { 303QMap<int, QString> OTodo::toMap() const {
429 QMap<int, QString> map; 304 QMap<int, QString> map;
430 305
431 map.insert( Uid, QString::number( data->uid ) ); 306 map.insert( Uid, QString::number( uid() ) );
432 map.insert( Category, data->category.join(";") ); 307 map.insert( Category, idsToString( categories() ) );
433 map.insert( HasDate, QString::number( data->hasDate ) ); 308 map.insert( HasDate, QString::number( data->hasDate ) );
@@ -448,28 +323,3 @@ QMap<int, QString> ToDoEvent::toMap() const {
448 323
449 324QMap<QString, QString> OTodo::toExtraMap()const {
450QString ToDoEvent::crossToString()const {
451 QString str;
452 QMap<QString, QArray<int> >::ConstIterator it;
453 for (it = data->relations.begin(); it != data->relations.end(); ++it ) {
454 QArray<int> id = it.data();
455 for ( uint i = 0; i < id.size(); ++i ) {
456 str += it.key() + "," + QString::number( i ) + ";";
457 }
458 }
459 str = str.remove( str.length()-1, 1); // strip the ;
460 //qWarning("IDS " + str );
461
462 return str;
463}
464int ToDoEvent::uid()const {
465 return data->uid;
466}
467void ToDoEvent::setUid( int id ) {
468 if ( id == -1 )
469 id = m_gen.generate();
470 m_gen.store(id );
471 changeOrModify();
472 data->uid = id;
473}
474QMap<QString, QString> ToDoEvent::extras()const {
475 return data->extra; 325 return data->extra;
@@ -481,3 +331,3 @@ QMap<QString, QString> ToDoEvent::extras()const {
481 */ 331 */
482void ToDoEvent::changeOrModify() { 332void OTodo::changeOrModify() {
483 if ( data->count != 1 ) { 333 if ( data->count != 1 ) {
@@ -485,3 +335,3 @@ void ToDoEvent::changeOrModify() {
485 data->deref(); 335 data->deref();
486 ToDoEventData* d2 = new ToDoEventData(); 336 OTodoData* d2 = new OTodoData();
487 copy(data, d2 ); 337 copy(data, d2 );
@@ -490,3 +340,3 @@ void ToDoEvent::changeOrModify() {
490} 340}
491void ToDoEvent::copy( ToDoEventData* src, ToDoEventData* dest ) { 341void OTodo::copy( OTodoData* src, OTodoData* dest ) {
492 dest->date = src->date; 342 dest->date = src->date;
@@ -495,3 +345,2 @@ void ToDoEvent::copy( ToDoEventData* src, ToDoEventData* dest ) {
495 dest->priority = src->priority; 345 dest->priority = src->priority;
496 dest->category = src->category;
497 dest->desc = src->desc; 346 dest->desc = src->desc;
@@ -499,4 +348,2 @@ void ToDoEvent::copy( ToDoEventData* src, ToDoEventData* dest ) {
499 dest->extra = src->extra; 348 dest->extra = src->extra;
500 dest->relations = src->relations;
501 dest->uid = src->uid;
502 dest->prog = src->prog; 349 dest->prog = src->prog;
diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h
index 429108a..e1729db 100644
--- a/libopie2/opiepim/otodo.h
+++ b/libopie2/opiepim/otodo.h
@@ -20,3 +20,3 @@ class OTodo : public OPimRecord {
20public: 20public:
21 typedef QValueList<ToDoEvent> ValueList; 21 typedef QValueList<OTodo> ValueList;
22 enum RecordFields { 22 enum RecordFields {
@@ -120,2 +120,9 @@ public:
120 120
121 /**
122 * reimplementation
123 */
124 QString type()const;
125 QString toShortText()const;
126 QMap<QString, QString> toExtraMap()const;
127 QString recordField(int id )const;
121 128
@@ -185,3 +192,3 @@ public:
185 bool operator==(const OTodo &toDoEvent )const; 192 bool operator==(const OTodo &toDoEvent )const;
186 ToDoEvent &operator=(const OTodo &toDoEvent ); 193 OTodo &operator=(const OTodo &toDoEvent );
187 194
@@ -189,3 +196,3 @@ public:
189 class OTodoPrivate; 196 class OTodoPrivate;
190 struct OTodoEventData; 197 struct OTodoData;
191 198
@@ -194,11 +201,10 @@ public:
194 void copy( OTodoData* src, OTodoData* dest ); 201 void copy( OTodoData* src, OTodoData* dest );
195 ToDoEventPrivate *d; 202 OTodoPrivate *d;
196 ToDoEventData *data; 203 OTodoData *data;
197 204
198 static Qtopia::UidGen m_gen;
199};
200 inline bool ToDoEvent::operator!=(const ToDoEvent &toDoEvent )const {
201 return !(*this == toDoEvent);
202 }
203}; 205};
206inline bool OTodo::operator!=(const OTodo &toDoEvent )const {
207 return !(*this == toDoEvent);
208}
209
204 210