summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp31
-rw-r--r--kaddressbook/kabcore.h3
2 files changed, 18 insertions, 16 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 087e9e3..3ab06c4 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -201,12 +201,13 @@ class KAex2phonePrefs : public QDialog
201 201
202public: 202public:
203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
204 QCheckBox* mWriteToSim; 204 QCheckBox* mWriteToSim;
205}; 205};
206 206
207
207bool pasteWithNewUid = true; 208bool pasteWithNewUid = true;
208 209
209#ifdef KAB_EMBEDDED 210#ifdef KAB_EMBEDDED
210KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 211KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
211 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 212 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
212 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 213 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
@@ -219,13 +220,12 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
219#endif //KAB_EMBEDDED 220#endif //KAB_EMBEDDED
220{ 221{
221 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 222 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
222 // syncManager->setBlockSave(false); 223 // syncManager->setBlockSave(false);
223 mExtensionBarSplitter = 0; 224 mExtensionBarSplitter = 0;
224 mIsPart = !parent->inherits( "KAddressBookMain" ); 225 mIsPart = !parent->inherits( "KAddressBookMain" );
225
226 mAddressBook = KABC::StdAddressBook::self(); 226 mAddressBook = KABC::StdAddressBook::self();
227 KABC::StdAddressBook::setAutomaticSave( false ); 227 KABC::StdAddressBook::setAutomaticSave( false );
228 228
229#ifndef KAB_EMBEDDED 229#ifndef KAB_EMBEDDED
230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
231#endif //KAB_EMBEDDED 231#endif //KAB_EMBEDDED
@@ -304,12 +304,15 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
304 SLOT( browse( const QString& ) ) ); 304 SLOT( browse( const QString& ) ) );
305 305
306 306
307 mAddressBookService = new KAddressBookService( this ); 307 mAddressBookService = new KAddressBookService( this );
308 308
309#endif //KAB_EMBEDDED 309#endif //KAB_EMBEDDED
310
311 mMessageTimer = new QTimer( this );
312 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
310 mEditorDialog = 0; 313 mEditorDialog = 0;
311 createAddresseeEditorDialog( this ); 314 createAddresseeEditorDialog( this );
312 setModified( false ); 315 setModified( false );
313} 316}
314 317
315KABCore::~KABCore() 318KABCore::~KABCore()
@@ -325,14 +328,15 @@ KABCore::~KABCore()
325 328
326} 329}
327 330
328void KABCore::recieve( QString fn ) 331void KABCore::recieve( QString fn )
329{ 332{
330 //qDebug("KABCore::recieve "); 333 //qDebug("KABCore::recieve ");
331 mAddressBook->importFromFile( fn, true ); 334 int count = mAddressBook->importFromFile( fn, true );
332 mViewManager->refreshView(); 335 mViewManager->refreshView();
336 message(i18n("%1 contact(s) received!").arg( count ));
333 topLevelWidget()->raise(); 337 topLevelWidget()->raise();
334} 338}
335void KABCore::restoreSettings() 339void KABCore::restoreSettings()
336{ 340{
337 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 341 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
338 342
@@ -694,12 +698,13 @@ void KABCore::export2phone()
694 return; 698 return;
695 699
696 QString fileName = getPhoneFile(); 700 QString fileName = getPhoneFile();
697 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 701 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
698 return; 702 return;
699 703
704 message(i18n("Exporting to phone..."));
700 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 705 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
701 706
702} 707}
703QString KABCore::getPhoneFile() 708QString KABCore::getPhoneFile()
704{ 709{
705#ifdef _WIN32_ 710#ifdef _WIN32_
@@ -709,15 +714,15 @@ QString KABCore::getPhoneFile()
709#endif 714#endif
710 715
711} 716}
712void KABCore::writeToPhone( ) 717void KABCore::writeToPhone( )
713{ 718{
714 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 719 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
715 qDebug("Export okay "); 720 message(i18n("Export to phone finished!"));
716 else 721 else
717 qDebug("Error export contacts "); 722 qDebug(i18n("Error exporting to phone"));
718} 723}
719void KABCore::beamVCard() 724void KABCore::beamVCard()
720{ 725{
721 QStringList uids = mViewManager->selectedUids(); 726 QStringList uids = mViewManager->selectedUids();
722 if ( !uids.isEmpty() ) 727 if ( !uids.isEmpty() )
723 beamVCard( uids ); 728 beamVCard( uids );
@@ -828,13 +833,13 @@ void KABCore::beamVCard(const QStringList& uids)
828void KABCore::beamDone( Ir *ir ) 833void KABCore::beamDone( Ir *ir )
829{ 834{
830#ifndef DESKTOP_VERSION 835#ifndef DESKTOP_VERSION
831 delete ir; 836 delete ir;
832#endif 837#endif
833 topLevelWidget()->raise(); 838 topLevelWidget()->raise();
834 message( i18n("Beaming successful!") ); 839 message( i18n("Beaming finished!") );
835} 840}
836 841
837 842
838void KABCore::browse( const QString& url ) 843void KABCore::browse( const QString& url )
839{ 844{
840#ifndef KAB_EMBEDDED 845#ifndef KAB_EMBEDDED
@@ -1192,35 +1197,31 @@ void KABCore::save()
1192 return; 1197 return;
1193 1198
1194 syncManager->setBlockSave(true); 1199 syncManager->setBlockSave(true);
1195 QString text = i18n( "There was an error while attempting to save\n the " 1200 QString text = i18n( "There was an error while attempting to save\n the "
1196 "address book. Please check that some \nother application is " 1201 "address book. Please check that some \nother application is "
1197 "not using it. " ); 1202 "not using it. " );
1198 statusMessage(i18n("Saving addressbook ... ")); 1203 message(i18n("Saving addressbook ... "));
1199#ifndef KAB_EMBEDDED 1204#ifndef KAB_EMBEDDED
1200 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1205 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1201 if ( !b || !b->save() ) { 1206 if ( !b || !b->save() ) {
1202 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1207 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1203 } 1208 }
1204#else //KAB_EMBEDDED 1209#else //KAB_EMBEDDED
1205 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1210 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1206 if ( !b || !b->save() ) { 1211 if ( !b || !b->save() ) {
1207 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1212 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1208 } 1213 }
1209#endif //KAB_EMBEDDED 1214#endif //KAB_EMBEDDED
1210 1215
1211 statusMessage(i18n("Addressbook saved!")); 1216 message(i18n("Addressbook saved!"));
1212 setModified( false ); 1217 setModified( false );
1213 syncManager->setBlockSave(false); 1218 syncManager->setBlockSave(false);
1214} 1219}
1215 1220
1216void KABCore::statusMessage(QString mess , int time ) 1221
1217{
1218 //topLevelWidget()->setCaption( mess );
1219 // pending setting timer to revome message
1220}
1221void KABCore::undo() 1222void KABCore::undo()
1222{ 1223{
1223 UndoStack::instance()->undo(); 1224 UndoStack::instance()->undo();
1224 1225
1225 // Refresh the view 1226 // Refresh the view
1226 mViewManager->refreshView(); 1227 mViewManager->refreshView();
@@ -2152,13 +2153,13 @@ void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString
2152 w = 220; 2153 w = 220;
2153 int h = bar.sizeHint().height() ; 2154 int h = bar.sizeHint().height() ;
2154 int dw = QApplication::desktop()->width(); 2155 int dw = QApplication::desktop()->width();
2155 int dh = QApplication::desktop()->height(); 2156 int dh = QApplication::desktop()->height();
2156 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2157 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2157 bar.show(); 2158 bar.show();
2158 bar.setCaption (i18n("collecting birthdays - close to abort!") ); 2159 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2159 qApp->processEvents(); 2160 qApp->processEvents();
2160 2161
2161 QDate bday; 2162 QDate bday;
2162 QString anni; 2163 QString anni;
2163 QString formattedbday; 2164 QString formattedbday;
2164 2165
@@ -2806,15 +2807,14 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2806 mViewManager->refreshView(); 2807 mViewManager->refreshView();
2807 return syncOK; 2808 return syncOK;
2808 2809
2809} 2810}
2810void KABCore::message( QString m ) 2811void KABCore::message( QString m )
2811{ 2812{
2812
2813 topLevelWidget()->setCaption( m ); 2813 topLevelWidget()->setCaption( m );
2814 QTimer::singleShot( 15000, this , SLOT ( setCaptionBack())); 2814 mMessageTimer->start( 15000, true );
2815} 2815}
2816bool KABCore::syncPhone() 2816bool KABCore::syncPhone()
2817{ 2817{
2818 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2818 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2819 QString fileName = getPhoneFile(); 2819 QString fileName = getPhoneFile();
2820 if ( !PhoneAccess::readFromPhone( fileName) ) { 2820 if ( !PhoneAccess::readFromPhone( fileName) ) {
@@ -2867,8 +2867,9 @@ QString KABCore::sentSyncFile()
2867 return QString( "/tmp/copysyncab.vcf" ); 2867 return QString( "/tmp/copysyncab.vcf" );
2868#endif 2868#endif
2869} 2869}
2870 2870
2871void KABCore::setCaptionBack() 2871void KABCore::setCaptionBack()
2872{ 2872{
2873 mMessageTimer->stop();
2873 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 2874 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
2874} 2875}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 5871d39..c7be343 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -26,12 +26,13 @@
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32#include <qtimer.h>
32 33
33#include <qwidget.h> 34#include <qwidget.h>
34#include <qpopupmenu.h> 35#include <qpopupmenu.h>
35#include <ksyncmanager.h> 36#include <ksyncmanager.h>
36 37
37namespace KABC { 38namespace KABC {
@@ -140,13 +141,12 @@ class KABCore : public QWidget, public KSyncInterface
140 141
141 public slots: 142 public slots:
142#ifdef KAB_EMBEDDED 143#ifdef KAB_EMBEDDED
143 void createAboutData(); 144 void createAboutData();
144#endif //KAB_EMBEDDED 145#endif //KAB_EMBEDDED
145 146
146 void statusMessage(QString, int time = 0 );
147 void showLicence(); 147 void showLicence();
148 void faq(); 148 void faq();
149 void whatsnew() ; 149 void whatsnew() ;
150 void synchowto() ; 150 void synchowto() ;
151 void writeToPhone(); 151 void writeToPhone();
152 152
@@ -367,12 +367,13 @@ class KABCore : public QWidget, public KSyncInterface
367 367
368 void slotEditorDestroyed( const QString &uid ); 368 void slotEditorDestroyed( const QString &uid );
369 void configurationChanged(); 369 void configurationChanged();
370 void addressBookChanged(); 370 void addressBookChanged();
371 371
372 private: 372 private:
373 QTimer *mMessageTimer;
373 void initGUI(); 374 void initGUI();
374 void initActions(); 375 void initActions();
375 QString getPhoneFile(); 376 QString getPhoneFile();
376 377
377 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 378 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
378 const char *name = 0 ); 379 const char *name = 0 );