Commit 0328e19d authored by Àlex Fiestas's avatar Àlex Fiestas
Browse files

Added default "New Account" item in the list

parent fac152d3
......@@ -33,11 +33,35 @@ K_EXPORT_PLUGIN(WebAccountsFactory("webaccounts", "webaccounts"))
WebAccounts::WebAccounts(QWidget *parent, const QVariantList&) : KCModule(WebAccountsFactory::componentData(), parent)
{
Ui::KCMWebAccounts *kcmUi = new Ui::KCMWebAccounts();
kcmUi->setupUi(this);
m_ui = new Ui::KCMWebAccounts();
m_ui->setupUi(this);
m_newAccountItem = new QListWidgetItem(i18n("New Account"), m_ui->accList);
m_newAccountItem->setIcon(QIcon::fromTheme("applications-education-miscellaneous"));
m_ui->accList->setIconSize(QSize(64, 64));
m_ui->accList->addItem(m_newAccountItem);
connect(m_ui->addBtn, SIGNAL(clicked(bool)), this, SLOT(addBtnClicked()));
connect(m_ui->accList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
this, SLOT(currentItemChanged(QListWidgetItem*,QListWidgetItem*)));
}
WebAccounts::~WebAccounts()
{}
{
delete m_ui;
}
void WebAccounts::addBtnClicked()
{
m_ui->accList->setCurrentItem(m_newAccountItem, QItemSelectionModel::SelectCurrent);
}
void WebAccounts::currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
{
if (current == m_newAccountItem) {
m_ui->accountInfo->setTitle(i18n("Select a supported Web Account"));
}
}
#include "webaccounts.moc"
......@@ -21,12 +21,26 @@
#include <kcmodule.h>
class QListWidgetItem;
namespace Ui {
class KCMWebAccounts;
}
class WebAccounts : public KCModule
{
Q_OBJECT
public:
WebAccounts(QWidget *parent, const QVariantList&);
virtual ~WebAccounts();
private Q_SLOTS:
void addBtnClicked();
void currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
private:
QListWidgetItem *m_newAccountItem;
Ui::KCMWebAccounts *m_ui;
};
#endif // webaccounts_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment