summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp31
1 files changed, 16 insertions, 15 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
public:
QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
QCheckBox* mWriteToSim;
};
+
bool pasteWithNewUid = true;
#ifdef KAB_EMBEDDED
KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
: QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
@@ -219,13 +220,12 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
#endif //KAB_EMBEDDED
{
// syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
// syncManager->setBlockSave(false);
mExtensionBarSplitter = 0;
mIsPart = !parent->inherits( "KAddressBookMain" );
-
mAddressBook = KABC::StdAddressBook::self();
KABC::StdAddressBook::setAutomaticSave( false );
#ifndef KAB_EMBEDDED
mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
#endif //KAB_EMBEDDED
@@ -304,12 +304,15 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
SLOT( browse( const QString& ) ) );
mAddressBookService = new KAddressBookService( this );
#endif //KAB_EMBEDDED
+
+ mMessageTimer = new QTimer( this );
+ connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
mEditorDialog = 0;
createAddresseeEditorDialog( this );
setModified( false );
}
KABCore::~KABCore()
@@ -325,14 +328,15 @@ KABCore::~KABCore()
}
void KABCore::recieve( QString fn )
{
//qDebug("KABCore::recieve ");
- mAddressBook->importFromFile( fn, true );
+ int count = mAddressBook->importFromFile( fn, true );
mViewManager->refreshView();
+ message(i18n("%1 contact(s) received!").arg( count ));
topLevelWidget()->raise();
}
void KABCore::restoreSettings()
{
mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
@@ -694,12 +698,13 @@ void KABCore::export2phone()
return;
QString fileName = getPhoneFile();
if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
return;
+ message(i18n("Exporting to phone..."));
QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
}
QString KABCore::getPhoneFile()
{
#ifdef _WIN32_
@@ -709,15 +714,15 @@ QString KABCore::getPhoneFile()
#endif
}
void KABCore::writeToPhone( )
{
if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
- qDebug("Export okay ");
+ message(i18n("Export to phone finished!"));
else
- qDebug("Error export contacts ");
+ qDebug(i18n("Error exporting to phone"));
}
void KABCore::beamVCard()
{
QStringList uids = mViewManager->selectedUids();
if ( !uids.isEmpty() )
beamVCard( uids );
@@ -828,13 +833,13 @@ void KABCore::beamVCard(const QStringList& uids)
void KABCore::beamDone( Ir *ir )
{
#ifndef DESKTOP_VERSION
delete ir;
#endif
topLevelWidget()->raise();
- message( i18n("Beaming successful!") );
+ message( i18n("Beaming finished!") );
}
void KABCore::browse( const QString& url )
{
#ifndef KAB_EMBEDDED
@@ -1192,35 +1197,31 @@ void KABCore::save()
return;
syncManager->setBlockSave(true);
QString text = i18n( "There was an error while attempting to save\n the "
"address book. Please check that some \nother application is "
"not using it. " );
- statusMessage(i18n("Saving addressbook ... "));
+ message(i18n("Saving addressbook ... "));
#ifndef KAB_EMBEDDED
KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
if ( !b || !b->save() ) {
KMessageBox::error( this, text, i18n( "Unable to Save" ) );
}
#else //KAB_EMBEDDED
KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
if ( !b || !b->save() ) {
QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
}
#endif //KAB_EMBEDDED
- statusMessage(i18n("Addressbook saved!"));
+ message(i18n("Addressbook saved!"));
setModified( false );
syncManager->setBlockSave(false);
}
-void KABCore::statusMessage(QString mess , int time )
-{
- //topLevelWidget()->setCaption( mess );
- // pending setting timer to revome message
-}
+
void KABCore::undo()
{
UndoStack::instance()->undo();
// Refresh the view
mViewManager->refreshView();
@@ -2152,13 +2153,13 @@ void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString
w = 220;
int h = bar.sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
- bar.setCaption (i18n("collecting birthdays - close to abort!") );
+ bar.setCaption (i18n("Collecting birthdays - close to abort!") );
qApp->processEvents();
QDate bday;
QString anni;
QString formattedbday;
@@ -2806,15 +2807,14 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
mViewManager->refreshView();
return syncOK;
}
void KABCore::message( QString m )
{
-
topLevelWidget()->setCaption( m );
- QTimer::singleShot( 15000, this , SLOT ( setCaptionBack()));
+ mMessageTimer->start( 15000, true );
}
bool KABCore::syncPhone()
{
QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
QString fileName = getPhoneFile();
if ( !PhoneAccess::readFromPhone( fileName) ) {
@@ -2867,8 +2867,9 @@ QString KABCore::sentSyncFile()
return QString( "/tmp/copysyncab.vcf" );
#endif
}
void KABCore::setCaptionBack()
{
+ mMessageTimer->stop();
topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
}