summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/configpage.cpp
authorulf69 <ulf69>2004-08-02 18:15:04 (UTC)
committer ulf69 <ulf69>2004-08-02 18:15:04 (UTC)
commite084a79b8aa0174e7587893f9b87d88670ed9f2c (patch) (side-by-side diff)
treed3250447b9352effc8fb953866c772418c5e166c /microkde/kresources/configpage.cpp
parentb4203356adb6008a4b4e6782afdae7dd34178697 (diff)
downloadkdepimpi-e084a79b8aa0174e7587893f9b87d88670ed9f2c.zip
kdepimpi-e084a79b8aa0174e7587893f9b87d88670ed9f2c.tar.gz
kdepimpi-e084a79b8aa0174e7587893f9b87d88670ed9f2c.tar.bz2
added support for the syncing of resources
Diffstat (limited to 'microkde/kresources/configpage.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/configpage.cpp75
1 files changed, 50 insertions, 25 deletions
diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp
index 8782ffd..912c62e 100644
--- a/microkde/kresources/configpage.cpp
+++ b/microkde/kresources/configpage.cpp
@@ -21,6 +21,13 @@
Boston, MA 02111-1307, USA.
*/
+/*
+Enhanced Version of the file for platform independent KDE tools.
+Copyright (c) 2004 Ulf Schenk
+
+$Id$
+*/
+
#include <qgroupbox.h>
#include <qinputdialog.h>
#include <qlabel.h>
@@ -50,6 +57,9 @@
using namespace KRES;
+const QString ConfigPage::syncfamily = "syncprofiles";
+
+
class ConfigViewItem : public QCheckListItem
{
public:
@@ -164,13 +174,15 @@ void ConfigPage::load()
//US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" );
//US QString family = tmp.toString();
QStringList families;
- families << "contact" << "sync-contacts";
+ families << "contact" << syncfamily;
+
+
for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it )
- {
+ {
QString family = (*it);
if ( !family.isEmpty() ) {
if ( !mFamilyMap.contains( family ) ) {
- mCurrentManager = new Manager<Resource>( family );
+ mCurrentManager = new Manager<Resource>( family, (family == syncfamily) );
if ( mCurrentManager ) {
mFamilyMap.append( family );
mCurrentManager->addListener( this );
@@ -228,7 +240,7 @@ void ConfigPage::slotFamilyChanged( int pos )
mFamily = mFamilyMap[ pos ];
//US qDebug("ConfigPage::slotFamilyChanged 4 family=%s", mFamily.latin1());
-
+
mCurrentManager = mInfoMap[ pos ].mManager;
mCurrentConfig = mInfoMap[ pos ].mConfig;
@@ -239,22 +251,22 @@ void ConfigPage::slotFamilyChanged( int pos )
if ( mCurrentManager->isEmpty() ) {
//US qDebug("ConfigPage::slotFamilyChanged 4.1 mCurrentManager=%ul", mCurrentManager );
-
+
defaults();
}
-
+
Resource *standardResource = mCurrentManager->standardResource();
-
+
//US qDebug("ConfigPage::slotFamilyChanged 4.4 resourcename=%s", standardResource->resourceName().latin1());
-
+
Manager<Resource>::Iterator it;
for ( it = mCurrentManager->begin(); it != mCurrentManager->end(); ++it ) {
ConfigViewItem *item = new ConfigViewItem( mListView, *it );
if ( *it == standardResource )
item->setStandard( true );
}
-
+
if ( mListView->childCount() == 0 ) {
//US qDebug("ConfigPage::slotFamilyChanged 4.5 ");
@@ -263,12 +275,12 @@ void ConfigPage::slotFamilyChanged( int pos )
mCurrentManager->writeConfig( mCurrentConfig );
} else {
//US qDebug("ConfigPage::slotFamilyChanged 4.6 ");
-
+
if ( !standardResource ) {
- KMessageBox::sorry( this, i18n( "There is no standard resource! Please select one." ) );
-
+ KMessageBox::sorry( this, i18n( "There is no standard resource!<br> Please select one." ) );
+
//US qDebug("ConfigPage::slotFamilyChanged 4.7" );
-
+
}
emit changed( false );
@@ -283,9 +295,22 @@ void ConfigPage::slotAdd()
QStringList types = mCurrentManager->resourceTypeNames();
QStringList descs = mCurrentManager->resourceTypeDescriptions();
bool ok = false;
- QString desc = QInputDialog::getItem( i18n( "Resource Configuration" ),
- i18n( "Please select type of the new resource:" ), descs, 0,
+
+ QString desc;
+
+ if (mFamily == syncfamily)
+ {
+ desc = QInputDialog::getItem( i18n( "Sync Configuration" ),
+ i18n( "Please select resource type for new sync profile:" ), descs, 0,
+ false, &ok, this );
+ }
+ else
+ {
+ desc = QInputDialog::getItem( i18n( "Resource Configuration" ),
+ i18n( "Please select type of the new resource:" ), descs, 0,
false, &ok, this );
+ }
+
if ( !ok )
return;
@@ -380,7 +405,7 @@ void ConfigPage::slotEdit()
configItem->setText( 1, resource->type() );
if ( configItem->standard() && configItem->readOnly() ) {
- KMessageBox::sorry( this, i18n( "You cannot use a read-only resource as standard!" ) );
+ KMessageBox::sorry( this, i18n( "You cannot use a read-only<br> resource as standard!" ) );
configItem->setStandard( false );
}
@@ -399,12 +424,12 @@ void ConfigPage::slotStandard()
return;
if ( item->readOnly() ) {
- KMessageBox::sorry( this, i18n( "You cannot use a read-only resource as standard!" ) );
+ KMessageBox::sorry( this, i18n( "You cannot use a read-only<br>resource as standard!" ) );
return;
}
if ( !item->isOn() ) {
- KMessageBox::sorry( this, i18n( "You cannot use an inactive resource as standard!" ) );
+ KMessageBox::sorry( this, i18n( "You cannot use an inactive<br>resource as standard!" ) );
return;
}
@@ -464,7 +489,7 @@ void ConfigPage::slotItemClicked( QListViewItem *item )
if ( !configItem ) return;
if ( configItem->standard() && !configItem->isOn() ) {
- KMessageBox::sorry( this, i18n( "You cannot deactivate the standard resource. Choose another standard resource first." ) );
+ KMessageBox::sorry( this, i18n( "You cannot deactivate the<br>standard resource. Choose<br>another standard resource first." ) );
configItem->setOn( true );
return;
}
@@ -479,7 +504,7 @@ void ConfigPage::saveResourceSettings()
qDebug("ConfigPage::saveResourceSettings() begin");
if ( mCurrentManager ) {
-
+
QListViewItem *item = mListView->firstChild();
while ( item ) {
ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item );
@@ -487,10 +512,10 @@ void ConfigPage::saveResourceSettings()
// check if standard resource
if ( configItem->standard() && !configItem->readOnly() &&
configItem->isOn() ) {
-
+
mCurrentManager->setStandardResource( configItem->resource() );
}
-
+
// check if active or passive resource
configItem->resource()->setActive( configItem->isOn() );
@@ -499,11 +524,11 @@ void ConfigPage::saveResourceSettings()
mCurrentManager->writeConfig( mCurrentConfig );
if ( !mCurrentManager->standardResource() )
- KMessageBox::sorry( this, i18n( "There is no valid standard resource! Please select one which is neither read-only nor inactive." ) );
+ KMessageBox::sorry( this, i18n( "There is no valid standard resource!<br>Please select one which is neither read-only nor inactive." ) );
}
-
+
qDebug("ConfigPage::saveResourceSettings() end");
-
+
}
//US #include "configpage.moc"