[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Btelepathy-accounts-kcm=5D_src=3A_Add_a_option_to_le?=
From: Rohan Garg <rohangarg () kubuntu ! org>
Date: 2011-04-05 18:08:46
Message-ID: 20110405180846.A3E59A609B () git ! kde ! org
[Download RAW message or body]
Git commit 10ad86504cef9370c9e787ec7edabcd74a2e280e by Rohan Garg.
Committed on 05/04/2011 at 20:07.
Pushed by garg into branch 'master'.
Add a option to let the user go online as soon as the wizard exits
REVIEW: 101031
BUG: 269911
M +24 -0 src/KCMTelepathyAccounts/account-edit-widget.cpp
M +6 -0 src/KCMTelepathyAccounts/account-edit-widget.h
M +6 -0 src/add-account-assistant.cpp
M +1 -0 src/edit-account-dialog.cpp
http://commits.kde.org/telepathy-accounts-kcm/10ad86504cef9370c9e787ec7edabcd74a2e280e
diff --git a/src/KCMTelepathyAccounts/account-edit-widget.cpp \
b/src/KCMTelepathyAccounts/account-edit-widget.cpp index 5c09e5d..4750148 100644
--- a/src/KCMTelepathyAccounts/account-edit-widget.cpp
+++ b/src/KCMTelepathyAccounts/account-edit-widget.cpp
@@ -33,6 +33,8 @@
#include <TelepathyQt4/Profile>
#include <QtCore/QList>
+#include <QtGui/QCheckBox>
+
class AccountEditWidget::Private
{
@@ -47,6 +49,8 @@ public:
QString protocol;
QString serviceName;
+ QCheckBox *connectOnAdd;
+
ParameterEditModel *parameterModel;
AbstractAccountUi *accountUi;
@@ -56,6 +60,7 @@ public:
AccountEditWidget::AccountEditWidget(const Tp::ProfilePtr &profile,
ParameterEditModel *parameterModel,
+ ConnectOnLoadType connectOnAddFlag,
QWidget *parent)
: QWidget(parent),
d(new Private)
@@ -84,6 +89,15 @@ AccountEditWidget::AccountEditWidget(const Tp::ProfilePtr \
&profile, d->ui->iconLabel->setText("");
d->ui->iconLabel->setPixmap(KIcon(profile->iconName()).pixmap(32));
+ if(connectOnAddFlag == doConnectOnAdd){
+ d->connectOnAdd = new QCheckBox(i18n("Connect when wizard is finished"), this);
+ d->connectOnAdd->setChecked(true);
+ d->ui->verticalLayout->addWidget(d->connectOnAdd);
+ }
+ else{
+ d->connectOnAdd = 0;
+ }
+
loadWidgets();
}
@@ -213,5 +227,15 @@ ParameterEditModel* AccountEditWidget::parameterModel() const
return d->parameterModel;
}
+bool AccountEditWidget::connectOnAdd()
+{
+ if(d->connectOnAdd == 0){
+ return false;
+ }
+ else{
+ return d->connectOnAdd->isChecked();
+ }
+}
+
#include "account-edit-widget.moc"
diff --git a/src/KCMTelepathyAccounts/account-edit-widget.h \
b/src/KCMTelepathyAccounts/account-edit-widget.h index 8e0c7ea..2c79b11 100644
--- a/src/KCMTelepathyAccounts/account-edit-widget.h
+++ b/src/KCMTelepathyAccounts/account-edit-widget.h
@@ -29,6 +29,10 @@
#include <TelepathyQt4/ConnectionManager>
#include "parameter-edit-model.h"
+enum ConnectOnLoadType{
+ doConnectOnAdd,
+ doNotConnectOnAdd
+};
class KCM_TELEPATHY_ACCOUNTS_EXPORT AccountEditWidget : public QWidget
{
@@ -37,10 +41,12 @@ class KCM_TELEPATHY_ACCOUNTS_EXPORT AccountEditWidget : public \
QWidget public:
explicit AccountEditWidget(const Tp::ProfilePtr &info,
ParameterEditModel *parameterModel,
+ ConnectOnLoadType connectOnAddFlag = \
doNotConnectOnAdd, QWidget *parent = 0);
virtual ~AccountEditWidget();
virtual bool validateParameterValues() const;
+ bool connectOnAdd();
virtual QVariantMap parametersSet() const;
virtual QStringList parametersUnset() const;
diff --git a/src/add-account-assistant.cpp b/src/add-account-assistant.cpp
index e038e8b..4225010 100644
--- a/src/add-account-assistant.cpp
+++ b/src/add-account-assistant.cpp
@@ -36,6 +36,7 @@
#include <QtCore/QList>
#include <QtGui/QHBoxLayout>
+#include <QtGui/QCheckBox>
#include <TelepathyQt4/PendingReady>
#include <TelepathyQt4/PendingAccount>
@@ -214,6 +215,10 @@ void AddAccountAssistant::onAccountCreated(Tp::PendingOperation \
*op) return;
}
+ if(d->accountEditWidget->connectOnAdd()){
+ pendingAccount->account()->setRequestedPresence(Tp::Presence::available(QString("Online")));
+ }
+
KAssistantDialog::accept();
}
@@ -262,6 +267,7 @@ void AddAccountAssistant::pageTwo()
// Set up the account edit widget.
d->accountEditWidget = new AccountEditWidget(d->currentProfileItem->profile(),
parameterModel,
+ doConnectOnAdd,
d->pageTwoWidget);
d->pageTwoWidget->layout()->addWidget(d->accountEditWidget);
diff --git a/src/edit-account-dialog.cpp b/src/edit-account-dialog.cpp
index 2772c61..0d398c1 100644
--- a/src/edit-account-dialog.cpp
+++ b/src/edit-account-dialog.cpp
@@ -72,6 +72,7 @@ EditAccountDialog::EditAccountDialog(AccountItem *item, QWidget \
*parent) // Set up the interface
d->widget = new AccountEditWidget(d->item->account()->profile(),
parameterModel,
+ doNotConnectOnAdd,
this);
setMainWidget(d->widget);
setMinimumWidth(400);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic