~noskcaj/ubuntu/saucy/sflphone/merge-1.2.3-2

« back to all changes in this revision

Viewing changes to kde/src/conf/dlgaccounts.h

  • Committer: Package Import Robot
  • Author(s): Francois Marier
  • Date: 2012-02-18 21:47:09 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120218214709-6362d71gqdsdkrj5
Tags: 1.0.2-1
* New upstream release
  - remove logging patch (applied upstream)
  - update s390 patch since it was partially applied upstream
* Include the Evolution plugin as a separate binary package

* Fix compilation issues on SH4 (closes: #658987)
* Merge Ubuntu's binutils-gold linking fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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>*
 
5
 *                                                                         *
 
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.                                   *
 
10
 *                                                                         *
 
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.                          *
 
15
 *                                                                         *
 
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
 ***************************************************************************/
 
21
#ifndef DLGACCOUNTS_H
 
22
#define DLGACCOUNTS_H
 
23
 
 
24
#include "ui_dlgaccountsbase.h"
 
25
#include "AccountView.h"
 
26
#include "ConfigAccountList.h"
 
27
 
 
28
//Qt
 
29
class QTableWidget;
 
30
class QListWidgetItem;
 
31
class QWidget;
 
32
 
 
33
//KDE
 
34
class KConfigDialog;
 
35
 
 
36
///@struct CredentialData store credential informations
 
37
struct CredentialData {
 
38
   QListWidgetItem* pointer ;
 
39
   QString          name    ;
 
40
   QString          password;
 
41
   QString          realm   ;
 
42
};
 
43
 
 
44
//Typedef
 
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;
 
48
 
 
49
///@class Private_AddCodecDialog Little dialog to add codec to the list
 
50
class Private_AddCodecDialog : public KDialog {
 
51
  Q_OBJECT
 
52
  public:
 
53
    Private_AddCodecDialog(QList< StringHash > itemList, QStringList currentItems ,QWidget* parent = 0);
 
54
 
 
55
  private:
 
56
    QTableWidget* codecTable;
 
57
 
 
58
  private slots:
 
59
    void emitNewCodec();
 
60
 
 
61
  signals:
 
62
    void addCodec(QString alias);
 
63
};
 
64
 
 
65
/**
 
66
 *  @author Jérémy Quentin <jeremy.quentin@gmail.com>
 
67
 *
 
68
 *  \note see ticket #1309 for advices about how to improve this class.
 
69
 */
 
70
class DlgAccounts : public QWidget, public Ui_DlgAccountsBase
 
71
{
 
72
Q_OBJECT
 
73
public:
 
74
   DlgAccounts(KConfigDialog *parent = 0);
 
75
 
 
76
   void saveAccount(QListWidgetItem * item);
 
77
 
 
78
   /**
 
79
    *   Fills the settings form in the right side with the
 
80
    *   settings of @p item.
 
81
    *
 
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).
 
88
    *
 
89
    * @param item the item with which to fill the settings form
 
90
    *
 
91
    */
 
92
   void loadAccount(QListWidgetItem * item);
 
93
 
 
94
private:
 
95
   ///Attributes
 
96
   ConfigAccountList*  accountList           ;
 
97
   QList<StringHash>   codecList             ;
 
98
   QListWidgetItemHash credentialInfo        ;
 
99
   CredentialList      credentialList        ;
 
100
   bool                accountListHasChanged ;
 
101
 
 
102
   ///Mutators
 
103
   void loadCodecList();
 
104
 
 
105
public slots:
 
106
   void saveAccountList ();
 
107
   void loadAccountList ();
 
108
   bool hasChanged      ();
 
109
   void updateSettings  ();
 
110
   void updateWidgets   ();
 
111
 
 
112
private slots:
 
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       ();
 
126
 
 
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                                      );
 
138
 
 
139
 
 
140
signals:
 
141
   void updateButtons();
 
142
 
 
143
};
 
144
 
 
145
#endif