summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/oclickablelabel.cpp2
-rw-r--r--libopie/ofileselector.cc9
-rw-r--r--libopie/ofileselector.h2
-rw-r--r--libopie/ofileselector/odefaultfactories.cpp4
-rw-r--r--libopie/ofileselector/odefaultfactories.h1
-rw-r--r--libopie/ofileselector/ofileselector.cpp3
-rw-r--r--libopie/pim/opimaccessbackend.h4
-rw-r--r--libopie/pim/opimaccesstemplate.h10
-rw-r--r--libopie/pim/orecordlist.h4
-rw-r--r--libopie/pim/otodo.cpp2
-rw-r--r--libopie2/opiepim/backend/opimaccessbackend.h4
-rw-r--r--libopie2/opiepim/core/opimaccesstemplate.h10
-rw-r--r--libopie2/opiepim/orecordlist.h4
-rw-r--r--libopie2/opiepim/otodo.cpp2
14 files changed, 28 insertions, 33 deletions
diff --git a/libopie/oclickablelabel.cpp b/libopie/oclickablelabel.cpp
index 43a0524..5768529 100644
--- a/libopie/oclickablelabel.cpp
+++ b/libopie/oclickablelabel.cpp
@@ -1,68 +1,68 @@
1#include "oclickablelabel.h" 1#include "oclickablelabel.h"
2#include <stdio.h> 2#include <stdio.h>
3 3
4OClickableLabel::OClickableLabel(QWidget* parent, 4OClickableLabel::OClickableLabel(QWidget* parent,
5 const char* name, 5 const char* name,
6 WFlags fl) : 6 WFlags fl) :
7 QLabel(parent,name,fl) 7 QLabel(parent,name,fl)
8{ 8{
9 textInverted=false; 9 textInverted=false;
10 isToggle=false; 10 isToggle=false;
11 isDown=false; 11 isDown=false;
12 showState(false); 12 showState(false);
13 setFrameShadow(Sunken); 13 setFrameShadow(Sunken);
14} 14}
15 15
16void OClickableLabel::setToggleButton(bool t) { 16void OClickableLabel::setToggleButton(bool t) {
17 isToggle=t; 17 isToggle=t;
18} 18}
19 19
20void OClickableLabel::mousePressEvent( QMouseEvent *e ) { 20void OClickableLabel::mousePressEvent( QMouseEvent * /*e*/ ) {
21 if (isToggle && isDown) { 21 if (isToggle && isDown) {
22 showState(false); 22 showState(false);
23 } else { 23 } else {
24 showState(true); 24 showState(true);
25 } 25 }
26} 26}
27 27
28void OClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { 28void OClickableLabel::mouseReleaseEvent( QMouseEvent *e ) {
29 if (rect().contains(e->pos()) && isToggle) isDown=!isDown; 29 if (rect().contains(e->pos()) && isToggle) isDown=!isDown;
30 30
31 if (isToggle && isDown) { 31 if (isToggle && isDown) {
32 showState(true); 32 showState(true);
33 } else { 33 } else {
34 showState(false); 34 showState(false);
35 } 35 }
36 36
37 if (rect().contains(e->pos())) { 37 if (rect().contains(e->pos())) {
38 if (isToggle) { 38 if (isToggle) {
39 emit toggled(isDown); 39 emit toggled(isDown);
40 } 40 }
41 emit clicked(); 41 emit clicked();
42 } 42 }
43} 43}
44 44
45void OClickableLabel::mouseMoveEvent( QMouseEvent *e ) { 45void OClickableLabel::mouseMoveEvent( QMouseEvent *e ) {
46 if (rect().contains(e->pos())) { 46 if (rect().contains(e->pos())) {
47 if (isToggle && isDown) { 47 if (isToggle && isDown) {
48 showState(false); 48 showState(false);
49 } else { 49 } else {
50 showState(true); 50 showState(true);
51 } 51 }
52 } else { 52 } else {
53 if (isToggle && isDown) { 53 if (isToggle && isDown) {
54 showState(true); 54 showState(true);
55 } else { 55 } else {
56 showState(false); 56 showState(false);
57 } 57 }
58 } 58 }
59} 59}
60 60
61void OClickableLabel::showState(bool on) { 61void OClickableLabel::showState(bool on) {
62 if (on) { 62 if (on) {
63 //setFrameShape(Panel); 63 //setFrameShape(Panel);
64 setInverted(true); 64 setInverted(true);
65 setBackgroundMode(PaletteHighlight); 65 setBackgroundMode(PaletteHighlight);
66 } else { 66 } else {
67 //setFrameShape(NoFrame); 67 //setFrameShape(NoFrame);
68 setInverted(false); 68 setInverted(false);
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 9534667..6a6a300 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -330,97 +330,97 @@ QString OFileSelector::selectedName() const
330 }else{ 330 }else{
331 QListViewItem *item = m_View->currentItem(); 331 QListViewItem *item = m_View->currentItem();
332 if( item != 0 ) 332 if( item != 0 )
333 name = m_currentDir + "/" + item->text( 1 ); 333 name = m_currentDir + "/" + item->text( 1 );
334 } 334 }
335 }else { // installed view 335 }else { // installed view
336 ; 336 ;
337 } 337 }
338 return name; 338 return name;
339} 339}
340QStringList OFileSelector::selectedNames()const 340QStringList OFileSelector::selectedNames()const
341{ 341{
342 QStringList list; 342 QStringList list;
343 if( m_selector == NORMAL ){ 343 if( m_selector == NORMAL ){
344 list << selectedName(); 344 list << selectedName();
345 }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { 345 }else if ( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
346 list << selectedName(); // FIXME implement multiple Selections 346 list << selectedName(); // FIXME implement multiple Selections
347 } 347 }
348 return list; 348 return list;
349} 349}
350/** If mode is set to the Dir selection this will return the selected path. 350/** If mode is set to the Dir selection this will return the selected path.
351 * 351 *
352 * 352 *
353 */ 353 */
354QString OFileSelector::selectedPath()const 354QString OFileSelector::selectedPath()const
355{ 355{
356 QString path; 356 QString path;
357 if( m_selector == NORMAL ){ 357 if( m_selector == NORMAL ){
358 path = QPEApplication::documentDir(); 358 path = QPEApplication::documentDir();
359 }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 359 }else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
360 ; 360 ;
361 } 361 }
362 return path; 362 return path;
363} 363}
364QStringList OFileSelector::selectedPaths() const 364QStringList OFileSelector::selectedPaths() const
365{ 365{
366 QStringList list; 366 QStringList list;
367 list << selectedPath(); 367 list << selectedPath();
368 return list; 368 return list;
369} 369}
370QString OFileSelector::directory()const 370QString OFileSelector::directory()const
371{ 371{
372 if( m_selector == NORMAL ) 372 if( m_selector == NORMAL )
373 return QPEApplication::documentDir(); 373 return QPEApplication::documentDir();
374 374
375 return QDir(m_currentDir).absPath(); 375 return QDir(m_currentDir).absPath();
376} 376}
377 377
378int OFileSelector::fileCount() 378int OFileSelector::fileCount() const
379{ 379{
380 int count; 380 int count;
381 switch( m_selector ){ 381 switch( m_selector ){
382 case NORMAL: 382 case NORMAL:
383 count = m_select->fileCount(); 383 count = m_select->fileCount();
384 break; 384 break;
385 //case CUSTOM: 385 //case CUSTOM:
386 case EXTENDED: 386 case EXTENDED:
387 case EXTENDED_ALL: 387 case EXTENDED_ALL:
388 default: 388 default:
389 count = m_View->childCount(); 389 count = m_View->childCount();
390 break; 390 break;
391 } 391 }
392 return count; 392 return count;
393} 393}
394DocLnk OFileSelector::selectedDocument() const 394DocLnk OFileSelector::selectedDocument() const
395{ 395{
396 DocLnk lnk; 396 DocLnk lnk;
397 switch( m_selector ){ 397 switch( m_selector ){
398 case NORMAL:{ 398 case NORMAL:{
399 lnk = m_select->selectedDocument(); 399 lnk = m_select->selectedDocument();
400 break; 400 break;
401 } 401 }
402 case EXTENDED: 402 case EXTENDED:
403 case EXTENDED_ALL: 403 case EXTENDED_ALL:
404 default: 404 default:
405 lnk = DocLnk( selectedName() ); // new DocLnk 405 lnk = DocLnk( selectedName() ); // new DocLnk
406 break; 406 break;
407 } 407 }
408 return lnk; 408 return lnk;
409} 409}
410QValueList<DocLnk> OFileSelector::selectedDocuments() const 410QValueList<DocLnk> OFileSelector::selectedDocuments() const
411{ 411{
412 QValueList<DocLnk> docs; 412 QValueList<DocLnk> docs;
413 docs.append( selectedDocument() ); 413 docs.append( selectedDocument() );
414 return docs; 414 return docs;
415} 415}
416 416
417 417
418// slots internal 418// slots internal
419 419
420void OFileSelector::slotOk() 420void OFileSelector::slotOk()
421{ 421{
422 emit ok(); 422 emit ok();
423} 423}
424void OFileSelector::slotCancel() 424void OFileSelector::slotCancel()
425{ 425{
426 emit cancel(); 426 emit cancel();
@@ -637,129 +637,129 @@ void OFileSelector::initVars()
637{ 637{
638 if( m_mimetypes.isEmpty() ) 638 if( m_mimetypes.isEmpty() )
639 m_autoMime = true; 639 m_autoMime = true;
640 else 640 else
641 m_autoMime = false; 641 m_autoMime = false;
642 m_shClose = false; 642 m_shClose = false;
643 m_shNew = false; 643 m_shNew = false;
644 m_shTool = true; 644 m_shTool = true;
645 m_shPerm = false; 645 m_shPerm = false;
646 m_shLne = true; 646 m_shLne = true;
647 m_shChooser = true; 647 m_shChooser = true;
648 m_shYesNo = true; 648 m_shYesNo = true;
649 m_case = false; 649 m_case = false;
650 m_dir = true; 650 m_dir = true;
651 m_files = true; 651 m_files = true;
652 m_showPopup = false; 652 m_showPopup = false;
653 if(m_pixmaps == 0 ) // init the pixmaps 653 if(m_pixmaps == 0 ) // init the pixmaps
654 initPics(); 654 initPics();
655 655
656 // pointers 656 // pointers
657 m_location = 0; 657 m_location = 0;
658 m_mimeCheck = 0; 658 m_mimeCheck = 0;
659 m_viewCheck = 0; 659 m_viewCheck = 0;
660 m_homeButton = 0; 660 m_homeButton = 0;
661 m_docButton = 0; 661 m_docButton = 0;
662 m_hideButton = 0; 662 m_hideButton = 0;
663 m_ok = 0; 663 m_ok = 0;
664 m_cancel = 0; 664 m_cancel = 0;
665 m_reread = 0; 665 m_reread = 0;
666 m_up = 0; 666 m_up = 0;
667 m_View = 0; 667 m_View = 0;
668 m_checkPerm = 0; 668 m_checkPerm = 0;
669 m_pseudo = 0; 669 m_pseudo = 0;
670 m_pseudoLayout = 0; 670 m_pseudoLayout = 0;
671 m_select = 0; 671 m_select = 0;
672 m_stack = 0; 672 m_stack = 0;
673 m_lay = 0; 673 m_lay = 0;
674 m_Oselector = 0; 674 m_Oselector = 0;
675 m_boxToolbar = 0; 675 m_boxToolbar = 0;
676 m_boxOk = 0; 676 m_boxOk = 0;
677 m_boxName = 0; 677 m_boxName = 0;
678 m_boxView = 0; 678 m_boxView = 0;
679 m_custom = 0; 679 m_custom = 0;
680 m_edit = 0; 680 m_edit = 0;
681 m_fnLabel = 0; 681 m_fnLabel = 0;
682 m_new = 0; 682 m_new = 0;
683 m_close = 0; 683 m_close = 0;
684} 684}
685void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink) 685void OFileSelector::addFile(const QString &/*mime*/, QFileInfo *info, bool symlink)
686{ 686{
687 if(!m_files) 687 if(!m_files)
688 return; 688 return;
689 // if( !compliesMime(info->absFilePath(), mime ) ) 689 // if( !compliesMime(info->absFilePath(), mime ) )
690 // return; 690 // return;
691 MimeType type( info->absFilePath() ); 691 MimeType type( info->absFilePath() );
692 if (!compliesMime( type.id() ) ) 692 if (!compliesMime( type.id() ) )
693 return; 693 return;
694 694
695 QPixmap pix = type.pixmap(); 695 QPixmap pix = type.pixmap();
696 QString dir; 696 QString dir;
697 QString name; 697 QString name;
698 bool locked; 698 bool locked;
699 if( pix.isNull() ) 699 if( pix.isNull() )
700 pix = Resource::loadPixmap( "UnknownDocument-14"); 700 pix = Resource::loadPixmap( "UnknownDocument-14");
701 dir = info->dirPath( true ); 701 dir = info->dirPath( true );
702 if( symlink ) 702 if( symlink )
703 name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); 703 name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink();
704 else { 704 else {
705 name = info->fileName(); 705 name = info->fileName();
706 if( ( m_mode == OPEN && !info->isReadable() )|| 706 if( ( m_mode == OPEN && !info->isReadable() )||
707 ( m_mode == SAVE && !info->isWritable() ) ){ 707 ( m_mode == SAVE && !info->isWritable() ) ){
708 708
709 locked = true; pix = Resource::loadPixmap("locked"); 709 locked = true; pix = Resource::loadPixmap("locked");
710 } 710 }
711 } 711 }
712 new OFileSelectorItem( m_View, pix, name, 712 new OFileSelectorItem( m_View, pix, name,
713 info->lastModified().toString(), 713 info->lastModified().toString(),
714 QString::number( info->size() ), 714 QString::number( info->size() ),
715 dir, locked ); 715 dir, locked );
716} 716}
717void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) 717void OFileSelector::addDir(const QString &/*mime*/, QFileInfo *info, bool symlink )
718{ 718{
719 if(!m_dir) 719 if(!m_dir)
720 return; 720 return;
721 if( m_selector == EXTENDED_ALL || m_selector == EXTENDED ){ 721 if( m_selector == EXTENDED_ALL || m_selector == EXTENDED ){
722 bool locked = false; 722 bool locked = false;
723 QString name; 723 QString name;
724 QPixmap pix; 724 QPixmap pix;
725 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ 725 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){
726 locked = true; 726 locked = true;
727 if( symlink ) 727 if( symlink )
728 pix = (*m_pixmaps)["symlinkedlocked"]; 728 pix = (*m_pixmaps)["symlinkedlocked"];
729 else 729 else
730 pix = Resource::loadPixmap("lockedfolder"); 730 pix = Resource::loadPixmap("lockedfolder");
731 }else { // readable 731 }else { // readable
732 pix = symlink ? (*m_pixmaps)["dirsymlink"] : Resource::loadPixmap("folder") ; 732 pix = symlink ? (*m_pixmaps)["dirsymlink"] : Resource::loadPixmap("folder") ;
733 } 733 }
734 name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; 734 name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ;
735 new OFileSelectorItem( m_View, pix, name, 735 new OFileSelectorItem( m_View, pix, name,
736 info->lastModified().toString(), 736 info->lastModified().toString(),
737 QString::number( info->size() ), 737 QString::number( info->size() ),
738 info->dirPath( true ), locked, 738 info->dirPath( true ), locked,
739 true ); 739 true );
740 740
741 }// else CUSTOM View 741 }// else CUSTOM View
742} 742}
743void OFileSelector::delItems() 743void OFileSelector::delItems()
744{ 744{
745 745
746} 746}
747void OFileSelector::initializeName() 747void OFileSelector::initializeName()
748{ 748{
749 /** Name Layout Line 749 /** Name Layout Line
750 * This is the Layout line arranged in 750 * This is the Layout line arranged in
751 * horizontal way each components 751 * horizontal way each components
752 * are next to each other 752 * are next to each other
753 * but we will only do this if 753 * but we will only do this if
754 * we didn't initialize a while ago. 754 * we didn't initialize a while ago.
755 */ 755 */
756 if( m_boxName == 0 ){ 756 if( m_boxName == 0 ){
757 m_boxName = new QHBox( this ); // remove this this? or use a QHBox 757 m_boxName = new QHBox( this ); // remove this this? or use a QHBox
758 m_fnLabel = new QLabel( m_boxName ); 758 m_fnLabel = new QLabel( m_boxName );
759 m_fnLabel->setText( tr("Name:") ); 759 m_fnLabel->setText( tr("Name:") );
760 m_edit = new QLineEdit( m_boxName ); 760 m_edit = new QLineEdit( m_boxName );
761 m_edit->setText( m_name ); 761 m_edit->setText( m_name );
762 //m_boxName->addWidget( m_fnLabel ); 762 //m_boxName->addWidget( m_fnLabel );
763 m_boxName->setMargin( 5 ); 763 m_boxName->setMargin( 5 );
764 m_boxName->setSpacing( 8 ); 764 m_boxName->setSpacing( 8 );
765 //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor 765 //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor
@@ -973,184 +973,183 @@ bool OFileSelector::compliesMime( const QString &path, const QString &mime )
973/* check if the mimetype in mime 973/* check if the mimetype in mime
974 * complies with the one which is current 974 * complies with the one which is current
975 */ 975 */
976/* 976/*
977 * We've the mimetype of the file 977 * We've the mimetype of the file
978 * We need to get the stringlist of the current mimetype 978 * We need to get the stringlist of the current mimetype
979 * 979 *
980 * mime = image/jpeg 980 * mime = image/jpeg
981 * QStringList = 'image/*' 981 * QStringList = 'image/*'
982 * or QStringList = image/jpeg;image/png;application/x-ogg 982 * or QStringList = image/jpeg;image/png;application/x-ogg
983 * or QStringList = application/x-ogg;image/*; 983 * or QStringList = application/x-ogg;image/*;
984 * with all these mime filters it should get acceptes 984 * with all these mime filters it should get acceptes
985 * to do so we need to look if mime is contained inside 985 * to do so we need to look if mime is contained inside
986 * the stringlist 986 * the stringlist
987 * if it's contained return true 987 * if it's contained return true
988 * if not ( I'm no RegExp expert at all ) we'll look if a '/*' 988 * if not ( I'm no RegExp expert at all ) we'll look if a '/*'
989 * is contained in the mimefilter and then we will 989 * is contained in the mimefilter and then we will
990 * look if both are equal until the '/' 990 * look if both are equal until the '/'
991 */ 991 */
992bool OFileSelector::compliesMime( const QString& mime ) { 992bool OFileSelector::compliesMime( const QString& mime ) {
993 qWarning("mimetype is %s", mime.latin1() ); 993 qWarning("mimetype is %s", mime.latin1() );
994 QString currentText; 994 QString currentText;
995 if (m_shChooser ) 995 if (m_shChooser )
996 currentText = m_mimeCheck->currentText(); 996 currentText = m_mimeCheck->currentText();
997 997
998 qWarning("current text is %s", currentText.latin1() ); 998 qWarning("current text is %s", currentText.latin1() );
999 QMap<QString, QStringList>::Iterator it; 999 QMap<QString, QStringList>::Iterator it;
1000 QStringList list; 1000 QStringList list;
1001 if ( currentText == tr("All") ) return true; 1001 if ( currentText == tr("All") ) return true;
1002 else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) { 1002 else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) {
1003 it = m_mimetypes.begin(); 1003 it = m_mimetypes.begin();
1004 list = it.data(); 1004 list = it.data();
1005 }else if ( currentText.isEmpty() ) return true; 1005 }else if ( currentText.isEmpty() ) return true;
1006 else{ 1006 else{
1007 it = m_mimetypes.find(currentText ); 1007 it = m_mimetypes.find(currentText );
1008 if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText; 1008 if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText;
1009 else qWarning("found"), list = it.data(); 1009 else qWarning("found"), list = it.data();
1010 } 1010 }
1011 // dump it now 1011 // dump it now
1012 //for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 1012 //for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
1013 // qWarning( "%s", (*it).latin1() ); 1013 // qWarning( "%s", (*it).latin1() );
1014 //} 1014 //}
1015 1015
1016 1016
1017 if ( list.contains(mime) ) return true; 1017 if ( list.contains(mime) ) return true;
1018 qWarning("list doesn't contain it "); 1018 qWarning("list doesn't contain it ");
1019 QStringList::Iterator it2; 1019 QStringList::Iterator it2;
1020 int pos; 1020 int pos;
1021 int pos2;
1022 for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { 1021 for ( it2 = list.begin(); it2 != list.end(); ++it2 ) {
1023 pos = (*it2).findRev("/*"); 1022 pos = (*it2).findRev("/*");
1024 if ( pos >= 0 ) { 1023 if ( pos >= 0 ) {
1025 if ( mime.contains( (*it2).left(pos) ) ) return true; 1024 if ( mime.contains( (*it2).left(pos) ) ) return true;
1026 } 1025 }
1027 } 1026 }
1028 return false; 1027 return false;
1029} 1028}
1030void OFileSelector::slotFileSelected( const QString &string ) 1029void OFileSelector::slotFileSelected( const QString &string )
1031{ 1030{
1032 if( m_shLne ) 1031 if( m_shLne )
1033 m_edit->setText( string ); 1032 m_edit->setText( string );
1034 emit fileSelected( string ); 1033 emit fileSelected( string );
1035} 1034}
1036void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) 1035void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk )
1037{ 1036{
1038 slotFileSelected( lnk.name() ); 1037 slotFileSelected( lnk.name() );
1039 emit fileSelected( lnk ); 1038 emit fileSelected( lnk );
1040} 1039}
1041void OFileSelector::slotSelectionChanged() 1040void OFileSelector::slotSelectionChanged()
1042{ 1041{
1043 1042
1044} 1043}
1045void OFileSelector::slotCurrentChanged(QListViewItem* item ) 1044void OFileSelector::slotCurrentChanged(QListViewItem* item )
1046{ 1045{
1047 if( item == 0 ) 1046 if( item == 0 )
1048 return; 1047 return;
1049 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { 1048 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
1050 OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) 1049 OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;)
1051 qWarning("current changed"); 1050 qWarning("current changed");
1052 if(!sel->isDir() ){ 1051 if(!sel->isDir() ){
1053 if( m_shLne ) 1052 if( m_shLne )
1054 m_edit->setText( sel->text(1) ); 1053 m_edit->setText( sel->text(1) );
1055 1054
1056 if (m_mode == FILESELECTOR ) { 1055 if (m_mode == FILESELECTOR ) {
1057 QStringList str = QStringList::split("->", sel->text(1) ); 1056 QStringList str = QStringList::split("->", sel->text(1) );
1058 QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); 1057 QString path =sel->directory() + "/" + str[0].stripWhiteSpace();
1059 emit fileSelected(path ); 1058 emit fileSelected(path );
1060 DocLnk lnk( path ); 1059 DocLnk lnk( path );
1061 emit fileSelected(lnk ); 1060 emit fileSelected(lnk );
1062 } 1061 }
1063 } 1062 }
1064 } 1063 }
1065} 1064}
1066void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int) 1065void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int)
1067{ 1066{
1068 if ( item == 0 ) 1067 if ( item == 0 )
1069 return; 1068 return;
1070 1069
1071 if( button != Qt::LeftButton ) 1070 if( button != Qt::LeftButton )
1072 return; 1071 return;
1073 1072
1074 switch( m_selector ){ 1073 switch( m_selector ){
1075 default: 1074 default:
1076 break; 1075 break;
1077 case EXTENDED: // fall through 1076 case EXTENDED: // fall through
1078 case EXTENDED_ALL:{ 1077 case EXTENDED_ALL:{
1079 OFileSelectorItem *sel = (OFileSelectorItem*)item; 1078 OFileSelectorItem *sel = (OFileSelectorItem*)item;
1080 if(!sel->isLocked() ){ 1079 if(!sel->isLocked() ){
1081 QStringList str = QStringList::split("->", sel->text(1) ); 1080 QStringList str = QStringList::split("->", sel->text(1) );
1082 if( sel->isDir() ){ 1081 if( sel->isDir() ){
1083 cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1082 cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
1084 // if MODE Dir m_shLne set the Text 1083 // if MODE Dir m_shLne set the Text
1085 }else{ 1084 }else{
1086 if( m_shLne ) 1085 if( m_shLne )
1087 m_edit->setText( str[0].stripWhiteSpace() ); 1086 m_edit->setText( str[0].stripWhiteSpace() );
1088 qWarning("selected here in slot clicked"); 1087 qWarning("selected here in slot clicked");
1089 emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1088 emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() );
1090 DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1089 DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() );
1091 qWarning("file selected"); 1090 qWarning("file selected");
1092 emit fileSelected( lnk ); 1091 emit fileSelected( lnk );
1093 } 1092 }
1094 } 1093 }
1095 break; 1094 break;
1096 } 1095 }
1097 } 1096 }
1098} 1097}
1099void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) 1098void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int )
1100{ 1099{
1101 if( item == 0 ) 1100 if( item == 0 )
1102 return; 1101 return;
1103 1102
1104 if( button != Qt::RightButton ) 1103 if( button != Qt::RightButton )
1105 return; 1104 return;
1106 slotContextMenu( item ); 1105 slotContextMenu( item );
1107} 1106}
1108void OFileSelector::slotContextMenu( QListViewItem *item) 1107void OFileSelector::slotContextMenu( QListViewItem * /*item*/)
1109{ 1108{
1110 1109
1111} 1110}
1112void OFileSelector::slotChangedDir() 1111void OFileSelector::slotChangedDir()
1113{ 1112{
1114 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1113 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1115 if(sel->isDir() ){ 1114 if(sel->isDir() ){
1116 QStringList str = QStringList::split("->", sel->text(1) ); 1115 QStringList str = QStringList::split("->", sel->text(1) );
1117 cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1116 cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
1118 } 1117 }
1119} 1118}
1120void OFileSelector::slotOpen() 1119void OFileSelector::slotOpen()
1121{ 1120{
1122 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1121 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1123 if(!sel->isDir() ){ 1122 if(!sel->isDir() ){
1124 QStringList str = QStringList::split("->", sel->text(1) ); 1123 QStringList str = QStringList::split("->", sel->text(1) );
1125 slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() ); 1124 slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() );
1126 qWarning("slot open"); 1125 qWarning("slot open");
1127 // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1126 // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() );
1128 //emit fileSelected( lnk ); 1127 //emit fileSelected( lnk );
1129 } 1128 }
1130} 1129}
1131void OFileSelector::slotRescan() 1130void OFileSelector::slotRescan()
1132{ 1131{
1133 1132
1134} 1133}
1135void OFileSelector::slotRename() 1134void OFileSelector::slotRename()
1136{ 1135{
1137 reparse(); 1136 reparse();
1138} 1137}
1139void OFileSelector::slotDelete() 1138void OFileSelector::slotDelete()
1140{ 1139{
1141 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1140 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1142 QStringList list = QStringList::split("->", sel->text(1) ); 1141 QStringList list = QStringList::split("->", sel->text(1) );
1143 if( sel->isDir() ){ 1142 if( sel->isDir() ){
1144 QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry 1143 QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry
1145 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], 1144 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0],
1146 tr("Yes"),tr("No"),0,1,1) ) { 1145 tr("Yes"),tr("No"),0,1,1) ) {
1147 case 0: 1146 case 0:
1148 ::system(str.utf8().data() ); 1147 ::system(str.utf8().data() );
1149 break; 1148 break;
1150 } 1149 }
1151 } else { 1150 } else {
1152 QFile::remove( list[0] ); 1151 QFile::remove( list[0] );
1153 } 1152 }
1154 m_View->takeItem( sel ); 1153 m_View->takeItem( sel );
1155 delete sel; 1154 delete sel;
1156} 1155}
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h
index f2d5f84..17c494e 100644
--- a/libopie/ofileselector.h
+++ b/libopie/ofileselector.h
@@ -135,97 +135,97 @@ class OFileSelector : public QWidget {
135 bool isPermissionBarVisible() const { return m_shPerm; }; 135 bool isPermissionBarVisible() const { return m_shPerm; };
136 bool isLineEditVisible()const { return m_shLne; }; 136 bool isLineEditVisible()const { return m_shLne; };
137 bool isChooserVisible( )const { return m_shChooser; }; 137 bool isChooserVisible( )const { return m_shChooser; };
138 bool isYesCancelVisible()const { return m_shYesNo; }; 138 bool isYesCancelVisible()const { return m_shYesNo; };
139 void setYesCancelVisible( bool show ); 139 void setYesCancelVisible( bool show );
140 void setToolbarVisible( bool show ); 140 void setToolbarVisible( bool show );
141 void setPermissionBarVisible( bool show ); 141 void setPermissionBarVisible( bool show );
142 void setLineEditVisible(bool show) ; 142 void setLineEditVisible(bool show) ;
143 void setChooserVisible( bool chooser ); 143 void setChooserVisible( bool chooser );
144 144
145 QCheckBox* permissionCheckbox(); 145 QCheckBox* permissionCheckbox();
146 bool setPermission() const; 146 bool setPermission() const;
147 void setPermissionChecked( bool check ); 147 void setPermissionChecked( bool check );
148 148
149 void setMode( int ); 149 void setMode( int );
150 150
151 bool showDirs()const { return m_dir; } 151 bool showDirs()const { return m_dir; }
152 void setShowDirs(bool ); 152 void setShowDirs(bool );
153 153
154 const QListView* listView() { return m_View; }; 154 const QListView* listView() { return m_View; };
155 155
156 bool isCaseSensetive()const { return m_case; } 156 bool isCaseSensetive()const { return m_case; }
157 void setCaseSensetive(bool caSe ); 157 void setCaseSensetive(bool caSe );
158 158
159 bool showFiles()const { return m_files; }; 159 bool showFiles()const { return m_files; };
160 void setShowFiles(bool ); 160 void setShowFiles(bool );
161 bool cd(const QString &path ); 161 bool cd(const QString &path );
162 162
163 163
164 int mode()const { return m_mode; }; 164 int mode()const { return m_mode; };
165 int selector()const { return m_selector; }; 165 int selector()const { return m_selector; };
166 void setSelector( int ); 166 void setSelector( int );
167 167
168 bool showPopup()const { return m_showPopup; }; 168 bool showPopup()const { return m_showPopup; };
169 void setShowPopup( bool pop ) { m_showPopup = pop; }; 169 void setShowPopup( bool pop ) { m_showPopup = pop; };
170 void setPopupMenu( QPopupMenu * ); 170 void setPopupMenu( QPopupMenu * );
171 171
172 // void updateLay(); 172 // void updateLay();
173 173
174 void reparse(); // re reads the dir 174 void reparse(); // re reads the dir
175 175
176 QString selectedName( )const; 176 QString selectedName( )const;
177 QStringList selectedNames()const; 177 QStringList selectedNames()const;
178 178
179 QString selectedPath() const; 179 QString selectedPath() const;
180 QStringList selectedPaths() const; 180 QStringList selectedPaths() const;
181 181
182 QString directory()const; 182 QString directory()const;
183 int fileCount(); 183 int fileCount() const;
184 184
185 /* the user needs to delete it */ 185 /* the user needs to delete it */
186 DocLnk selectedDocument()const; 186 DocLnk selectedDocument()const;
187 /* the user needs to delete it */ 187 /* the user needs to delete it */
188 QValueList<DocLnk> selectedDocuments()const; 188 QValueList<DocLnk> selectedDocuments()const;
189 189
190 signals: 190 signals:
191 void fileSelected( const DocLnk & ); 191 void fileSelected( const DocLnk & );
192 void fileSelected( const QString & ); 192 void fileSelected( const QString & );
193 void dirSelected(const QString &dir ); 193 void dirSelected(const QString &dir );
194 void closeMe(); 194 void closeMe();
195 void ok(); 195 void ok();
196 void cancel(); 196 void cancel();
197 void contextMenu(); 197 void contextMenu();
198 198
199 private slots: 199 private slots:
200 void slotTest() { qWarning("slotTest" ); setLineEditVisible(false ); }; 200 void slotTest() { qWarning("slotTest" ); setLineEditVisible(false ); };
201 void slotOk(); 201 void slotOk();
202 void slotCancel(); 202 void slotCancel();
203 void slotViewCheck(const QString & ); 203 void slotViewCheck(const QString & );
204 void slotMimeCheck(const QString & ); 204 void slotMimeCheck(const QString & );
205 void slotLocationActivated(const QString & ); 205 void slotLocationActivated(const QString & );
206 void slotInsertLocationPath(const QString &, int); 206 void slotInsertLocationPath(const QString &, int);
207 void locationComboChanged(); 207 void locationComboChanged();
208 208
209 private: 209 private:
210 void init(); 210 void init();
211 void updateMimes(); 211 void updateMimes();
212 212
213 protected: 213 protected:
214 214
215 private: 215 private:
216 int m_mode, m_selector; 216 int m_mode, m_selector;
217 QComboBox *m_location, *m_mimeCheck, *m_viewCheck; 217 QComboBox *m_location, *m_mimeCheck, *m_viewCheck;
218 QPushButton *m_homeButton, *m_docButton, *m_hideButton, *m_ok, *m_cancel; 218 QPushButton *m_homeButton, *m_docButton, *m_hideButton, *m_ok, *m_cancel;
219 QPushButton *m_reread, *m_up, *m_new, *m_close; 219 QPushButton *m_reread, *m_up, *m_new, *m_close;
220 QListView *m_View; 220 QListView *m_View;
221 QCheckBox *m_checkPerm; 221 QCheckBox *m_checkPerm;
222 QWidget *m_pseudo; 222 QWidget *m_pseudo;
223 QVBoxLayout *m_pseudoLayout; 223 QVBoxLayout *m_pseudoLayout;
224 224
225 QString m_currentDir; 225 QString m_currentDir;
226 QString m_name; 226 QString m_name;
227// QStringList m_mimetypes; 227// QStringList m_mimetypes;
228 QMap<QString, QStringList> m_mimetypes; 228 QMap<QString, QStringList> m_mimetypes;
229 229
230 FileSelector *m_select; 230 FileSelector *m_select;
231 QWidgetStack *m_stack; 231 QWidgetStack *m_stack;
diff --git a/libopie/ofileselector/odefaultfactories.cpp b/libopie/ofileselector/odefaultfactories.cpp
index c8efffb..2f8ef9b 100644
--- a/libopie/ofileselector/odefaultfactories.cpp
+++ b/libopie/ofileselector/odefaultfactories.cpp
@@ -1,23 +1,19 @@
1#include "ofilelistview.h" 1#include "ofilelistview.h"
2#include "ofileiconview.h"
3#include "olocallister.h" 2#include "olocallister.h"
4 3
5 4
6#include "odefaultfactories.h" 5#include "odefaultfactories.h"
7 6
8extern "C" { 7extern "C" {
9 8
10 9
11 OFileView* newFileIconView( OFileSelector* sel, QWidget* parent ) {
12 return new OFileIconView( parent, sel );
13 }
14 10
15 OFileView* newFileListView( OFileSelector* sel, QWidget* par ) { 11 OFileView* newFileListView( OFileSelector* sel, QWidget* par ) {
16 return new OFileListView(par, sel ); 12 return new OFileListView(par, sel );
17 } 13 }
18 14
19 OLister* newLocalLister( OFileSelector* sel) { 15 OLister* newLocalLister( OFileSelector* sel) {
20 return new OLocalLister( sel ); 16 return new OLocalLister( sel );
21 } 17 }
22 18
23}; 19};
diff --git a/libopie/ofileselector/odefaultfactories.h b/libopie/ofileselector/odefaultfactories.h
index b4c35af..0cc90e5 100644
--- a/libopie/ofileselector/odefaultfactories.h
+++ b/libopie/ofileselector/odefaultfactories.h
@@ -1,17 +1,16 @@
1#ifndef OPIE_DEFAULT_FACTORIES_H 1#ifndef OPIE_DEFAULT_FACTORIES_H
2#define OPIE_DEFAULT_FACTORIES_H 2#define OPIE_DEFAULT_FACTORIES_H
3 3
4#include "ofilefactory.h" 4#include "ofilefactory.h"
5 5
6extern "C" { 6extern "C" {
7 7
8 OFileView* newFileIconView( OFileSelector*, QWidget* parent );
9 OFileView* newFileListView( OFileSelector*, QWidget* parent ); 8 OFileView* newFileListView( OFileSelector*, QWidget* parent );
10 9
11 OLister* newLocalLister(OFileSelector* ); 10 OLister* newLocalLister(OFileSelector* );
12 11
13 12
14}; 13};
15 14
16 15
17#endif 16#endif
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp
index c6e923f..abc2889 100644
--- a/libopie/ofileselector/ofileselector.cpp
+++ b/libopie/ofileselector/ofileselector.cpp
@@ -931,97 +931,98 @@ void OFileSelector::setLister(const QString& lister) {
931 /* 931 /*
932 * if we do not have a lister 932 * if we do not have a lister
933 * we need to take the default one 933 * we need to take the default one
934 */ 934 */
935 m_lister = new OLocalLister(this); 935 m_lister = new OLocalLister(this);
936 } 936 }
937 m_listerName = lister; 937 m_listerName = lister;
938} 938}
939void OFileSelector::setView( const QString& lis ) { 939void OFileSelector::setView( const QString& lis ) {
940 qWarning("setView "); 940 qWarning("setView ");
941 fillList(); 941 fillList();
942 if ( lis == tr("Documents") ) { 942 if ( lis == tr("Documents") ) {
943 m_selector = Normal; 943 m_selector = Normal;
944 delete m_lister; 944 delete m_lister;
945 delete m_fileView; 945 delete m_fileView;
946 m_lister = 0l; 946 m_lister = 0l;
947 m_fileView = 0l; 947 m_fileView = 0l;
948 initializeOldSelector(); 948 initializeOldSelector();
949 }else { 949 }else {
950 qWarning("lis %s", lis.latin1() ); 950 qWarning("lis %s", lis.latin1() );
951 QString list; 951 QString list;
952 952
953 delete m_lister; 953 delete m_lister;
954 delete m_fileView; 954 delete m_fileView;
955 delete m_select; 955 delete m_select;
956 m_lister =0l; 956 m_lister =0l;
957 m_fileView = 0l; 957 m_fileView = 0l;
958 m_select = 0l; 958 m_select = 0l;
959 if ( lis.startsWith("All") ) { 959 if ( lis.startsWith("All") ) {
960 m_selector = ExtendedAll; 960 m_selector = ExtendedAll;
961 list = lis.mid(4 ).stripWhiteSpace(); 961 list = lis.mid(4 ).stripWhiteSpace();
962 } else{ 962 } else{
963 list = lis; 963 list = lis;
964 m_selector = Extended; 964 m_selector = Extended;
965 } 965 }
966 setLister(m_listerName); 966 setLister(m_listerName);
967 m_fileView = factory()->view( list, this, m_mainView ); 967 m_fileView = factory()->view( list, this, m_mainView );
968 m_mainView->setWidget( m_fileView->widget() ); 968 m_mainView->setWidget( m_fileView->widget() );
969 reparse(); 969 reparse();
970 } 970 }
971} 971}
972/* 972/*
973 * the factory 973 * the factory
974 */ 974 */
975void OFileSelector::initFactory() { 975void OFileSelector::initFactory() {
976 m_fileFactory = new OFileFactory(); 976 m_fileFactory = new OFileFactory();
977 m_fileFactory->addLister(tr("Files"), newLocalLister ); 977 m_fileFactory->addLister(tr("Files"), newLocalLister );
978 m_fileFactory->addView(tr("List View"), newFileListView ); 978 m_fileFactory->addView(tr("List View"), newFileListView );
979 m_fileFactory->addView(tr("Documents"), newFileIconView ); 979 /* dummy entry */
980 m_fileFactory->addView(tr("Documents"), newFileListView );
980} 981}
981 982
982void OFileSelector::fillList() { 983void OFileSelector::fillList() {
983 qWarning("fill list"); 984 qWarning("fill list");
984 if (!m_viewCheck ) 985 if (!m_viewCheck )
985 return; 986 return;
986 987
987 m_viewCheck->clear(); 988 m_viewCheck->clear();
988 QStringList list = factory()->views(); 989 QStringList list = factory()->views();
989 qWarning("views: " + list.join(";") ); 990 qWarning("views: " + list.join(";") );
990 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 991 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
991 qWarning( (*it) ); 992 qWarning( (*it) );
992 if ( (*it) == tr("Documents") ) { 993 if ( (*it) == tr("Documents") ) {
993 m_viewCheck->insertItem( (*it) ); 994 m_viewCheck->insertItem( (*it) );
994 }else{ 995 }else{
995 m_viewCheck->insertItem( (*it) ); 996 m_viewCheck->insertItem( (*it) );
996 m_viewCheck->insertItem( tr("All ") + (*it) ); 997 m_viewCheck->insertItem( tr("All ") + (*it) );
997 } 998 }
998 } 999 }
999} 1000}
1000OFileFactory* OFileSelector::factory() { 1001OFileFactory* OFileSelector::factory() {
1001 return m_fileFactory; 1002 return m_fileFactory;
1002} 1003}
1003 1004
1004 1005
1005OFileView* OFileSelector::currentView() { 1006OFileView* OFileSelector::currentView() {
1006 return m_fileView; 1007 return m_fileView;
1007} 1008}
1008OFileView* OFileSelector::currentView() const{ 1009OFileView* OFileSelector::currentView() const{
1009 return m_fileView; 1010 return m_fileView;
1010} 1011}
1011int OFileSelector::filter() { 1012int OFileSelector::filter() {
1012 int filter; 1013 int filter;
1013 if ( m_selector == ExtendedAll ) 1014 if ( m_selector == ExtendedAll )
1014 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 1015 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
1015 else 1016 else
1016 filter = QDir::Files | QDir::Dirs | QDir::All ; 1017 filter = QDir::Files | QDir::Dirs | QDir::All ;
1017 1018
1018 return filter; 1019 return filter;
1019} 1020}
1020int OFileSelector::sorting() { 1021int OFileSelector::sorting() {
1021 int sort; 1022 int sort;
1022 1023
1023 if (m_case ) 1024 if (m_case )
1024 sort = ( QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed ); 1025 sort = ( QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed );
1025 else 1026 else
1026 sort = ( QDir::Name | QDir::DirsFirst | QDir::Reversed ); 1027 sort = ( QDir::Name | QDir::DirsFirst | QDir::Reversed );
1027 1028
diff --git a/libopie/pim/opimaccessbackend.h b/libopie/pim/opimaccessbackend.h
index 0bd2723..4f00bc9 100644
--- a/libopie/pim/opimaccessbackend.h
+++ b/libopie/pim/opimaccessbackend.h
@@ -12,130 +12,130 @@
12 * for all private backends 12 * for all private backends
13 * it operates on OPimRecord as the base class 13 * it operates on OPimRecord as the base class
14 * and it's responsible for fast manipulating 14 * and it's responsible for fast manipulating
15 * the resource the implementation takes care 15 * the resource the implementation takes care
16 * of 16 * of
17 */ 17 */
18template <class T = OPimRecord> 18template <class T = OPimRecord>
19class OPimAccessBackend { 19class OPimAccessBackend {
20public: 20public:
21 typedef OTemplateBase<T> Frontend; 21 typedef OTemplateBase<T> Frontend;
22 OPimAccessBackend(); 22 OPimAccessBackend();
23 virtual ~OPimAccessBackend(); 23 virtual ~OPimAccessBackend();
24 24
25 /** 25 /**
26 * load the resource 26 * load the resource
27 */ 27 */
28 virtual bool load() = 0; 28 virtual bool load() = 0;
29 29
30 /** 30 /**
31 * reload the resource 31 * reload the resource
32 */ 32 */
33 virtual bool reload() = 0; 33 virtual bool reload() = 0;
34 34
35 /** 35 /**
36 * save the resource and 36 * save the resource and
37 * all it's changes 37 * all it's changes
38 */ 38 */
39 virtual bool save() = 0; 39 virtual bool save() = 0;
40 40
41 /** 41 /**
42 * return an array of 42 * return an array of
43 * all available uids 43 * all available uids
44 */ 44 */
45 virtual QArray<int> allRecords()const = 0; 45 virtual QArray<int> allRecords()const = 0;
46 46
47 /** 47 /**
48 * queryByExample for T with the SortOrder 48 * queryByExample for T with the SortOrder
49 * sort 49 * sort
50 */ 50 */
51 virtual QArray<int> queryByExample( const T& t, int sort ) = 0; 51 virtual QArray<int> queryByExample( const T& t, int sort ) = 0;
52 52
53 /** 53 /**
54 * find the OPimRecord with uid @param uid 54 * find the OPimRecord with uid @param uid
55 * returns T and T.isEmpty() if nothing was found 55 * returns T and T.isEmpty() if nothing was found
56 */ 56 */
57 virtual T find(int uid )const = 0; 57 virtual T find(int uid )const = 0;
58 58
59 virtual T find(int uid, const QArray<int>& items, 59 virtual T find(int uid, const QArray<int>& items,
60 uint current, Frontend::CacheDirection )const ; 60 uint current, typename Frontend::CacheDirection )const ;
61 /** 61 /**
62 * clear the back end 62 * clear the back end
63 */ 63 */
64 virtual void clear() = 0; 64 virtual void clear() = 0;
65 65
66 /** 66 /**
67 * add T 67 * add T
68 */ 68 */
69 virtual bool add( const T& t ) = 0; 69 virtual bool add( const T& t ) = 0;
70 70
71 /** 71 /**
72 * remove 72 * remove
73 */ 73 */
74 virtual bool remove( int uid ) = 0; 74 virtual bool remove( int uid ) = 0;
75 75
76 /** 76 /**
77 * replace a record with T.uid() 77 * replace a record with T.uid()
78 */ 78 */
79 virtual bool replace( const T& t ) = 0; 79 virtual bool replace( const T& t ) = 0;
80 80
81 /* 81 /*
82 * setTheFrontEnd!!! 82 * setTheFrontEnd!!!
83 */ 83 */
84 void setFrontend( Frontend* front ); 84 void setFrontend( Frontend* front );
85 85
86 /** 86 /**
87 * set the read ahead count 87 * set the read ahead count
88 */ 88 */
89 void setReadAhead( uint count ); 89 void setReadAhead( uint count );
90protected: 90protected:
91 void cache( const T& t )const; 91 void cache( const T& t )const;
92 92
93 /** 93 /**
94 * use a prime number here! 94 * use a prime number here!
95 */ 95 */
96 void setSaneCacheSize( int ); 96 void setSaneCacheSize( int );
97 97
98 uint readAhead()const; 98 uint readAhead()const;
99 99
100private: 100private:
101 Frontend* m_front; 101 Frontend* m_front;
102 uint m_read; 102 uint m_read;
103 103
104}; 104};
105 105
106template <class T> 106template <class T>
107OPimAccessBackend<T>::OPimAccessBackend() { 107OPimAccessBackend<T>::OPimAccessBackend() {
108 m_front = 0l; 108 m_front = 0l;
109} 109}
110template <class T> 110template <class T>
111OPimAccessBackend<T>::~OPimAccessBackend() { 111OPimAccessBackend<T>::~OPimAccessBackend() {
112 112
113} 113}
114template <class T> 114template <class T>
115void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { 115void OPimAccessBackend<T>::setFrontend( Frontend* fr ) {
116 m_front = fr; 116 m_front = fr;
117} 117}
118template <class T> 118template <class T>
119void OPimAccessBackend<T>::cache( const T& t )const { 119void OPimAccessBackend<T>::cache( const T& t )const {
120 if (m_front ) 120 if (m_front )
121 m_front->cache( t ); 121 m_front->cache( t );
122} 122}
123template <class T> 123template <class T>
124void OPimAccessBackend<T>::setSaneCacheSize( int size) { 124void OPimAccessBackend<T>::setSaneCacheSize( int size) {
125 if (m_front ) 125 if (m_front )
126 m_front->setSaneCacheSize( size ); 126 m_front->setSaneCacheSize( size );
127} 127}
128template <class T> 128template <class T>
129T OPimAccessBackend<T>::find( int uid, const QArray<int>&, 129T OPimAccessBackend<T>::find( int uid, const QArray<int>&,
130 uint, Frontend::CacheDirection )const { 130 uint, typename Frontend::CacheDirection )const {
131 return find( uid ); 131 return find( uid );
132} 132}
133template <class T> 133template <class T>
134void OPimAccessBackend<T>::setReadAhead( uint count ) { 134void OPimAccessBackend<T>::setReadAhead( uint count ) {
135 m_read = count; 135 m_read = count;
136} 136}
137template <class T> 137template <class T>
138uint OPimAccessBackend<T>::readAhead()const { 138uint OPimAccessBackend<T>::readAhead()const {
139 return m_read; 139 return m_read;
140} 140}
141#endif 141#endif
diff --git a/libopie/pim/opimaccesstemplate.h b/libopie/pim/opimaccesstemplate.h
index c5523a8..6de68b1 100644
--- a/libopie/pim/opimaccesstemplate.h
+++ b/libopie/pim/opimaccesstemplate.h
@@ -34,226 +34,226 @@ public:
34 34
35 /** 35 /**
36 * load from the backend 36 * load from the backend
37 */ 37 */
38 virtual bool load(); 38 virtual bool load();
39 39
40 /** Reload database. 40 /** Reload database.
41 * You should execute this function if the external database 41 * You should execute this function if the external database
42 * was changed. 42 * was changed.
43 * This function will load the external database and afterwards 43 * This function will load the external database and afterwards
44 * rejoin the local changes. Therefore the local database will be set consistent. 44 * rejoin the local changes. Therefore the local database will be set consistent.
45 */ 45 */
46 virtual bool reload(); 46 virtual bool reload();
47 47
48 /** Save contacts database. 48 /** Save contacts database.
49 * Save is more a "commit". After calling this function, all changes are public available. 49 * Save is more a "commit". After calling this function, all changes are public available.
50 * @return true if successful 50 * @return true if successful
51 */ 51 */
52 virtual bool save(); 52 virtual bool save();
53 53
54 /** 54 /**
55 * if the resource was changed externally 55 * if the resource was changed externally
56 * You should use the signal handling instead of polling possible changes ! 56 * You should use the signal handling instead of polling possible changes !
57 * zecke: Do you implement a signal for otodoaccess ? 57 * zecke: Do you implement a signal for otodoaccess ?
58 */ 58 */
59 bool wasChangedExternally()const; 59 bool wasChangedExternally()const;
60 60
61 /** 61 /**
62 * return a List of records 62 * return a List of records
63 * you can iterate over them 63 * you can iterate over them
64 */ 64 */
65 virtual List allRecords()const; 65 virtual List allRecords()const;
66 66
67 /** 67 /**
68 * queryByExample. 68 * queryByExample.
69 * @see otodoaccess, ocontactaccess 69 * @see otodoaccess, ocontactaccess
70 */ 70 */
71 virtual List queryByExample( const T& t, int querySettings ); 71 virtual List queryByExample( const T& t, int querySettings );
72 72
73 /** 73 /**
74 * find the OPimRecord uid 74 * find the OPimRecord uid
75 */ 75 */
76 virtual T find( int uid )const; 76 virtual T find( int uid )const;
77 77
78 /** 78 /**
79 * read ahead cache find method ;) 79 * read ahead cache find method ;)
80 */ 80 */
81 virtual T find( int uid, const QArray<int>&, 81 virtual T find( int uid, const QArray<int>&,
82 uint current, CacheDirection dir = Forward )const; 82 uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const;
83 83
84 /* invalidate cache here */ 84 /* invalidate cache here */
85 /** 85 /**
86 * clears the backend and invalidates the backend 86 * clears the backend and invalidates the backend
87 */ 87 */
88 virtual void clear() ; 88 virtual void clear() ;
89 89
90 /** 90 /**
91 * add T to the backend 91 * add T to the backend
92 * @param t The item to add. 92 * @param t The item to add.
93 * @return <i>true</i> if added successfully. 93 * @return <i>true</i> if added successfully.
94 */ 94 */
95 virtual bool add( const T& t ) ; 95 virtual bool add( const T& t ) ;
96 96
97 /* only the uid matters */ 97 /* only the uid matters */
98 /** 98 /**
99 * remove T from the backend 99 * remove T from the backend
100 * @param t The item to remove 100 * @param t The item to remove
101 * @return <i>true</i> if successful. 101 * @return <i>true</i> if successful.
102 */ 102 */
103 virtual bool remove( const T& t ); 103 virtual bool remove( const T& t );
104 104
105 /** 105 /**
106 * remove the OPimRecord with uid 106 * remove the OPimRecord with uid
107 * @param uid The ID of the item to remove 107 * @param uid The ID of the item to remove
108 * @return <i>true</i> if successful. 108 * @return <i>true</i> if successful.
109 */ 109 */
110 virtual bool remove( int uid ); 110 virtual bool remove( int uid );
111 111
112 /** 112 /**
113 * replace T from backend 113 * replace T from backend
114 * @param t The item to replace 114 * @param t The item to replace
115 * @return <i>true</i> if successful. 115 * @return <i>true</i> if successful.
116 */ 116 */
117 virtual bool replace( const T& t) ; 117 virtual bool replace( const T& t) ;
118 118
119 void setReadAhead( uint count ); 119 void setReadAhead( uint count );
120 /** 120 /**
121 * @internal 121 * @internal
122 */ 122 */
123 void cache( const T& )const; 123 void cache( const T& )const;
124 void setSaneCacheSize( int ); 124 void setSaneCacheSize( int );
125protected: 125protected:
126 /** 126 /**
127 * invalidate the cache 127 * invalidate the cache
128 */ 128 */
129 void invalidateCache(); 129 void invalidateCache();
130 130
131 void setBackEnd( BackEnd* end ); 131 void setBackEnd( BackEnd* end );
132 /** 132 /**
133 * returns the backend 133 * returns the backend
134 */ 134 */
135 BackEnd* backEnd(); 135 BackEnd* backEnd();
136 BackEnd* m_backEnd; 136 BackEnd* m_backEnd;
137 Cache m_cache; 137 Cache m_cache;
138 138
139}; 139};
140 140
141template <class T> 141template <class T>
142OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) 142OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end )
143 : OTemplateBase<T>(), m_backEnd( end ) 143 : OTemplateBase<T>(), m_backEnd( end )
144{ 144{
145 if (end ) 145 if (end )
146 end->setFrontend( this ); 146 end->setFrontend( this );
147} 147}
148template <class T> 148template <class T>
149OPimAccessTemplate<T>::~OPimAccessTemplate() { 149OPimAccessTemplate<T>::~OPimAccessTemplate() {
150 qWarning("~OPimAccessTemplate<T>"); 150 qWarning("~OPimAccessTemplate<T>");
151 delete m_backEnd; 151 delete m_backEnd;
152} 152}
153template <class T> 153template <class T>
154bool OPimAccessTemplate<T>::load() { 154bool OPimAccessTemplate<T>::load() {
155 invalidateCache(); 155 invalidateCache();
156 return m_backEnd->load(); 156 return m_backEnd->load();
157} 157}
158template <class T> 158template <class T>
159bool OPimAccessTemplate<T>::reload() { 159bool OPimAccessTemplate<T>::reload() {
160 invalidateCache(); // zecke: I think this should be added (se) 160 invalidateCache(); // zecke: I think this should be added (se)
161 return m_backEnd->reload(); 161 return m_backEnd->reload();
162} 162}
163template <class T> 163template <class T>
164bool OPimAccessTemplate<T>::save() { 164bool OPimAccessTemplate<T>::save() {
165 return m_backEnd->save(); 165 return m_backEnd->save();
166} 166}
167template <class T> 167template <class T>
168OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { 168typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const {
169 QArray<int> ints = m_backEnd->allRecords(); 169 QArray<int> ints = m_backEnd->allRecords();
170 List lis(ints, this ); 170 List lis(ints, this );
171 return lis; 171 return lis;
172} 172}
173template <class T> 173template <class T>
174OPimAccessTemplate<T>::List 174typename OPimAccessTemplate<T>::List
175OPimAccessTemplate<T>::queryByExample( const T& t, int sortOrder ) { 175OPimAccessTemplate<T>::queryByExample( const T& t, int sortOrder ) {
176 QArray<int> ints = m_backEnd->queryByExample( t, sortOrder ); 176 QArray<int> ints = m_backEnd->queryByExample( t, sortOrder );
177 177
178 List lis(ints, this ); 178 List lis(ints, this );
179 return lis; 179 return lis;
180} 180}
181template <class T> 181template <class T>
182T OPimAccessTemplate<T>::find( int uid ) const{ 182T OPimAccessTemplate<T>::find( int uid ) const{
183 T t = m_backEnd->find( uid ); 183 T t = m_backEnd->find( uid );
184 cache( t ); 184 cache( t );
185 return t; 185 return t;
186} 186}
187template <class T> 187template <class T>
188T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar, 188T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar,
189 uint current, CacheDirection dir )const { 189 uint current, typename OTemplateBase<T>::CacheDirection dir )const {
190 /* 190 /*
191 * better do T.isEmpty() 191 * better do T.isEmpty()
192 * after a find this way we would 192 * after a find this way we would
193 * avoid two finds in QCache... 193 * avoid two finds in QCache...
194 */ 194 */
195 // qWarning("find it now %d", uid ); 195 // qWarning("find it now %d", uid );
196 if (m_cache.contains( uid ) ) { 196 if (m_cache.contains( uid ) ) {
197 return m_cache.find( uid ); 197 return m_cache.find( uid );
198 } 198 }
199 199
200 T t = m_backEnd->find( uid, ar, current, dir ); 200 T t = m_backEnd->find( uid, ar, current, dir );
201 cache( t ); 201 cache( t );
202 return t; 202 return t;
203} 203}
204template <class T> 204template <class T>
205void OPimAccessTemplate<T>::clear() { 205void OPimAccessTemplate<T>::clear() {
206 invalidateCache(); 206 invalidateCache();
207 m_backEnd->clear(); 207 m_backEnd->clear();
208} 208}
209template <class T> 209template <class T>
210bool OPimAccessTemplate<T>::add( const T& t ) { 210bool OPimAccessTemplate<T>::add( const T& t ) {
211 cache( t ); 211 cache( t );
212 return m_backEnd->add( t ); 212 return m_backEnd->add( t );
213} 213}
214template <class T> 214template <class T>
215bool OPimAccessTemplate<T>::remove( const T& t ) { 215bool OPimAccessTemplate<T>::remove( const T& t ) {
216 return remove( t.uid() ); 216 return remove( t.uid() );
217} 217}
218template <class T> 218template <class T>
219bool OPimAccessTemplate<T>::remove( int uid ) { 219bool OPimAccessTemplate<T>::remove( int uid ) {
220 m_cache.remove( uid ); 220 m_cache.remove( uid );
221 return m_backEnd->remove( uid ); 221 return m_backEnd->remove( uid );
222} 222}
223template <class T> 223template <class T>
224bool OPimAccessTemplate<T>::replace( const T& t ) { 224bool OPimAccessTemplate<T>::replace( const T& t ) {
225 m_cache.replace( t ); 225 m_cache.replace( t );
226 return m_backEnd->replace( t ); 226 return m_backEnd->replace( t );
227} 227}
228template <class T> 228template <class T>
229void OPimAccessTemplate<T>::invalidateCache() { 229void OPimAccessTemplate<T>::invalidateCache() {
230 m_cache.invalidate(); 230 m_cache.invalidate();
231} 231}
232template <class T> 232template <class T>
233OPimAccessTemplate<T>::BackEnd* OPimAccessTemplate<T>::backEnd() { 233typename OPimAccessTemplate<T>::BackEnd* OPimAccessTemplate<T>::backEnd() {
234 return m_backEnd; 234 return m_backEnd;
235} 235}
236template <class T> 236template <class T>
237bool OPimAccessTemplate<T>::wasChangedExternally()const { 237bool OPimAccessTemplate<T>::wasChangedExternally()const {
238 return false; 238 return false;
239} 239}
240template <class T> 240template <class T>
241void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) { 241void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) {
242 m_backEnd = end; 242 m_backEnd = end;
243 if (m_backEnd ) 243 if (m_backEnd )
244 m_backEnd->setFrontend( this ); 244 m_backEnd->setFrontend( this );
245} 245}
246template <class T> 246template <class T>
247void OPimAccessTemplate<T>::cache( const T& t ) const{ 247void OPimAccessTemplate<T>::cache( const T& t ) const{
248 /* hacky we need to work around the const*/ 248 /* hacky we need to work around the const*/
249 ((OPimAccessTemplate<T>*)this)->m_cache.add( t ); 249 ((OPimAccessTemplate<T>*)this)->m_cache.add( t );
250} 250}
251template <class T> 251template <class T>
252void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { 252void OPimAccessTemplate<T>::setSaneCacheSize( int size ) {
253 m_cache.setSize( size ); 253 m_cache.setSize( size );
254} 254}
255template <class T> 255template <class T>
256void OPimAccessTemplate<T>::setReadAhead( uint count ) { 256void OPimAccessTemplate<T>::setReadAhead( uint count ) {
257 m_backEnd->setReadAhead( count ); 257 m_backEnd->setReadAhead( count );
258} 258}
259#endif 259#endif
diff --git a/libopie/pim/orecordlist.h b/libopie/pim/orecordlist.h
index 8ed41e2..b77a4ab 100644
--- a/libopie/pim/orecordlist.h
+++ b/libopie/pim/orecordlist.h
@@ -202,99 +202,99 @@ template <class T>
202bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { 202bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) {
203 203
204 /* if both are at we're the same.... */ 204 /* if both are at we're the same.... */
205 if ( m_end == it.m_end ) return true; 205 if ( m_end == it.m_end ) return true;
206 206
207 if ( m_uids != it.m_uids ) return false; 207 if ( m_uids != it.m_uids ) return false;
208 if ( m_current != it.m_current ) return false; 208 if ( m_current != it.m_current ) return false;
209 if ( m_temp != it.m_temp ) return false; 209 if ( m_temp != it.m_temp ) return false;
210 210
211 return true; 211 return true;
212} 212}
213template <class T> 213template <class T>
214bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { 214bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) {
215 return !(*this == it ); 215 return !(*this == it );
216} 216}
217template <class T> 217template <class T>
218ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, 218ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids,
219 const Base* t ) 219 const Base* t )
220 : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ), 220 : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ),
221 m_direction( false ) 221 m_direction( false )
222{ 222{
223} 223}
224template <class T> 224template <class T>
225uint ORecordListIterator<T>::current()const { 225uint ORecordListIterator<T>::current()const {
226 return m_current; 226 return m_current;
227} 227}
228template <class T> 228template <class T>
229void ORecordListIterator<T>::setCurrent( uint cur ) { 229void ORecordListIterator<T>::setCurrent( uint cur ) {
230 if( cur < m_uids.count() ) { 230 if( cur < m_uids.count() ) {
231 m_end = false; 231 m_end = false;
232 m_current= cur; 232 m_current= cur;
233 } 233 }
234} 234}
235template <class T> 235template <class T>
236uint ORecordListIterator<T>::count()const { 236uint ORecordListIterator<T>::count()const {
237 return m_uids.count(); 237 return m_uids.count();
238} 238}
239template <class T> 239template <class T>
240ORecordList<T>::ORecordList( const QArray<int>& ids, 240ORecordList<T>::ORecordList( const QArray<int>& ids,
241 const Base* acc ) 241 const Base* acc )
242 : m_ids( ids ), m_acc( acc ) 242 : m_ids( ids ), m_acc( acc )
243{ 243{
244} 244}
245template <class T> 245template <class T>
246ORecordList<T>::~ORecordList() { 246ORecordList<T>::~ORecordList() {
247/* nothing to do here */ 247/* nothing to do here */
248} 248}
249template <class T> 249template <class T>
250ORecordList<T>::Iterator ORecordList<T>::begin() { 250typename ORecordList<T>::Iterator ORecordList<T>::begin() {
251 Iterator it( m_ids, m_acc ); 251 Iterator it( m_ids, m_acc );
252 return it; 252 return it;
253} 253}
254template <class T> 254template <class T>
255ORecordList<T>::Iterator ORecordList<T>::end() { 255typename ORecordList<T>::Iterator ORecordList<T>::end() {
256 Iterator it( m_ids, m_acc ); 256 Iterator it( m_ids, m_acc );
257 it.m_end = true; 257 it.m_end = true;
258 it.m_current = m_ids.count(); 258 it.m_current = m_ids.count();
259 259
260 return it; 260 return it;
261} 261}
262template <class T> 262template <class T>
263uint ORecordList<T>::count()const { 263uint ORecordList<T>::count()const {
264return m_ids.count(); 264return m_ids.count();
265} 265}
266template <class T> 266template <class T>
267T ORecordList<T>::operator[]( uint i ) { 267T ORecordList<T>::operator[]( uint i ) {
268 if ( i < 0 || (i+1) > m_ids.count() ) 268 if ( i < 0 || (i+1) > m_ids.count() )
269 return T(); 269 return T();
270 /* forward */ 270 /* forward */
271 return m_acc->find( m_ids[i], m_ids, i ); 271 return m_acc->find( m_ids[i], m_ids, i );
272} 272}
273template <class T> 273template <class T>
274int ORecordList<T>::uidAt( uint i ) { 274int ORecordList<T>::uidAt( uint i ) {
275 return m_ids[i]; 275 return m_ids[i];
276} 276}
277 277
278template <class T> 278template <class T>
279bool ORecordList<T>::remove( int uid ) { 279bool ORecordList<T>::remove( int uid ) {
280 QArray<int> copy( m_ids.count() ); 280 QArray<int> copy( m_ids.count() );
281 int counter = 0; 281 int counter = 0;
282 bool ret_val = false; 282 bool ret_val = false;
283 283
284 for (uint i = 0; i < m_ids.count(); i++){ 284 for (uint i = 0; i < m_ids.count(); i++){
285 if ( m_ids[i] != uid ){ 285 if ( m_ids[i] != uid ){
286 copy[counter++] = m_ids[i]; 286 copy[counter++] = m_ids[i];
287 287
288 }else 288 }else
289 ret_val = true; 289 ret_val = true;
290 } 290 }
291 291
292 copy.resize( counter ); 292 copy.resize( counter );
293 m_ids = copy; 293 m_ids = copy;
294 294
295 295
296 return ret_val; 296 return ret_val;
297} 297}
298 298
299 299
300#endif 300#endif
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp
index 0d5b1d3..4d5cb79 100644
--- a/libopie/pim/otodo.cpp
+++ b/libopie/pim/otodo.cpp
@@ -354,52 +354,52 @@ QMap<int, QString> OTodo::toMap() const {
354 map.insert( Description, data->desc ); 354 map.insert( Description, data->desc );
355 map.insert( Summary, data->sum ); 355 map.insert( Summary, data->sum );
356 map.insert( Priority, QString::number( data->priority ) ); 356 map.insert( Priority, QString::number( data->priority ) );
357 map.insert( DateDay, QString::number( data->date.day() ) ); 357 map.insert( DateDay, QString::number( data->date.day() ) );
358 map.insert( DateMonth, QString::number( data->date.month() ) ); 358 map.insert( DateMonth, QString::number( data->date.month() ) );
359 map.insert( DateYear, QString::number( data->date.year() ) ); 359 map.insert( DateYear, QString::number( data->date.year() ) );
360 map.insert( Progress, QString::number( data->prog ) ); 360 map.insert( Progress, QString::number( data->prog ) );
361 map.insert( CrossReference, crossToString() ); 361 map.insert( CrossReference, crossToString() );
362 map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) ); 362 map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) );
363 map.insert( AlarmDateTime, data->alarmDateTime.toString() ); 363 map.insert( AlarmDateTime, data->alarmDateTime.toString() );
364 364
365 return map; 365 return map;
366} 366}
367 367
368QMap<QString, QString> OTodo::toExtraMap()const { 368QMap<QString, QString> OTodo::toExtraMap()const {
369 return data->extra; 369 return data->extra;
370} 370}
371/** 371/**
372 * change or modify looks at the ref count and either 372 * change or modify looks at the ref count and either
373 * creates a new QShared Object or it can modify it 373 * creates a new QShared Object or it can modify it
374 * right in place 374 * right in place
375 */ 375 */
376void OTodo::changeOrModify() { 376void OTodo::changeOrModify() {
377 if ( data->count != 1 ) { 377 if ( data->count != 1 ) {
378 qWarning("changeOrModify"); 378 qWarning("changeOrModify");
379 data->deref(); 379 data->deref();
380 OTodoData* d2 = new OTodoData(); 380 OTodoData* d2 = new OTodoData();
381 copy(data, d2 ); 381 copy(data, d2 );
382 data = d2; 382 data = d2;
383 } 383 }
384} 384}
385void OTodo::copy( OTodoData* src, OTodoData* dest ) { 385void OTodo::copy( OTodoData* src, OTodoData* dest ) {
386 dest->date = src->date; 386 dest->date = src->date;
387 dest->isCompleted = src->isCompleted; 387 dest->isCompleted = src->isCompleted;
388 dest->hasDate = src->hasDate; 388 dest->hasDate = src->hasDate;
389 dest->priority = src->priority; 389 dest->priority = src->priority;
390 dest->desc = src->desc; 390 dest->desc = src->desc;
391 dest->sum = src->sum; 391 dest->sum = src->sum;
392 dest->extra = src->extra; 392 dest->extra = src->extra;
393 dest->prog = src->prog; 393 dest->prog = src->prog;
394 dest->hasAlarmDateTime = src->hasAlarmDateTime; 394 dest->hasAlarmDateTime = src->hasAlarmDateTime;
395 dest->alarmDateTime = src->alarmDateTime; 395 dest->alarmDateTime = src->alarmDateTime;
396 dest->state = src->state; 396 dest->state = src->state;
397 dest->recur = src->recur; 397 dest->recur = src->recur;
398} 398}
399QString OTodo::type() const { 399QString OTodo::type() const {
400 return QString::fromLatin1("OTodo"); 400 return QString::fromLatin1("OTodo");
401} 401}
402QString OTodo::recordField(int id )const { 402QString OTodo::recordField(int /*id*/ )const {
403 return QString::null; 403 return QString::null;
404} 404}
405 405
diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h
index 0bd2723..4f00bc9 100644
--- a/libopie2/opiepim/backend/opimaccessbackend.h
+++ b/libopie2/opiepim/backend/opimaccessbackend.h
@@ -12,130 +12,130 @@
12 * for all private backends 12 * for all private backends
13 * it operates on OPimRecord as the base class 13 * it operates on OPimRecord as the base class
14 * and it's responsible for fast manipulating 14 * and it's responsible for fast manipulating
15 * the resource the implementation takes care 15 * the resource the implementation takes care
16 * of 16 * of
17 */ 17 */
18template <class T = OPimRecord> 18template <class T = OPimRecord>
19class OPimAccessBackend { 19class OPimAccessBackend {
20public: 20public:
21 typedef OTemplateBase<T> Frontend; 21 typedef OTemplateBase<T> Frontend;
22 OPimAccessBackend(); 22 OPimAccessBackend();
23 virtual ~OPimAccessBackend(); 23 virtual ~OPimAccessBackend();
24 24
25 /** 25 /**
26 * load the resource 26 * load the resource
27 */ 27 */
28 virtual bool load() = 0; 28 virtual bool load() = 0;
29 29
30 /** 30 /**
31 * reload the resource 31 * reload the resource
32 */ 32 */
33 virtual bool reload() = 0; 33 virtual bool reload() = 0;
34 34
35 /** 35 /**
36 * save the resource and 36 * save the resource and
37 * all it's changes 37 * all it's changes
38 */ 38 */
39 virtual bool save() = 0; 39 virtual bool save() = 0;
40 40
41 /** 41 /**
42 * return an array of 42 * return an array of
43 * all available uids 43 * all available uids
44 */ 44 */
45 virtual QArray<int> allRecords()const = 0; 45 virtual QArray<int> allRecords()const = 0;
46 46
47 /** 47 /**
48 * queryByExample for T with the SortOrder 48 * queryByExample for T with the SortOrder
49 * sort 49 * sort
50 */ 50 */
51 virtual QArray<int> queryByExample( const T& t, int sort ) = 0; 51 virtual QArray<int> queryByExample( const T& t, int sort ) = 0;
52 52
53 /** 53 /**
54 * find the OPimRecord with uid @param uid 54 * find the OPimRecord with uid @param uid
55 * returns T and T.isEmpty() if nothing was found 55 * returns T and T.isEmpty() if nothing was found
56 */ 56 */
57 virtual T find(int uid )const = 0; 57 virtual T find(int uid )const = 0;
58 58
59 virtual T find(int uid, const QArray<int>& items, 59 virtual T find(int uid, const QArray<int>& items,
60 uint current, Frontend::CacheDirection )const ; 60 uint current, typename Frontend::CacheDirection )const ;
61 /** 61 /**
62 * clear the back end 62 * clear the back end
63 */ 63 */
64 virtual void clear() = 0; 64 virtual void clear() = 0;
65 65
66 /** 66 /**
67 * add T 67 * add T
68 */ 68 */
69 virtual bool add( const T& t ) = 0; 69 virtual bool add( const T& t ) = 0;
70 70
71 /** 71 /**
72 * remove 72 * remove
73 */ 73 */
74 virtual bool remove( int uid ) = 0; 74 virtual bool remove( int uid ) = 0;
75 75
76 /** 76 /**
77 * replace a record with T.uid() 77 * replace a record with T.uid()
78 */ 78 */
79 virtual bool replace( const T& t ) = 0; 79 virtual bool replace( const T& t ) = 0;
80 80
81 /* 81 /*
82 * setTheFrontEnd!!! 82 * setTheFrontEnd!!!
83 */ 83 */
84 void setFrontend( Frontend* front ); 84 void setFrontend( Frontend* front );
85 85
86 /** 86 /**
87 * set the read ahead count 87 * set the read ahead count
88 */ 88 */
89 void setReadAhead( uint count ); 89 void setReadAhead( uint count );
90protected: 90protected:
91 void cache( const T& t )const; 91 void cache( const T& t )const;
92 92
93 /** 93 /**
94 * use a prime number here! 94 * use a prime number here!
95 */ 95 */
96 void setSaneCacheSize( int ); 96 void setSaneCacheSize( int );
97 97
98 uint readAhead()const; 98 uint readAhead()const;
99 99
100private: 100private:
101 Frontend* m_front; 101 Frontend* m_front;
102 uint m_read; 102 uint m_read;
103 103
104}; 104};
105 105
106template <class T> 106template <class T>
107OPimAccessBackend<T>::OPimAccessBackend() { 107OPimAccessBackend<T>::OPimAccessBackend() {
108 m_front = 0l; 108 m_front = 0l;
109} 109}
110template <class T> 110template <class T>
111OPimAccessBackend<T>::~OPimAccessBackend() { 111OPimAccessBackend<T>::~OPimAccessBackend() {
112 112
113} 113}
114template <class T> 114template <class T>
115void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { 115void OPimAccessBackend<T>::setFrontend( Frontend* fr ) {
116 m_front = fr; 116 m_front = fr;
117} 117}
118template <class T> 118template <class T>
119void OPimAccessBackend<T>::cache( const T& t )const { 119void OPimAccessBackend<T>::cache( const T& t )const {
120 if (m_front ) 120 if (m_front )
121 m_front->cache( t ); 121 m_front->cache( t );
122} 122}
123template <class T> 123template <class T>
124void OPimAccessBackend<T>::setSaneCacheSize( int size) { 124void OPimAccessBackend<T>::setSaneCacheSize( int size) {
125 if (m_front ) 125 if (m_front )
126 m_front->setSaneCacheSize( size ); 126 m_front->setSaneCacheSize( size );
127} 127}
128template <class T> 128template <class T>
129T OPimAccessBackend<T>::find( int uid, const QArray<int>&, 129T OPimAccessBackend<T>::find( int uid, const QArray<int>&,
130 uint, Frontend::CacheDirection )const { 130 uint, typename Frontend::CacheDirection )const {
131 return find( uid ); 131 return find( uid );
132} 132}
133template <class T> 133template <class T>
134void OPimAccessBackend<T>::setReadAhead( uint count ) { 134void OPimAccessBackend<T>::setReadAhead( uint count ) {
135 m_read = count; 135 m_read = count;
136} 136}
137template <class T> 137template <class T>
138uint OPimAccessBackend<T>::readAhead()const { 138uint OPimAccessBackend<T>::readAhead()const {
139 return m_read; 139 return m_read;
140} 140}
141#endif 141#endif
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h
index c5523a8..6de68b1 100644
--- a/libopie2/opiepim/core/opimaccesstemplate.h
+++ b/libopie2/opiepim/core/opimaccesstemplate.h
@@ -34,226 +34,226 @@ public:
34 34
35 /** 35 /**
36 * load from the backend 36 * load from the backend
37 */ 37 */
38 virtual bool load(); 38 virtual bool load();
39 39
40 /** Reload database. 40 /** Reload database.
41 * You should execute this function if the external database 41 * You should execute this function if the external database
42 * was changed. 42 * was changed.
43 * This function will load the external database and afterwards 43 * This function will load the external database and afterwards
44 * rejoin the local changes. Therefore the local database will be set consistent. 44 * rejoin the local changes. Therefore the local database will be set consistent.
45 */ 45 */
46 virtual bool reload(); 46 virtual bool reload();
47 47
48 /** Save contacts database. 48 /** Save contacts database.
49 * Save is more a "commit". After calling this function, all changes are public available. 49 * Save is more a "commit". After calling this function, all changes are public available.
50 * @return true if successful 50 * @return true if successful
51 */ 51 */
52 virtual bool save(); 52 virtual bool save();
53 53
54 /** 54 /**
55 * if the resource was changed externally 55 * if the resource was changed externally
56 * You should use the signal handling instead of polling possible changes ! 56 * You should use the signal handling instead of polling possible changes !
57 * zecke: Do you implement a signal for otodoaccess ? 57 * zecke: Do you implement a signal for otodoaccess ?
58 */ 58 */
59 bool wasChangedExternally()const; 59 bool wasChangedExternally()const;
60 60
61 /** 61 /**
62 * return a List of records 62 * return a List of records
63 * you can iterate over them 63 * you can iterate over them
64 */ 64 */
65 virtual List allRecords()const; 65 virtual List allRecords()const;
66 66
67 /** 67 /**
68 * queryByExample. 68 * queryByExample.
69 * @see otodoaccess, ocontactaccess 69 * @see otodoaccess, ocontactaccess
70 */ 70 */
71 virtual List queryByExample( const T& t, int querySettings ); 71 virtual List queryByExample( const T& t, int querySettings );
72 72
73 /** 73 /**
74 * find the OPimRecord uid 74 * find the OPimRecord uid
75 */ 75 */
76 virtual T find( int uid )const; 76 virtual T find( int uid )const;
77 77
78 /** 78 /**
79 * read ahead cache find method ;) 79 * read ahead cache find method ;)
80 */ 80 */
81 virtual T find( int uid, const QArray<int>&, 81 virtual T find( int uid, const QArray<int>&,
82 uint current, CacheDirection dir = Forward )const; 82 uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const;
83 83
84 /* invalidate cache here */ 84 /* invalidate cache here */
85 /** 85 /**
86 * clears the backend and invalidates the backend 86 * clears the backend and invalidates the backend
87 */ 87 */
88 virtual void clear() ; 88 virtual void clear() ;
89 89
90 /** 90 /**
91 * add T to the backend 91 * add T to the backend
92 * @param t The item to add. 92 * @param t The item to add.
93 * @return <i>true</i> if added successfully. 93 * @return <i>true</i> if added successfully.
94 */ 94 */
95 virtual bool add( const T& t ) ; 95 virtual bool add( const T& t ) ;
96 96
97 /* only the uid matters */ 97 /* only the uid matters */
98 /** 98 /**
99 * remove T from the backend 99 * remove T from the backend
100 * @param t The item to remove 100 * @param t The item to remove
101 * @return <i>true</i> if successful. 101 * @return <i>true</i> if successful.
102 */ 102 */
103 virtual bool remove( const T& t ); 103 virtual bool remove( const T& t );
104 104
105 /** 105 /**
106 * remove the OPimRecord with uid 106 * remove the OPimRecord with uid
107 * @param uid The ID of the item to remove 107 * @param uid The ID of the item to remove
108 * @return <i>true</i> if successful. 108 * @return <i>true</i> if successful.
109 */ 109 */
110 virtual bool remove( int uid ); 110 virtual bool remove( int uid );
111 111
112 /** 112 /**
113 * replace T from backend 113 * replace T from backend
114 * @param t The item to replace 114 * @param t The item to replace
115 * @return <i>true</i> if successful. 115 * @return <i>true</i> if successful.
116 */ 116 */
117 virtual bool replace( const T& t) ; 117 virtual bool replace( const T& t) ;
118 118
119 void setReadAhead( uint count ); 119 void setReadAhead( uint count );
120 /** 120 /**
121 * @internal 121 * @internal
122 */ 122 */
123 void cache( const T& )const; 123 void cache( const T& )const;
124 void setSaneCacheSize( int ); 124 void setSaneCacheSize( int );
125protected: 125protected:
126 /** 126 /**
127 * invalidate the cache 127 * invalidate the cache
128 */ 128 */
129 void invalidateCache(); 129 void invalidateCache();
130 130
131 void setBackEnd( BackEnd* end ); 131 void setBackEnd( BackEnd* end );
132 /** 132 /**
133 * returns the backend 133 * returns the backend
134 */ 134 */
135 BackEnd* backEnd(); 135 BackEnd* backEnd();
136 BackEnd* m_backEnd; 136 BackEnd* m_backEnd;
137 Cache m_cache; 137 Cache m_cache;
138 138
139}; 139};
140 140
141template <class T> 141template <class T>
142OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) 142OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end )
143 : OTemplateBase<T>(), m_backEnd( end ) 143 : OTemplateBase<T>(), m_backEnd( end )
144{ 144{
145 if (end ) 145 if (end )
146 end->setFrontend( this ); 146 end->setFrontend( this );
147} 147}
148template <class T> 148template <class T>
149OPimAccessTemplate<T>::~OPimAccessTemplate() { 149OPimAccessTemplate<T>::~OPimAccessTemplate() {
150 qWarning("~OPimAccessTemplate<T>"); 150 qWarning("~OPimAccessTemplate<T>");
151 delete m_backEnd; 151 delete m_backEnd;
152} 152}
153template <class T> 153template <class T>
154bool OPimAccessTemplate<T>::load() { 154bool OPimAccessTemplate<T>::load() {
155 invalidateCache(); 155 invalidateCache();
156 return m_backEnd->load(); 156 return m_backEnd->load();
157} 157}
158template <class T> 158template <class T>
159bool OPimAccessTemplate<T>::reload() { 159bool OPimAccessTemplate<T>::reload() {
160 invalidateCache(); // zecke: I think this should be added (se) 160 invalidateCache(); // zecke: I think this should be added (se)
161 return m_backEnd->reload(); 161 return m_backEnd->reload();
162} 162}
163template <class T> 163template <class T>
164bool OPimAccessTemplate<T>::save() { 164bool OPimAccessTemplate<T>::save() {
165 return m_backEnd->save(); 165 return m_backEnd->save();
166} 166}
167template <class T> 167template <class T>
168OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { 168typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const {
169 QArray<int> ints = m_backEnd->allRecords(); 169 QArray<int> ints = m_backEnd->allRecords();
170 List lis(ints, this ); 170 List lis(ints, this );
171 return lis; 171 return lis;
172} 172}
173template <class T> 173template <class T>
174OPimAccessTemplate<T>::List 174typename OPimAccessTemplate<T>::List
175OPimAccessTemplate<T>::queryByExample( const T& t, int sortOrder ) { 175OPimAccessTemplate<T>::queryByExample( const T& t, int sortOrder ) {
176 QArray<int> ints = m_backEnd->queryByExample( t, sortOrder ); 176 QArray<int> ints = m_backEnd->queryByExample( t, sortOrder );
177 177
178 List lis(ints, this ); 178 List lis(ints, this );
179 return lis; 179 return lis;
180} 180}
181template <class T> 181template <class T>
182T OPimAccessTemplate<T>::find( int uid ) const{ 182T OPimAccessTemplate<T>::find( int uid ) const{
183 T t = m_backEnd->find( uid ); 183 T t = m_backEnd->find( uid );
184 cache( t ); 184 cache( t );
185 return t; 185 return t;
186} 186}
187template <class T> 187template <class T>
188T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar, 188T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar,
189 uint current, CacheDirection dir )const { 189 uint current, typename OTemplateBase<T>::CacheDirection dir )const {
190 /* 190 /*
191 * better do T.isEmpty() 191 * better do T.isEmpty()
192 * after a find this way we would 192 * after a find this way we would
193 * avoid two finds in QCache... 193 * avoid two finds in QCache...
194 */ 194 */
195 // qWarning("find it now %d", uid ); 195 // qWarning("find it now %d", uid );
196 if (m_cache.contains( uid ) ) { 196 if (m_cache.contains( uid ) ) {
197 return m_cache.find( uid ); 197 return m_cache.find( uid );
198 } 198 }
199 199
200 T t = m_backEnd->find( uid, ar, current, dir ); 200 T t = m_backEnd->find( uid, ar, current, dir );
201 cache( t ); 201 cache( t );
202 return t; 202 return t;
203} 203}
204template <class T> 204template <class T>
205void OPimAccessTemplate<T>::clear() { 205void OPimAccessTemplate<T>::clear() {
206 invalidateCache(); 206 invalidateCache();
207 m_backEnd->clear(); 207 m_backEnd->clear();
208} 208}
209template <class T> 209template <class T>
210bool OPimAccessTemplate<T>::add( const T& t ) { 210bool OPimAccessTemplate<T>::add( const T& t ) {
211 cache( t ); 211 cache( t );
212 return m_backEnd->add( t ); 212 return m_backEnd->add( t );
213} 213}
214template <class T> 214template <class T>
215bool OPimAccessTemplate<T>::remove( const T& t ) { 215bool OPimAccessTemplate<T>::remove( const T& t ) {
216 return remove( t.uid() ); 216 return remove( t.uid() );
217} 217}
218template <class T> 218template <class T>
219bool OPimAccessTemplate<T>::remove( int uid ) { 219bool OPimAccessTemplate<T>::remove( int uid ) {
220 m_cache.remove( uid ); 220 m_cache.remove( uid );
221 return m_backEnd->remove( uid ); 221 return m_backEnd->remove( uid );
222} 222}
223template <class T> 223template <class T>
224bool OPimAccessTemplate<T>::replace( const T& t ) { 224bool OPimAccessTemplate<T>::replace( const T& t ) {
225 m_cache.replace( t ); 225 m_cache.replace( t );
226 return m_backEnd->replace( t ); 226 return m_backEnd->replace( t );
227} 227}
228template <class T> 228template <class T>
229void OPimAccessTemplate<T>::invalidateCache() { 229void OPimAccessTemplate<T>::invalidateCache() {
230 m_cache.invalidate(); 230 m_cache.invalidate();
231} 231}
232template <class T> 232template <class T>
233OPimAccessTemplate<T>::BackEnd* OPimAccessTemplate<T>::backEnd() { 233typename OPimAccessTemplate<T>::BackEnd* OPimAccessTemplate<T>::backEnd() {
234 return m_backEnd; 234 return m_backEnd;
235} 235}
236template <class T> 236template <class T>
237bool OPimAccessTemplate<T>::wasChangedExternally()const { 237bool OPimAccessTemplate<T>::wasChangedExternally()const {
238 return false; 238 return false;
239} 239}
240template <class T> 240template <class T>
241void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) { 241void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) {
242 m_backEnd = end; 242 m_backEnd = end;
243 if (m_backEnd ) 243 if (m_backEnd )
244 m_backEnd->setFrontend( this ); 244 m_backEnd->setFrontend( this );
245} 245}
246template <class T> 246template <class T>
247void OPimAccessTemplate<T>::cache( const T& t ) const{ 247void OPimAccessTemplate<T>::cache( const T& t ) const{
248 /* hacky we need to work around the const*/ 248 /* hacky we need to work around the const*/
249 ((OPimAccessTemplate<T>*)this)->m_cache.add( t ); 249 ((OPimAccessTemplate<T>*)this)->m_cache.add( t );
250} 250}
251template <class T> 251template <class T>
252void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { 252void OPimAccessTemplate<T>::setSaneCacheSize( int size ) {
253 m_cache.setSize( size ); 253 m_cache.setSize( size );
254} 254}
255template <class T> 255template <class T>
256void OPimAccessTemplate<T>::setReadAhead( uint count ) { 256void OPimAccessTemplate<T>::setReadAhead( uint count ) {
257 m_backEnd->setReadAhead( count ); 257 m_backEnd->setReadAhead( count );
258} 258}
259#endif 259#endif
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h
index 8ed41e2..b77a4ab 100644
--- a/libopie2/opiepim/orecordlist.h
+++ b/libopie2/opiepim/orecordlist.h
@@ -202,99 +202,99 @@ template <class T>
202bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) { 202bool ORecordListIterator<T>::operator==( const ORecordListIterator<T>& it ) {
203 203
204 /* if both are at we're the same.... */ 204 /* if both are at we're the same.... */
205 if ( m_end == it.m_end ) return true; 205 if ( m_end == it.m_end ) return true;
206 206
207 if ( m_uids != it.m_uids ) return false; 207 if ( m_uids != it.m_uids ) return false;
208 if ( m_current != it.m_current ) return false; 208 if ( m_current != it.m_current ) return false;
209 if ( m_temp != it.m_temp ) return false; 209 if ( m_temp != it.m_temp ) return false;
210 210
211 return true; 211 return true;
212} 212}
213template <class T> 213template <class T>
214bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) { 214bool ORecordListIterator<T>::operator!=( const ORecordListIterator<T>& it ) {
215 return !(*this == it ); 215 return !(*this == it );
216} 216}
217template <class T> 217template <class T>
218ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids, 218ORecordListIterator<T>::ORecordListIterator( const QArray<int> uids,
219 const Base* t ) 219 const Base* t )
220 : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ), 220 : m_uids( uids ), m_current( 0 ), m_temp( t ), m_end( false ),
221 m_direction( false ) 221 m_direction( false )
222{ 222{
223} 223}
224template <class T> 224template <class T>
225uint ORecordListIterator<T>::current()const { 225uint ORecordListIterator<T>::current()const {
226 return m_current; 226 return m_current;
227} 227}
228template <class T> 228template <class T>
229void ORecordListIterator<T>::setCurrent( uint cur ) { 229void ORecordListIterator<T>::setCurrent( uint cur ) {
230 if( cur < m_uids.count() ) { 230 if( cur < m_uids.count() ) {
231 m_end = false; 231 m_end = false;
232 m_current= cur; 232 m_current= cur;
233 } 233 }
234} 234}
235template <class T> 235template <class T>
236uint ORecordListIterator<T>::count()const { 236uint ORecordListIterator<T>::count()const {
237 return m_uids.count(); 237 return m_uids.count();
238} 238}
239template <class T> 239template <class T>
240ORecordList<T>::ORecordList( const QArray<int>& ids, 240ORecordList<T>::ORecordList( const QArray<int>& ids,
241 const Base* acc ) 241 const Base* acc )
242 : m_ids( ids ), m_acc( acc ) 242 : m_ids( ids ), m_acc( acc )
243{ 243{
244} 244}
245template <class T> 245template <class T>
246ORecordList<T>::~ORecordList() { 246ORecordList<T>::~ORecordList() {
247/* nothing to do here */ 247/* nothing to do here */
248} 248}
249template <class T> 249template <class T>
250ORecordList<T>::Iterator ORecordList<T>::begin() { 250typename ORecordList<T>::Iterator ORecordList<T>::begin() {
251 Iterator it( m_ids, m_acc ); 251 Iterator it( m_ids, m_acc );
252 return it; 252 return it;
253} 253}
254template <class T> 254template <class T>
255ORecordList<T>::Iterator ORecordList<T>::end() { 255typename ORecordList<T>::Iterator ORecordList<T>::end() {
256 Iterator it( m_ids, m_acc ); 256 Iterator it( m_ids, m_acc );
257 it.m_end = true; 257 it.m_end = true;
258 it.m_current = m_ids.count(); 258 it.m_current = m_ids.count();
259 259
260 return it; 260 return it;
261} 261}
262template <class T> 262template <class T>
263uint ORecordList<T>::count()const { 263uint ORecordList<T>::count()const {
264return m_ids.count(); 264return m_ids.count();
265} 265}
266template <class T> 266template <class T>
267T ORecordList<T>::operator[]( uint i ) { 267T ORecordList<T>::operator[]( uint i ) {
268 if ( i < 0 || (i+1) > m_ids.count() ) 268 if ( i < 0 || (i+1) > m_ids.count() )
269 return T(); 269 return T();
270 /* forward */ 270 /* forward */
271 return m_acc->find( m_ids[i], m_ids, i ); 271 return m_acc->find( m_ids[i], m_ids, i );
272} 272}
273template <class T> 273template <class T>
274int ORecordList<T>::uidAt( uint i ) { 274int ORecordList<T>::uidAt( uint i ) {
275 return m_ids[i]; 275 return m_ids[i];
276} 276}
277 277
278template <class T> 278template <class T>
279bool ORecordList<T>::remove( int uid ) { 279bool ORecordList<T>::remove( int uid ) {
280 QArray<int> copy( m_ids.count() ); 280 QArray<int> copy( m_ids.count() );
281 int counter = 0; 281 int counter = 0;
282 bool ret_val = false; 282 bool ret_val = false;
283 283
284 for (uint i = 0; i < m_ids.count(); i++){ 284 for (uint i = 0; i < m_ids.count(); i++){
285 if ( m_ids[i] != uid ){ 285 if ( m_ids[i] != uid ){
286 copy[counter++] = m_ids[i]; 286 copy[counter++] = m_ids[i];
287 287
288 }else 288 }else
289 ret_val = true; 289 ret_val = true;
290 } 290 }
291 291
292 copy.resize( counter ); 292 copy.resize( counter );
293 m_ids = copy; 293 m_ids = copy;
294 294
295 295
296 return ret_val; 296 return ret_val;
297} 297}
298 298
299 299
300#endif 300#endif
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp
index 0d5b1d3..4d5cb79 100644
--- a/libopie2/opiepim/otodo.cpp
+++ b/libopie2/opiepim/otodo.cpp
@@ -354,52 +354,52 @@ QMap<int, QString> OTodo::toMap() const {
354 map.insert( Description, data->desc ); 354 map.insert( Description, data->desc );
355 map.insert( Summary, data->sum ); 355 map.insert( Summary, data->sum );
356 map.insert( Priority, QString::number( data->priority ) ); 356 map.insert( Priority, QString::number( data->priority ) );
357 map.insert( DateDay, QString::number( data->date.day() ) ); 357 map.insert( DateDay, QString::number( data->date.day() ) );
358 map.insert( DateMonth, QString::number( data->date.month() ) ); 358 map.insert( DateMonth, QString::number( data->date.month() ) );
359 map.insert( DateYear, QString::number( data->date.year() ) ); 359 map.insert( DateYear, QString::number( data->date.year() ) );
360 map.insert( Progress, QString::number( data->prog ) ); 360 map.insert( Progress, QString::number( data->prog ) );
361 map.insert( CrossReference, crossToString() ); 361 map.insert( CrossReference, crossToString() );
362 map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) ); 362 map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) );
363 map.insert( AlarmDateTime, data->alarmDateTime.toString() ); 363 map.insert( AlarmDateTime, data->alarmDateTime.toString() );
364 364
365 return map; 365 return map;
366} 366}
367 367
368QMap<QString, QString> OTodo::toExtraMap()const { 368QMap<QString, QString> OTodo::toExtraMap()const {
369 return data->extra; 369 return data->extra;
370} 370}
371/** 371/**
372 * change or modify looks at the ref count and either 372 * change or modify looks at the ref count and either
373 * creates a new QShared Object or it can modify it 373 * creates a new QShared Object or it can modify it
374 * right in place 374 * right in place
375 */ 375 */
376void OTodo::changeOrModify() { 376void OTodo::changeOrModify() {
377 if ( data->count != 1 ) { 377 if ( data->count != 1 ) {
378 qWarning("changeOrModify"); 378 qWarning("changeOrModify");
379 data->deref(); 379 data->deref();
380 OTodoData* d2 = new OTodoData(); 380 OTodoData* d2 = new OTodoData();
381 copy(data, d2 ); 381 copy(data, d2 );
382 data = d2; 382 data = d2;
383 } 383 }
384} 384}
385void OTodo::copy( OTodoData* src, OTodoData* dest ) { 385void OTodo::copy( OTodoData* src, OTodoData* dest ) {
386 dest->date = src->date; 386 dest->date = src->date;
387 dest->isCompleted = src->isCompleted; 387 dest->isCompleted = src->isCompleted;
388 dest->hasDate = src->hasDate; 388 dest->hasDate = src->hasDate;
389 dest->priority = src->priority; 389 dest->priority = src->priority;
390 dest->desc = src->desc; 390 dest->desc = src->desc;
391 dest->sum = src->sum; 391 dest->sum = src->sum;
392 dest->extra = src->extra; 392 dest->extra = src->extra;
393 dest->prog = src->prog; 393 dest->prog = src->prog;
394 dest->hasAlarmDateTime = src->hasAlarmDateTime; 394 dest->hasAlarmDateTime = src->hasAlarmDateTime;
395 dest->alarmDateTime = src->alarmDateTime; 395 dest->alarmDateTime = src->alarmDateTime;
396 dest->state = src->state; 396 dest->state = src->state;
397 dest->recur = src->recur; 397 dest->recur = src->recur;
398} 398}
399QString OTodo::type() const { 399QString OTodo::type() const {
400 return QString::fromLatin1("OTodo"); 400 return QString::fromLatin1("OTodo");
401} 401}
402QString OTodo::recordField(int id )const { 402QString OTodo::recordField(int /*id*/ )const {
403 return QString::null; 403 return QString::null;
404} 404}
405 405