File indexing completed on 2023-12-03 08:28:37
0001 /* 0002 * Copyright (C) 2012 David Edmundson <kde@davidedmundson.co.uk> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public 0015 * License along with this library; if not, write to the Free Software 0016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 0017 */ 0018 0019 0020 #ifndef ACCOUNTSCOMBOBOX_H 0021 #define ACCOUNTSCOMBOBOX_H 0022 0023 #include <QComboBox> 0024 #include <TelepathyQt/Types> 0025 0026 #include <KTp/ktpcommoninternals_export.h> 0027 0028 namespace KTp { 0029 0030 class KTPCOMMONINTERNALS_EXPORT AccountsComboBox : public QComboBox 0031 { 0032 Q_OBJECT 0033 Q_DISABLE_COPY(AccountsComboBox) 0034 public: 0035 explicit AccountsComboBox(QWidget *parent = nullptr); 0036 ~AccountsComboBox() override; 0037 0038 public: 0039 /** A set of accounts to show. 0040 * See AccountsListModel::setAccountSet for details 0041 */ 0042 void setAccountSet(const Tp::AccountSetPtr &accountSet); 0043 0044 /** The currently selected account 0045 * @return the select account this pointer will be null if no account is selected 0046 */ 0047 Tp::AccountPtr currentAccount(); 0048 0049 0050 /** Sets the index to the account with the specified ID, provided it exists in the account set 0051 * This may be used to save/restore the last used account when showing the combo box 0052 * @param selectedAccountId the account id as found from Tp::Account::uniqueIdentifier 0053 */ 0054 void setCurrentAccount(const QString &selectedAccountId); 0055 0056 /** Sets the index to the specified account, provided it exists in the account set 0057 @param selectedAccount the account to select 0058 */ 0059 void setCurrentAccount(const Tp::AccountPtr &selectedAccount); 0060 0061 private: 0062 class Private; 0063 Private * const d; 0064 }; 0065 } 0066 0067 #endif // ACCOUNTSCOMBOBOX_H