summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/addressbook.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp69
1 files changed, 48 insertions, 21 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 82a1b57..8335d8b 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -59,28 +59,24 @@
59#include <qwhatsthis.h> 59#include <qwhatsthis.h>
60 60
61#include <stdlib.h> 61#include <stdlib.h>
62#include <sys/stat.h> 62#include <sys/stat.h>
63#include <sys/types.h> 63#include <sys/types.h>
64#include <fcntl.h> 64#include <fcntl.h>
65#include <unistd.h> 65#include <unistd.h>
66 66
67#include <qdatetime.h> 67#include <qdatetime.h>
68 68
69#include "picker.h" 69#include "picker.h"
70 70
71// Remove this for OPIE releae 1.0 !
72#define __DEBUG_RELEASE
73
74
75static QString addressbookPersonalVCardName() 71static QString addressbookPersonalVCardName()
76{ 72{
77 QString filename = Global::applicationFileName("addressbook", 73 QString filename = Global::applicationFileName("addressbook",
78 "businesscard.vcf"); 74 "businesscard.vcf");
79 return filename; 75 return filename;
80} 76}
81 77
82 78
83AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, 79AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
84 WFlags f ) 80 WFlags f )
85 : QMainWindow( parent, name, f ), 81 : QMainWindow( parent, name, f ),
86 abEditor(0), 82 abEditor(0),
@@ -131,38 +127,49 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
131 a->addTo( edit ); 127 a->addTo( edit );
132 a->addTo( listTools ); 128 a->addTo( listTools );
133 129
134 130
135 // make it possible to go directly to businesscard via qcop call 131 // make it possible to go directly to businesscard via qcop call
136#if defined(Q_WS_QWS) 132#if defined(Q_WS_QWS)
137#if !defined(QT_NO_COP) 133#if !defined(QT_NO_COP)
138 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); 134 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this );
139 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), 135 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)),
140 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); 136 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) );
141#endif 137#endif
142#endif 138#endif
143
144
145
146
147
148#ifndef MAKE_FOR_SHARP_ROM
149 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), 139 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ),
150 QString::null, 0, this, 0 ); 140 QString::null, 0, this, 0 );
151 actionFind = a; 141 actionFind = a;
152 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); 142 connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) );
153 a->addTo( edit ); 143 a->addTo( edit );
154 a->addTo( listTools ); 144 a->addTo( listTools );
155#endif 145
156 146 // Much better search widget, taken from QTReader.. (se)
147 searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE );
148 searchBar->setHorizontalStretchable( TRUE );
149 searchBar->hide();
150 searchEdit = new QLineEdit( searchBar, "searchEdit" );
151// QFont f("unifont", 16 /*, QFont::Bold*/);
152// searchEdit->setFont( f );
153 searchBar->setStretchableWidget( searchEdit );
154 connect( searchEdit, SIGNAL( returnPressed( ) ),
155 this, SLOT( slotFind( ) ) );
156
157 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 );
158 connect( a, SIGNAL( activated() ), this, SLOT( slotFindNext() ) );
159 a->addTo( searchBar );
160
161 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
162 connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) );
163 a->addTo( searchBar );
157 164
158 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), 165 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ),
159 QString::null, 0, this, 0 ); 166 QString::null, 0, this, 0 );
160 //a->setEnabled( FALSE ); we got support for it now :) zecke 167 //a->setEnabled( FALSE ); we got support for it now :) zecke
161 actionMail = a; 168 actionMail = a;
162 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); 169 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) );
163 a->addTo( edit ); 170 a->addTo( edit );
164 a->addTo( listTools ); 171 a->addTo( listTools );
165 172
166 173
167 174
168 if ( Ir::supported() ) { 175 if ( Ir::supported() ) {
@@ -189,25 +196,25 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
189 a->addTo( edit ); 196 a->addTo( edit );
190 197
191 // Do we need this function ? (se) 198 // Do we need this function ? (se)
192 // a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); 199 // a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 );
193 // connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 200 // connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
194 // a->addTo( edit ); 201 // a->addTo( edit );
195 202
196 203
197#ifdef __DEBUG_RELEASE 204#ifdef __DEBUG_RELEASE
198 // Remove this function for public Release ! This is only 205 // Remove this function for public Release ! This is only
199 // for debug purposes .. 206 // for debug purposes ..
200 a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); 207 a = new QAction( tr( "Save all Data"), QString::null, 0, 0 );
201 connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); 208 connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) );
202 a->addTo( edit ); 209 a->addTo( edit );
203#endif 210#endif
204 211
205 // Create Views 212 // Create Views
206 listContainer = new QWidget( this ); 213 listContainer = new QWidget( this );
207 214
208 QVBoxLayout *vb = new QVBoxLayout( listContainer ); 215 QVBoxLayout *vb = new QVBoxLayout( listContainer );
209 216
210 abList = new AbTable( &orderedFields, listContainer, "table" ); 217 abList = new AbTable( &orderedFields, listContainer, "table" );
211 vb->addWidget(abList); 218 vb->addWidget(abList);
212 // abList->setHScrollBarMode( QScrollView::AlwaysOff ); 219 // abList->setHScrollBarMode( QScrollView::AlwaysOff );
213 connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); 220 connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) );
@@ -744,24 +751,31 @@ bool AddressbookWindow::save()
744 "and try again.\n" 751 "and try again.\n"
745 "\nQuit anyway?"), 752 "\nQuit anyway?"),
746 QMessageBox::Yes|QMessageBox::Escape, 753 QMessageBox::Yes|QMessageBox::Escape,
747 QMessageBox::No|QMessageBox::Default ) 754 QMessageBox::No|QMessageBox::Default )
748 != QMessageBox::No ) 755 != QMessageBox::No )
749 return TRUE; 756 return TRUE;
750 else 757 else
751 return FALSE; 758 return FALSE;
752 } 759 }
753 return TRUE; 760 return TRUE;
754} 761}
755 762
763#ifdef __DEBUG_RELEASE
764void AddressbookWindow::slotSave()
765{
766 save();
767}
768#endif
769
756void AddressbookWindow::slotSettings() 770void AddressbookWindow::slotSettings()
757{ 771{
758 AddressSettings frmSettings( this ); 772 AddressSettings frmSettings( this );
759#if defined(Q_WS_QWS) || defined(_WS_QWS_) 773#if defined(Q_WS_QWS) || defined(_WS_QWS_)
760 frmSettings.showMaximized(); 774 frmSettings.showMaximized();
761#endif 775#endif
762 776
763 if ( frmSettings.exec() ) { 777 if ( frmSettings.exec() ) {
764 allFields.clear(); 778 allFields.clear();
765 orderedFields.clear(); 779 orderedFields.clear();
766 slOrderedFields.clear(); 780 slOrderedFields.clear();
767 initFields(); 781 initFields();
@@ -868,42 +882,55 @@ void AddressbookWindow::initFields()
868 882
869 883
870AbLabel *AddressbookWindow::abView() 884AbLabel *AddressbookWindow::abView()
871{ 885{
872 if ( !mView ) { 886 if ( !mView ) {
873 mView = new AbLabel( this, "viewer" ); 887 mView = new AbLabel( this, "viewer" );
874 mView->init( OContact() ); 888 mView->init( OContact() );
875 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); 889 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) );
876 } 890 }
877 return mView; 891 return mView;
878} 892}
879 893
894void AddressbookWindow::slotFindOpen()
895{
896 searchBar->show();
897}
898void AddressbookWindow::slotFindClose()
899{
900 searchBar->hide();
901}
902void AddressbookWindow::slotFindNext()
903{
904}
905
880void AddressbookWindow::slotFind() 906void AddressbookWindow::slotFind()
881{ 907{
882#ifndef MAKE_FOR_SHARP_ROM
883 if ( centralWidget() == abView() ) 908 if ( centralWidget() == abView() )
884 showList(); 909 showList();
885 910
886 FindDialog frmFind( "Contacts", this ); 911 // FindDialog frmFind( "Contacts", this );
887 QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); 912 // QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) );
888 QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); 913 // QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) );
889 QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); 914 // frmFind.exec();
915
916 // QStringList categories = abList->categories();
917 // abList->setShowCategory( book, cat );
918 abList->slotDoFind( searchEdit->text(), false, false);
890 919
891 frmFind.exec();
892 920
893 if ( abList->numSelections() ) 921 if ( abList->numSelections() )
894 abList->clearSelection(); 922 abList->clearSelection();
895 923
896 abList->clearFindRow(); 924 abList->clearFindRow();
897#endif
898} 925}
899 926
900void AddressbookWindow::slotSetCategory( int c ) 927void AddressbookWindow::slotSetCategory( int c )
901{ 928{
902 929
903 QString cat, book; 930 QString cat, book;
904 931
905 if ( c <= 0 ) 932 if ( c <= 0 )
906 return; 933 return;
907 934
908 // Checkmark Book Menu Item Selected 935 // Checkmark Book Menu Item Selected
909 if ( c < 6 ) 936 if ( c < 6 )