summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-01-14 11:37:40 (UTC)
committer zautrix <zautrix>2005-01-14 11:37:40 (UTC)
commit61c95ce0295f1397db6499c5b468a9fb3d32a0f4 (patch) (side-by-side diff)
tree2bceecc46d42a572adfad7d8e5000d1534642cbd /kaddressbook
parenta46ecf5ed81460ec9a4e457798e1bf0fb74c5624 (diff)
downloadkdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.zip
kdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.tar.gz
kdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.tar.bz2
made kapi saving faster
Diffstat (limited to 'kaddressbook') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp11
-rw-r--r--kaddressbook/details/detailsviewcontainer.h1
-rw-r--r--kaddressbook/imagewidget.cpp7
-rw-r--r--kaddressbook/kabcore.cpp9
-rw-r--r--kaddressbook/kabcore.h9
-rw-r--r--kaddressbook/viewmanager.cpp1
6 files changed, 9 insertions, 29 deletions
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp
index ceffc77..229cce0 100644
--- a/kaddressbook/details/detailsviewcontainer.cpp
+++ b/kaddressbook/details/detailsviewcontainer.cpp
@@ -108,62 +108,53 @@ void ViewContainer::slotStyleSelected( int index )
if ( index >= 0 && index < mStyleCombo->count() ) {
if ( mCurrentLook != 0 ) {
mCurrentLook->saveSettings( config );
addr = mCurrentLook->addressee();
delete mCurrentLook;
mCurrentLook = 0;
}
KABLookFactory *factory = mLookFactories.at( index );
mCurrentLook = factory->create();
mDetailsStack->raiseWidget( mCurrentLook );
connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this,
SIGNAL( sendEmail( const QString& ) ) );
connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this,
SIGNAL( browse( const QString& ) ) );
}
mCurrentLook->restoreSettings( config );
mCurrentLook->setAddressee( addr );
}
-void ViewContainer::refreshView()
-{
- if ( mCurrentLook ) {
- mCurrentLook->setAddressee( mCurrentAddressee );
- }
-}
void ViewContainer::setAddressee( const KABC::Addressee& addressee )
{
if ( mCurrentLook != 0 ) {
- if ( addressee == mCurrentAddressee )
- return;
- else {
mCurrentAddressee = addressee;
mCurrentLook->setAddressee( mCurrentAddressee );
- }
+
}
}
KABC::Addressee ViewContainer::addressee()
{
static KABC::Addressee empty; // do not use!
if ( !mCurrentLook )
return empty;
else
return mCurrentLook->addressee();
}
void ViewContainer::setReadOnly( bool state )
{
if ( mCurrentLook )
mCurrentLook->setReadOnly( state );
}
#ifndef KAB_EMBEDDED
#include "detailsviewcontainer.moc"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/details/detailsviewcontainer.h b/kaddressbook/details/detailsviewcontainer.h
index b561d12..667f0cb 100644
--- a/kaddressbook/details/detailsviewcontainer.h
+++ b/kaddressbook/details/detailsviewcontainer.h
@@ -24,49 +24,48 @@
#ifndef DETAILSVIEWCONTAINER_H
#define DETAILSVIEWCONTAINER_H
#include <qptrlist.h>
#include "look_basic.h"
class QComboBox;
class QWidgetStack;
class ViewContainer : public QWidget
{
Q_OBJECT
public:
ViewContainer( QWidget *parent = 0, const char* name = 0 );
/**
Return the look currently selected. If there is none, it
returns zero. Do not use this pointer to store a reference
to a look, the user might select another one (e.g., create
a new object) at any time.
*/
KABBasicLook *currentLook();
- void refreshView();
/**
Return the contact currently displayed.
*/
KABC::Addressee addressee();
public slots:
/**
Set the contact currently displayed.
*/
void setAddressee( const KABC::Addressee& addressee );
/**
Set read-write state.
*/
void setReadOnly( bool state );
signals:
/**
The contact has been changed.
*/
void addresseeChanged();
/**
The user acticated the email address displayed. This may happen
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp
index 49d456b..48370e3 100644
--- a/kaddressbook/imagewidget.cpp
+++ b/kaddressbook/imagewidget.cpp
@@ -110,52 +110,48 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name )
connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( loadPhoto() ) );
connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
SIGNAL( changed() ) );
connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( updateGUI() ) );
connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ),
SIGNAL( changed() ) );
connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ),
SIGNAL( changed() ) );
connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( loadLogo() ) );
connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
SIGNAL( changed() ) );
connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( updateGUI() ) );
connect( mUseLogoUrl, SIGNAL( toggled( bool ) ),
SIGNAL( changed() ) );
#ifndef KAB_EMBEDDED
KAcceleratorManager::manage( this );
#endif //KAB_EMBEDDED
-#ifndef DESKTOP_VERSION
- mUsePhotoUrl->setChecked( true );
- mUseLogoUrl->setChecked( true );
-#endif
}
ImageWidget::~ImageWidget()
{
}
void ImageWidget::setPhoto( const KABC::Picture &photo )
{
bool blocked = signalsBlocked();
blockSignals( true );
if ( photo.isIntern() ) {
//US
//US mPhotoLabel->setPixmap( photo.data() );
if (photo.data().isNull() != true)
{
QPixmap pm;
pm.convertFromImage(photo.data());
mPhotoLabel->setPixmap( pm );
}
mUsePhotoUrl->setChecked( false );
} else {
@@ -239,54 +235,53 @@ KABC::Picture ImageWidget::logo() const
#endif //KAB_EMBEDDED
logo.setType( "PNG" );
}
}
return logo;
}
void ImageWidget::loadPhoto()
{
mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) );
}
void ImageWidget::loadLogo()
{
mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) );
}
void ImageWidget::updateGUI()
{
KURLRequester *ptr = (KURLRequester*)sender();
-#ifdef DESKTOP_VERSION
+
if ( ptr == mPhotoUrl )
mUsePhotoUrl->setEnabled( true );
else if ( ptr == mLogoUrl )
mUseLogoUrl->setEnabled( true );
-#endif
}
QPixmap ImageWidget::loadPixmap( const KURL &url )
{
QString tempFile;
QPixmap pixmap;
if ( url.isEmpty() )
return pixmap;
if ( url.isLocalFile() )
pixmap = QPixmap( url.path() );
else
{
#ifndef KAB_EMBEDDED
if ( KIO::NetAccess::download( url, tempFile ) ) {
pixmap = QPixmap( tempFile );
KIO::NetAccess::removeTempFile( tempFile );
}
#else //KAB_EMBEDDED
qDebug("ImageWidget::loadPixmap : only local pixmaps are allowed");
#endif //KAB_EMBEDDED
}
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index f6bdda4..e14e579 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1105,89 +1105,86 @@ void KABCore::setCategories()
setModified( true );
message( i18n("Setting categories completed!") );
}
void KABCore::setSearchFields( const KABC::Field::List &fields )
{
mIncSearchWidget->setFields( fields );
}
void KABCore::incrementalSearch( const QString& text )
{
mViewManager->doSearch( text, mIncSearchWidget->currentField() );
}
void KABCore::setModified()
{
setModified( true );
}
void KABCore::setModifiedWOrefresh()
{
// qDebug("KABCore::setModifiedWOrefresh() ");
mModified = true;
mActionSave->setEnabled( mModified );
-#ifdef DESKTOP_VERSION
- mDetails->refreshView();
-#endif
+
}
void KABCore::setModified( bool modified )
{
mModified = modified;
mActionSave->setEnabled( mModified );
if ( modified )
mJumpButtonBar->recreateButtons();
mViewManager->refreshView();
- mDetails->refreshView();
}
bool KABCore::modified() const
{
return mModified;
}
void KABCore::contactModified( const KABC::Addressee &addr )
{
Command *command = 0;
QString uid;
// check if it exists already
KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
if ( origAddr.isEmpty() )
command = new PwNewCommand( mAddressBook, addr );
else {
command = new PwEditCommand( mAddressBook, origAddr, addr );
uid = addr.uid();
}
UndoStack::instance()->push( command );
RedoStack::instance()->clear();
-
+ mDetails->setAddressee( addr );
setModified( true );
}
void KABCore::newContact()
{
QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
QPtrList<KRES::Resource> kresResources;
QPtrListIterator<KABC::Resource> it( kabcResources );
KABC::Resource *resource;
while ( ( resource = it.current() ) != 0 ) {
++it;
if ( !resource->readOnly() ) {
KRES::Resource *res = static_cast<KRES::Resource*>( resource );
if ( res )
kresResources.append( res );
}
}
KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
resource = static_cast<KABC::Resource*>( res );
@@ -1612,49 +1609,48 @@ void KABCore::addressBookChanged()
/*US
QDictIterator<AddresseeEditorDialog> it( mEditorDict );
while ( it.current() ) {
if ( it.current()->dirty() ) {
QString text = i18n( "Data has been changed externally. Unsaved "
"changes will be lost." );
KMessageBox::information( this, text );
}
it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
++it;
}
*/
if (mEditorDialog)
{
if (mEditorDialog->dirty())
{
QString text = i18n( "Data has been changed externally. Unsaved "
"changes will be lost." );
KMessageBox::information( this, text );
}
QString currentuid = mEditorDialog->addressee().uid();
mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
}
mViewManager->refreshView();
-// mDetails->refreshView();
}
AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
const char *name )
{
if ( mEditorDialog == 0 ) {
mEditorDialog = new AddresseeEditorDialog( this, parent,
name ? name : "editorDialog" );
connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
SLOT( contactModified( const KABC::Addressee& ) ) );
//connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
// SLOT( slotEditorDestroyed( const QString& ) ) ;
}
return mEditorDialog;
}
void KABCore::slotEditorDestroyed( const QString &uid )
{
@@ -2268,49 +2264,48 @@ void KABCore::manageCategories( )
KABPrefs::instance()->writeConfig();
message(QString::number( count )+ i18n(" categories added to list! "));
} else {
QStringList catList = KABPrefs::instance()->mCustomCategories;
QStringList catIncList;
QStringList newCatList;
KABC::AddressBook::Iterator it;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
QStringList catIncList = (*it).categories();
int i;
if ( catIncList.count() ) {
newCatList.clear();
for( i = 0; i< catIncList.count(); ++i ) {
if ( catList.contains (catIncList[i])) {
newCatList.append( catIncList[i] );
}
}
newCatList.sort();
(*it).setCategories( newCatList );
mAddressBook->insertAddressee( (*it) );
}
}
setModified( true );
mViewManager->refreshView();
- mDetails->refreshView();
message( i18n("Removing categories done!"));
}
delete cp;
}
void KABCore::removeVoice()
{
if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
return;
KABC::Addressee::List list;
XXPortSelectDialog dlg( this, false, this );
if ( dlg.exec() )
list = dlg.contacts();
else
return;
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
if ( (*it).removeVoice() )
contactModified((*it) );
}
}
void KABCore::clipboardDataChanged()
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c7c12ff..85ffbdb 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -74,52 +74,49 @@ class Ir;
class KABCore : public QWidget, public KSyncInterface
{
Q_OBJECT
public:
KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
~KABCore();
#ifdef KAB_EMBEDDED
//US added functionality
QPopupMenu* getViewMenu() {return viewMenu;}
QPopupMenu* getFilterMenu() {return filterMenu;}
QPopupMenu* getSettingsMenu() {return settingsMenu;}
void addActionsManually();
#endif //KAB_EMBEDDED
/**
Restores the global settings.
*/
void restoreSettings();
- /**
- Saves the global settings.
- */
- void saveSettings();
+
/**
Returns a pointer to the StdAddressBook of the application.
*/
KABC::AddressBook *addressBook() const;
/**
Returns a pointer to the KConfig object of the application.
*/
static KConfig *config();
/**
Returns a pointer to the global KActionCollection object. So
other classes can register their actions easily.
*/
KActionCollection *actionCollection() const;
/**
Returns the current search field of the Incremental Search Widget.
*/
KABC::Field *currentSearchField() const;
/**
Returns the uid list of the currently selected contacts.
@@ -337,49 +334,51 @@ class KABCore : public QWidget, public KSyncInterface
Creates a KAddressBookPrinter, which will display the print
dialog and do the printing.
*/
void print();
/**
Registers a new GUI client, so plugins can register its actions.
*/
void addGUIClient( KXMLGUIClient *client );
void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
signals:
void contactSelected( const QString &name );
void contactSelected( const QPixmap &pixmap );
public slots:
void recieve(QString cmsg );
void getFile( bool success );
void syncFileRequest();
void setDetailsVisible( bool visible );
void setDetailsToState();
- // void slotSyncMenu( int );
+
+ void saveSettings();
+
private slots:
void updateToolBar();
void updateMainWindow();
void receive( const QCString& cmsg, const QByteArray& data );
void toggleBeamReceive( );
void disableBR(bool);
void setJumpButtonBarVisible( bool visible );
void setCaptionBack();
void importFromOL();
void extensionModified( const KABC::Addressee::List &list );
void extensionChanged( int id );
void clipboardDataChanged();
void updateActionMenu();
void configureKeyBindings();
void removeVoice();
#ifdef KAB_EMBEDDED
void configureResources();
#endif //KAB_EMBEDDED
void slotEditorDestroyed( const QString &uid );
void configurationChanged();
void addressBookChanged();
private:
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index 33bef5a..59bddd9 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -584,48 +584,49 @@ void ViewManager::setActiveFilter( int index )
if ( mActiveView ) {
mActiveView->setFilter( currentFilter );
mActiveView->refresh();
emit selected( QString::null );
}
}
void ViewManager::configureFilters()
{
FilterDialog dlg( this );
dlg.setFilters( mFilterList );
if ( dlg.exec() )
mFilterList = dlg.filters();
uint pos = mActionSelectFilter->currentItem();
mActionSelectFilter->setItems( filterNames() );
mActionSelectFilter->setCurrentItem( pos );
setActiveFilter( pos );
int cw = 150;
if (QApplication::desktop()->width() == 480 )
cw = 0;
mActionSelectFilter->setComboWidth( cw );
+ saveSettings();
}
QStringList ViewManager::filterNames() const
{
QStringList names( i18n( "No Filter" ) );
Filter::List::ConstIterator it;
for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
names.append( (*it).name() );
return names;
}
int ViewManager::filterPosition( const QString &name ) const
{
int pos = 0;
Filter::List::ConstIterator it;
for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos )
if ( name == (*it).name() )
return pos + 1;
return 0;
}