1 /** \file TocAccountSettingsWidget.h
2 * \brief Declaration of TocAccountSettingsWidget class
4 * Tieto Open Communicator - Client for the Telepathy communications framework.
5 * Copyright (c) 2010, Tieto Corporation
8 * Redistribution and use in source and binary forms, with or without modification,
9 * are permitted provided that the following conditions are met:
11 * Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 * Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 * Neither the name of the Tieto Corporation nor the names of its contributors
17 * may be used to endorse or promote products derived from this software without
18 * specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef TOCACCOUNTSETTINGSWIDGET_H
33 #define TOCACCOUNTSETTINGSWIDGET_H
38 class Ui_TocAccountSettingsWidgetClass;
42 /** \brief TocAccountSettingsWidget class
44 * Configuration window for account settings.
46 class TocAccountSettingsWidget : public QWidget
55 TocAccountSettingsWidget( QWidget * parent = 0, Qt::WindowFlags flags = 0 );
60 ~TocAccountSettingsWidget();
62 /** \brief Virtual method called when widget is about to be shown
64 * Overloaded method used to reload account list, when widget is shown
66 * @param type of show event
68 void showEvent(QShowEvent *event);
70 /** \brief Checks wheter or not widget is in Ftu mode
72 * Returns true if `Create mode` is enabled, otherwise false
75 inline bool createMode() const;
77 /** \brief Allows enabling/disabling Create mode during runtime
79 * Method for switching `Create mode` on and off
81 * @param bool create Indicates if widget should enter Create mode
83 void setCreateMode( bool create );
85 /** \brief Connects server and protocol hints
87 * Used to enable server and protocol hints
94 /** \brief Emited when user clicks 'Ok' button
96 * This signal is emited when user changes settings by pressing 'Ok' button
97 * and new settings differs from previous.
98 * Settings of account are already changed, when signal is emitted.
101 void accountSettingsChanged();
103 /** \brief Emited when user clicks 'Create' button during `Create mode`
105 * This signal is emited when user creates settings by pressing 'Create' button.
106 * Settings of account are already saved, when signal is emitted.
109 void newAccountSettingsCreated();
111 /** \brief Emited when user clicks 'Ok' or 'Create' button
113 * This signal is emited when user chooses to close widget by pressing 'Ok' or 'Create' button
114 * regardless if current account was changed.
119 /** \brief Emited when user wants to go to the previous screen
126 /** \brief Reloads accounts list
128 * This method is used to reload account data when it has changed.
135 /** \brief Commits new data
137 * Verifies data and either triggers creation of new account or stores altered data.
141 /** \brief Allows to change password
143 * Shows layout for password change.
145 void onChangePasswordButton();
147 /** \brief Connected to textEdited signal from loginLineEdit
149 * Sets text for serverLineEdit and portLineEdit according to new login
151 * @param newLogin new login received from signal
153 void loginEdited(const QString& newLogin);
155 /** \brief Connected to currentIndexChanged signal from protocolComboBox
157 * Sets text for serverLineEdit and portLineEdit according to new protocol
159 * @param newProtocol new protocol name received from signal
161 void protocolEdited(const QString& newProtocol);
163 /** \brief Disconnects server and protocol hints
165 * Used to disable server and protocol hints when user already changed the server
166 * (It would be annoying if hints reset his personaly chosen server and port)
168 void disconnectHints();
172 /** \brief Displays error message
174 * @param errorText text of error to be displayed
176 void handleError(QString errorText);
178 /** \brief Validates corectness of entered data
180 * @return True if data is corect
184 /** \brief Saves edited data
186 * If no property was changed it does nothing
188 void saveAccountData();
190 /** \brief Creates new account from the data
193 void createNewAccount();
197 Ui_TocAccountSettingsWidgetClass* ui; /// Ui definition header
198 bool _bCreateMode; /// Tells if widget is in `Create mode`
204 #endif // TOCACCOUNTSETTINGSWIDGET_H