summaryrefslogtreecommitdiffstats
path: root/kitchensync/src/groupconfig.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kitchensync/src/groupconfig.cpp')
-rw-r--r--kitchensync/src/groupconfig.cpp58
1 files changed, 17 insertions, 41 deletions
diff --git a/kitchensync/src/groupconfig.cpp b/kitchensync/src/groupconfig.cpp
index 7e0af734a..cfedcbfad 100644
--- a/kitchensync/src/groupconfig.cpp
+++ b/kitchensync/src/groupconfig.cpp
@@ -27,10 +27,8 @@
#include "syncprocess.h"
#include "syncprocessmanager.h"
-#include <libqopensync/engine.h>
#include <libqopensync/group.h>
#include <libqopensync/plugin.h>
-#include <libqopensync/result.h>
#include <kdialog.h>
#include <kiconloader.h>
@@ -42,7 +40,6 @@
#include <tqlabel.h>
#include <tqlayout.h>
#include <tqpushbutton.h>
-#include <tqtimer.h>
GroupConfig::GroupConfig( TQWidget *parent )
: TQWidget( parent )
@@ -87,6 +84,14 @@ GroupConfig::GroupConfig( TQWidget *parent )
mMemberView = new KJanusWidget( this, 0, KJanusWidget::IconList );
topLayout->addWidget( mMemberView );
+ TQBoxLayout *buttonLayout = new TQHBoxLayout( topLayout );
+
+ TQPushButton *addButton = new TQPushButton( i18n("Add Member..."), this );
+ connect( addButton, TQT_SIGNAL( clicked() ), TQT_SLOT( addMember() ) );
+ buttonLayout->addWidget( addButton );
+
+ buttonLayout->addStretch( 1 );
+
icon = KGlobal::iconLoader()->loadIcon( "bookmark", KIcon::Desktop );
TQFrame *page = mMemberView->addPage( i18n("Group"),
i18n("General Group Settings"), icon );
@@ -94,8 +99,6 @@ GroupConfig::GroupConfig( TQWidget *parent )
mCommonConfig = new GroupConfigCommon( page );
pageLayout->addWidget( mCommonConfig );
-
- connect( mMemberView, TQT_SIGNAL( aboutToShowPage( TQWidget* ) ), TQT_SLOT( memberWidgetSelected( TQWidget* ) ) );
}
void GroupConfig::setSyncProcess( SyncProcess *process )
@@ -110,9 +113,9 @@ void GroupConfig::setSyncProcess( SyncProcess *process )
void GroupConfig::updateMembers()
{
- TQMap<TQWidget*, MemberConfig *>::ConstIterator memberIt;
+ TQValueList<MemberConfig *>::ConstIterator memberIt;
for ( memberIt = mMemberConfigs.begin(); memberIt != mMemberConfigs.end(); ++memberIt )
- memberIt.data()->saveData();
+ (*memberIt)->saveData();
TQValueList<TQFrame *>::ConstIterator it2;
for ( it2 = mConfigPages.begin(); it2 != mConfigPages.end(); ++it2 ) {
@@ -122,9 +125,10 @@ void GroupConfig::updateMembers()
mConfigPages.clear();
mMemberConfigs.clear();
- const QSync::Group group = mProcess->group();
- for ( int i = 0; i < group.memberCount(); ++i ) {
- QSync::Member member = group.memberAt( i );
+ QSync::Group group = mProcess->group();
+ QSync::Group::Iterator it( group.begin() );
+ for ( ; it != group.end(); ++it ) {
+ QSync::Member member = *it;
MemberInfo mi( member );
TQFrame *page = mMemberView->addPage( mi.name(),
TQString( "%1 (%2)" ).arg( mi.name() ).arg(member.pluginName()), mi.desktopIcon() );
@@ -133,7 +137,7 @@ void GroupConfig::updateMembers()
mConfigPages.append( page );
MemberConfig *memberConfig = new MemberConfig( page, member );
- mMemberConfigs.insert( page, memberConfig );
+ mMemberConfigs.append( memberConfig );
pageLayout->addWidget( memberConfig );
memberConfig->loadData();
@@ -144,30 +148,15 @@ void GroupConfig::saveConfig()
{
mProcess->group().save();
- TQMap<TQWidget*, MemberConfig*>::ConstIterator it;
+ TQValueList<MemberConfig *>::ConstIterator it;
for ( it = mMemberConfigs.begin(); it != mMemberConfigs.end(); ++it )
- it.data()->saveData();
+ (*it)->saveData();
mCommonConfig->save();
- const QSync::Group group = mProcess->group();
- for ( int i = 0; i < group.memberCount(); ++i ) {
- const QSync::Member member = group.memberAt( i );
- mProcess->engine()->discover( member );
- }
-
mProcess->reinitEngine();
}
-void GroupConfig::memberWidgetSelected( TQWidget *wdg )
-{
- /**
- * Emit 'true' whenever a real member widget is selected by the
- * user.
- */
- emit memberSelected( wdg != mCommonConfig->parentWidget() );
-}
-
void GroupConfig::addMember()
{
QSync::Plugin plugin = PluginPickerDialog::getPlugin( this );
@@ -187,17 +176,4 @@ void GroupConfig::addMember()
}
}
-void GroupConfig::removeMember()
-{
- TQWidget *selectedWidget = mMemberView->pageWidget( mMemberView->activePageIndex() );
- if ( selectedWidget && mMemberConfigs.contains( selectedWidget ) ) {
- MemberConfig *config = mMemberConfigs[ selectedWidget ];
-
- SyncProcessManager::self()->removeMember( mProcess, config->member() );
- mMemberConfigs.remove( selectedWidget );
-
- TQTimer::singleShot( 0, this, TQT_SLOT( updateMembers() ) );
- }
-}
-
#include "groupconfig.moc"