1
/***************************************************************************
2
* Copyright (C) 2009-2012 by Savoir-Faire Linux *
3
* Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> *
4
* Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>*
6
* This program is free software; you can redistribute it and/or modify *
7
* it under the terms of the GNU General Public License as published by *
8
* the Free Software Foundation; either version 3 of the License, or *
9
* (at your option) any later version. *
11
* This program is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU General Public License for more details. *
16
* You should have received a copy of the GNU General Public License *
17
* along with this program; if not, write to the *
18
* Free Software Foundation, Inc., *
19
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20
***************************************************************************/
24
#include "ui_dlgaccountsbase.h"
25
#include "AccountView.h"
26
#include "ConfigAccountList.h"
30
class QListWidgetItem;
36
///@struct CredentialData store credential informations
37
struct CredentialData {
38
QListWidgetItem* pointer ;
45
typedef QHash<QString, QString> StringHash; //Needed to fix a Qt foreach macro argument parsing bug
46
typedef QHash<QListWidgetItem*, CredentialData> QListWidgetItemHash; //Needed to fix a Qt foreach macro argument parsing bug
47
typedef QList<CredentialData> CredentialList;
49
///@class Private_AddCodecDialog Little dialog to add codec to the list
50
class Private_AddCodecDialog : public KDialog {
53
Private_AddCodecDialog(QList< StringHash > itemList, QStringList currentItems ,QWidget* parent = 0);
56
QTableWidget* codecTable;
62
void addCodec(QString alias);
66
* @author Jérémy Quentin <jeremy.quentin@gmail.com>
68
* \note see ticket #1309 for advices about how to improve this class.
70
class DlgAccounts : public QWidget, public Ui_DlgAccountsBase
74
DlgAccounts(KConfigDialog *parent = 0);
76
void saveAccount(QListWidgetItem * item);
79
* Fills the settings form in the right side with the
80
* settings of @p item.
82
* \note When the user creates a new account, its accountDetails
83
* map is empty, so the form is filled with blank strings,
84
* zeros... And when the user clicks \e Apply , these settings are
85
* saved just after the account is created. So be careful the form
86
* is filled with the right default settings if blank (as 600 for
87
* registration expire).
89
* @param item the item with which to fill the settings form
92
void loadAccount(QListWidgetItem * item);
96
ConfigAccountList* accountList ;
97
QList<StringHash> codecList ;
98
QListWidgetItemHash credentialInfo ;
99
CredentialList credentialList ;
100
bool accountListHasChanged ;
103
void loadCodecList();
106
void saveAccountList ();
107
void loadAccountList ();
109
void updateSettings ();
110
void updateWidgets ();
113
void changedAccountList ();
114
void connectAccountsChangedSignal ();
115
void disconnectAccountsChangedSignal ();
116
void on_button_accountUp_clicked ();
117
void on_button_accountDown_clicked ();
118
void on_button_accountAdd_clicked ();
119
void on_button_accountRemove_clicked ();
120
void codecChanged ();
121
void addCredential ();
122
void removeCredential ();
123
void enablePublished ();
124
void updateAccountStates ();
125
void updateAccountListCommands ();
127
void codecClicked ( const QModelIndex& model );
128
void updateStatusLabel ( QListWidgetItem* item );
129
void on_listWidget_accountList_currentItemChanged ( QListWidgetItem* current , QListWidgetItem * previous );
130
void selectCredential ( QListWidgetItem* item , QListWidgetItem* previous );
131
void addAccountToAccountList ( AccountView* account );
132
void updateStatusLabel ( AccountView* account );
133
void addCodec ( QString name = "" );
134
void updateCombo ( int value );
135
void loadCredentails ( QString accountId );
136
void saveCredential ( QString accountId );
137
void on_edit1_alias_textChanged ( const QString& text );
141
void updateButtons();