diff --git a/src/core/model/rocketchataccountmodel.cpp b/src/core/model/rocketchataccountmodel.cpp index c1784267..27f9f53e 100644 --- a/src/core/model/rocketchataccountmodel.cpp +++ b/src/core/model/rocketchataccountmodel.cpp @@ -1,150 +1,151 @@ /* Copyright (c) 2018-2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "rocketchataccountmodel.h" #include "rocketchataccount.h" #include "ruqolaserverconfig.h" #include "ruqola_debug.h" RocketChatAccountModel::RocketChatAccountModel(QObject *parent) : QAbstractListModel(parent) { } RocketChatAccountModel::~RocketChatAccountModel() { qDeleteAll(mRocketChatAccount); } void RocketChatAccountModel::clear() { if (!mRocketChatAccount.isEmpty()) { beginRemoveRows(QModelIndex(), 0, rowCount() - 1); qDeleteAll(mRocketChatAccount); mRocketChatAccount.clear(); endRemoveRows(); } Q_EMIT accountNumberChanged(); } void RocketChatAccountModel::setAccounts(const QVector &accounts) { if (rowCount() != 0) { beginRemoveRows(QModelIndex(), 0, mRocketChatAccount.count() - 1); mRocketChatAccount.clear(); endRemoveRows(); } if (!accounts.isEmpty()) { beginInsertRows(QModelIndex(), 0, accounts.count() - 1); mRocketChatAccount = accounts; endInsertRows(); } Q_EMIT accountNumberChanged(); } RocketChatAccount *RocketChatAccountModel::account(const QString &accountName) const { if (mRocketChatAccount.isEmpty()) { qCWarning(RUQOLA_LOG) << " Empty account"; return nullptr; } - for (int i = 0; i < mRocketChatAccount.count(); ++i) { - if (mRocketChatAccount.at(i)->accountName() == accountName) { - return mRocketChatAccount.at(i); + for (int i = 0, total = mRocketChatAccount.count(); i < total; ++i) { + RocketChatAccount *model = mRocketChatAccount.at(i); + if (model->accountName() == accountName) { + return model; } } return nullptr; } int RocketChatAccountModel::accountNumber() const { return mRocketChatAccount.count(); } RocketChatAccount *RocketChatAccountModel::account(int index) const { if (mRocketChatAccount.isEmpty() || (index > mRocketChatAccount.count() - 1)) { qCWarning(RUQOLA_LOG) << " Empty account"; return nullptr; } return mRocketChatAccount.at(index); } int RocketChatAccountModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent) return mRocketChatAccount.count(); } QVariant RocketChatAccountModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) { qCWarning(RUQOLA_LOG) << "ERROR: invalid index"; return {}; } const int idx = index.row(); RocketChatAccount *account = mRocketChatAccount.at(idx); switch (role) { case Name: return account->accountName(); case SiteUrl: return account->ruqolaServerConfig()->siteUrl(); case UserName: return account->userName(); } //Add icon ??? return {}; } void RocketChatAccountModel::insertAccount(RocketChatAccount *account) { //Verify that we have it ? const int accountCount = mRocketChatAccount.count(); beginInsertRows(QModelIndex(), accountCount, accountCount); mRocketChatAccount.append(account); endInsertRows(); Q_EMIT accountNumberChanged(); } void RocketChatAccountModel::removeAccount(const QString &name) { //qDebug() << " void RocketChatAccountModel::removeAccount(const QString &name)"<accountName() == name) { beginRemoveRows(QModelIndex(), i, i); RocketChatAccount *account = mRocketChatAccount.takeAt(i); account->removeSettings(); delete account; endRemoveRows(); Q_EMIT accountNumberChanged(); break; } } } QHash RocketChatAccountModel::roleNames() const { QHash roles; roles[Name] = QByteArrayLiteral("name"); roles[SiteUrl] = QByteArrayLiteral("siteurl"); roles[UserName] = QByteArrayLiteral("username"); return roles; } diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index 06041200..a3b02cf7 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -1,118 +1,123 @@ set(Ruqola_widgets_SRCS ruqolamainwindow.cpp ruqolacentralwidget.cpp ruqolaloginwidget.cpp ruqolamainwidget.cpp ) set(Ruqola_widgets_dialog_SRCS dialogs/serverinfowidget.cpp dialogs/serverinfodialog.cpp dialogs/uploadfiledialog.cpp dialogs/uploadfilewidget.cpp dialogs/channelinfowidget.cpp dialogs/channelinfodialog.cpp dialogs/searchchanneldialog.cpp dialogs/searchchannelwidget.cpp dialogs/modifystatusdialog.cpp dialogs/modifystatuswidget.cpp dialogs/createnewchanneldialog.cpp dialogs/createnewchannelwidget.cpp dialogs/showlistmessagebasedialog.cpp dialogs/showlistmessagebasewidget.cpp dialogs/createnewaccountdialog.cpp dialogs/createnewaccountwidget.cpp dialogs/showpinnedmessagesdialog.cpp dialogs/showstarredmessagesdialog.cpp dialogs/showmentionsmessagesdialog.cpp dialogs/showsnipperedmessagesdialog.cpp dialogs/configurenotificationdialog.cpp dialogs/configurenotificationwidget.cpp dialogs/searchmessagedialog.cpp dialogs/searchmessagewidget.cpp dialogs/reportmessagedialog.cpp dialogs/reportmessagewidget.cpp dialogs/showimagedialog.cpp dialogs/showimagewidget.cpp dialogs/showattachmentdialog.cpp dialogs/showattachmentwidget.cpp dialogs/directchannelinfodialog.cpp dialogs/directchannelinfowidget.cpp ) set(Ruqola_configure_SRCS - dialogs/configuresettingsdialog.cpp - dialogs/configureaccountwidget.cpp + configuredialog/configuresettingsdialog.cpp + configuredialog/configureaccountwidget.cpp + configuredialog/accountserverlistwidget.cpp + ) + +ki18n_wrap_ui(Ruqola_configure_SRCS + configuredialog/configureaccountserverwidget.ui ) set(Ruqola_channellist_SRCS channellist/channellistwidget.cpp channellist/statuscombobox.cpp channellist/channellistview.cpp channellist/channellistdelegate.cpp ) set(Ruqola_roomwidget_SRCS room/roomwidget.cpp room/roomheaderwidget.cpp room/messagelistview.cpp room/messagelineedit.cpp room/messagelistdelegate.cpp room/messagedelegatehelperbase.cpp room/messagedelegatehelpertext.cpp room/messagedelegatehelperimage.cpp room/messagedelegatehelperfile.cpp room/messagelinewidget.cpp ) set(Ruqola_misc_widget_SRCS accountmenu.cpp ) ecm_qt_declare_logging_category(Ruqola_widgets_SRCS HEADER ruqolawidgets_debug.h IDENTIFIER RUQOLAWIDGETS_LOG CATEGORY_NAME org.kde.ruqola.widgets) qt5_add_resources(Ruqola_widgets_SRCS ruqolawidget.qrc) add_library(libruqolawidgets ${Ruqola_widgets_SRCS} ${Ruqola_widgets_dialog_SRCS} ${Ruqola_channellist_SRCS} ${Ruqola_roomwidget_SRCS} ${Ruqola_configure_SRCS} ${Ruqola_misc_widget_SRCS} ) generate_export_header(libruqolawidgets BASE_NAME libruqolawidgets) target_link_libraries(libruqolawidgets Qt5::Gui Qt5::Widgets KF5::I18n KF5::ConfigCore KF5::XmlGui KF5::KIOWidgets KF5::WidgetsAddons librocketchatrestapi-qt5 libruqolacore ) if (NOT WIN32) target_link_libraries(libruqolawidgets Qt5::DBus) endif() set_target_properties(libruqolawidgets PROPERTIES OUTPUT_NAME ruqolawidgets VERSION ${RUQOLA_LIB_VERSION} SOVERSION ${RUQOLA_LIB_SOVERSION} ) if (BUILD_TESTING) add_subdirectory(autotests) add_subdirectory(tests) add_subdirectory(channellist/autotests) add_subdirectory(room/autotests) add_subdirectory(dialogs/autotests) endif() install(TARGETS libruqolawidgets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) diff --git a/src/widgets/dialogs/configureaccountwidget.cpp b/src/widgets/configuredialog/accountserverlistwidget.cpp similarity index 50% copy from src/widgets/dialogs/configureaccountwidget.cpp copy to src/widgets/configuredialog/accountserverlistwidget.cpp index 53cd575a..260d0e22 100644 --- a/src/widgets/dialogs/configureaccountwidget.cpp +++ b/src/widgets/configuredialog/accountserverlistwidget.cpp @@ -1,46 +1,73 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "configureaccountwidget.h" -#include +#include "accountserverlistwidget.h" + #include -ConfigureAccountWidget::ConfigureAccountWidget(QWidget *parent) - : QWidget(parent) +#include +#include + +AccountServerListWidget::AccountServerListWidget(QWidget *parent) + : QListWidget(parent) { - QVBoxLayout *mainLayout = new QVBoxLayout(this); - mainLayout->setObjectName(QStringLiteral("mainLayout")); - mainLayout->setContentsMargins(0, 0, 0, 0); + connect(this, &AccountServerListWidget::itemDoubleClicked, this, &AccountServerListWidget::modifyServerConfig); } -ConfigureAccountWidget::~ConfigureAccountWidget() +AccountServerListWidget::~AccountServerListWidget() { +} +void AccountServerListWidget::readConfig() +{ } -void ConfigureAccountWidget::save() +void AccountServerListWidget::writeConfig() { - //TODO } -void ConfigureAccountWidget::load() +void AccountServerListWidget::modifyServerConfig() { + QListWidgetItem *item = currentItem(); + if (!item) { + return; + } + + //AccountServerListWidgetItem *serverSieveListItem = static_cast(item); //TODO } + +void AccountServerListWidget::deleteServerConfig(QListWidgetItem *item) +{ +} + +void AccountServerListWidget::addServerConfig() +{ +} + +AccountServerListWidgetItem::AccountServerListWidgetItem(QListWidget *parent) + : QListWidgetItem(parent) +{ +} + +AccountServerListWidgetItem::~AccountServerListWidgetItem() +{ +} + diff --git a/src/widgets/dialogs/configuresettingsdialog.h b/src/widgets/configuredialog/accountserverlistwidget.h similarity index 61% copy from src/widgets/dialogs/configuresettingsdialog.h copy to src/widgets/configuredialog/accountserverlistwidget.h index eb81b72f..47abd050 100644 --- a/src/widgets/dialogs/configuresettingsdialog.h +++ b/src/widgets/configuredialog/accountserverlistwidget.h @@ -1,43 +1,51 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef ACCOUNTSERVERLISTWIDGET_H +#define ACCOUNTSERVERLISTWIDGET_H -#ifndef CONFIGURESETTINGSDIALOG_H -#define CONFIGURESETTINGSDIALOG_H - -#include +#include #include "libruqolawidgets_private_export.h" -class ConfigureAccountWidget; -class LIBRUQOLAWIDGETS_EXPORT ConfigureSettingsDialog : public KPageDialog +#include "user.h" +class ModifyStatusWidget; +class AccountServerListWidgetItem : public QListWidgetItem +{ +public: + explicit AccountServerListWidgetItem(QListWidget *parent = nullptr); + ~AccountServerListWidgetItem(); +}; + +class LIBRUQOLAWIDGETS_EXPORT AccountServerListWidget : public QListWidget { Q_OBJECT public: - explicit ConfigureSettingsDialog(QWidget *parent = nullptr); - ~ConfigureSettingsDialog(); -private: + explicit AccountServerListWidget(QWidget *parent = nullptr); + ~AccountServerListWidget(); + void readConfig(); void writeConfig(); - void slotAccepted(); - void load(); - KPageWidgetItem *mConfigureAccountWidgetPage = nullptr; - ConfigureAccountWidget *mConfigureAccountWidget = nullptr; + void addServerConfig(); + void deleteServerConfig(QListWidgetItem *item); + +public Q_SLOTS: + void modifyServerConfig(); }; -#endif // CONFIGURESETTINGSDIALOG_H +#endif // ACCOUNTSERVERLISTWIDGET_H diff --git a/src/widgets/configuredialog/configureaccountserverwidget.ui b/src/widgets/configuredialog/configureaccountserverwidget.ui new file mode 100644 index 00000000..eacb8ca1 --- /dev/null +++ b/src/widgets/configuredialog/configureaccountserverwidget.ui @@ -0,0 +1,69 @@ + + + ConfigureAccountServerWidget + + + + 0 + 0 + 400 + 300 + + + + + 0 + + + + + + + + + + Add... + + + + + + + Modify... + + + + + + + Remove + + + + + + + + + Qt::Vertical + + + + 20 + 193 + + + + + + + + + AccountServerListWidget + QListWidget +
accountserverlistwidget.h
+
+
+ + +
diff --git a/src/widgets/dialogs/configureaccountwidget.cpp b/src/widgets/configuredialog/configureaccountwidget.cpp similarity index 100% rename from src/widgets/dialogs/configureaccountwidget.cpp rename to src/widgets/configuredialog/configureaccountwidget.cpp diff --git a/src/widgets/dialogs/configureaccountwidget.h b/src/widgets/configuredialog/configureaccountwidget.h similarity index 100% rename from src/widgets/dialogs/configureaccountwidget.h rename to src/widgets/configuredialog/configureaccountwidget.h diff --git a/src/widgets/dialogs/configuresettingsdialog.cpp b/src/widgets/configuredialog/configuresettingsdialog.cpp similarity index 100% rename from src/widgets/dialogs/configuresettingsdialog.cpp rename to src/widgets/configuredialog/configuresettingsdialog.cpp diff --git a/src/widgets/dialogs/configuresettingsdialog.h b/src/widgets/configuredialog/configuresettingsdialog.h similarity index 100% rename from src/widgets/dialogs/configuresettingsdialog.h rename to src/widgets/configuredialog/configuresettingsdialog.h diff --git a/src/widgets/dialogs/autotests/configuresettingsdialogtest.cpp b/src/widgets/dialogs/autotests/configuresettingsdialogtest.cpp index 01d23eb5..b3726bbc 100644 --- a/src/widgets/dialogs/autotests/configuresettingsdialogtest.cpp +++ b/src/widgets/dialogs/autotests/configuresettingsdialogtest.cpp @@ -1,38 +1,38 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "configuresettingsdialogtest.h" -#include "dialogs/configuresettingsdialog.h" +#include "configuredialog/configuresettingsdialog.h" #include #include #include QTEST_MAIN(ConfigureSettingsDialogTest) ConfigureSettingsDialogTest::ConfigureSettingsDialogTest(QObject *parent) : QObject(parent) { QStandardPaths::setTestModeEnabled(true); } void ConfigureSettingsDialogTest::shouldHaveDefaultValues() { ConfigureSettingsDialog w; QVERIFY(!w.windowTitle().isEmpty()); } diff --git a/src/widgets/ruqolamainwindow.cpp b/src/widgets/ruqolamainwindow.cpp index 211037b1..adea70e0 100644 --- a/src/widgets/ruqolamainwindow.cpp +++ b/src/widgets/ruqolamainwindow.cpp @@ -1,286 +1,284 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "ruqola.h" #include "rocketchataccount.h" #include "accountmanager.h" #include "receivetypingnotificationmanager.h" #include "ruqolamainwindow.h" #include "ruqolacentralwidget.h" #include "accountmenu.h" #include "dialogs/serverinfodialog.h" #include "dialogs/searchchanneldialog.h" #include "dialogs/createnewchanneldialog.h" #include "dialogs/createnewaccountdialog.h" #include "dialogs/showpinnedmessagesdialog.h" #include "dialogs/showstarredmessagesdialog.h" #include "dialogs/showmentionsmessagesdialog.h" #include "dialogs/showsnipperedmessagesdialog.h" #include "dialogs/searchmessagedialog.h" #include "dialogs/configurenotificationdialog.h" #include "dialogs/showattachmentdialog.h" -#include "dialogs/configuresettingsdialog.h" +#include "configuredialog/configuresettingsdialog.h" #include #include #include #include #include #include #include namespace { static const char myConfigGroupName[] = "RuqolaMainWindow"; } RuqolaMainWindow::RuqolaMainWindow(QWidget *parent) : KXmlGuiWindow(parent) { mMainWidget = new RuqolaCentralWidget(this); mMainWidget->setObjectName(QStringLiteral("mMainWidget")); setCentralWidget(mMainWidget); setupActions(); setupGUI(KXmlGuiWindow::Default, QStringLiteral(":/kxmlgui5/ruqola/ruqolaui.rc")); readConfig(); - //TODO fix me multi account connect(Ruqola::self()->accountManager(), &AccountManager::currentAccountChanged, this, &RuqolaMainWindow::slotAccountChanged); slotAccountChanged(); } RuqolaMainWindow::~RuqolaMainWindow() { KSharedConfig::Ptr config = KSharedConfig::openConfig(); KConfigGroup group = config->group(myConfigGroupName); group.writeEntry("Size", size()); Ruqola::destroy(); } void RuqolaMainWindow::slotAccountChanged() { - qDebug() << " void RuqolaMainWindow::slotAccountChanged()"; if (mCurrentRocketChatAccount) { disconnect(mCurrentRocketChatAccount, nullptr, this, nullptr); } mCurrentRocketChatAccount = Ruqola::self()->rocketChatAccount(); connect(mCurrentRocketChatAccount->receiveTypingNotificationManager(), &ReceiveTypingNotificationManager::notificationChanged, this, &RuqolaMainWindow::slotTypingNotificationChanged); connect(mCurrentRocketChatAccount->receiveTypingNotificationManager(), &ReceiveTypingNotificationManager::clearNotification, this, &RuqolaMainWindow::slotClearNotification); mMainWidget->setCurrentRocketChatAccount(mCurrentRocketChatAccount); } void RuqolaMainWindow::readConfig() { KSharedConfig::Ptr config = KSharedConfig::openConfig(); KConfigGroup group = KConfigGroup(config, myConfigGroupName); const QSize sizeDialog = group.readEntry("Size", QSize(800, 600)); if (sizeDialog.isValid()) { resize(sizeDialog); } } void RuqolaMainWindow::slotClearNotification() { statusBar()->clearMessage(); } void RuqolaMainWindow::slotTypingNotificationChanged(const QString &roomId, const QString ¬ificationStr) { if (mMainWidget->roomId() == roomId) { statusBar()->showMessage(notificationStr); } } void RuqolaMainWindow::setupActions() { KActionCollection *ac = actionCollection(); KStandardAction::quit(this, &RuqolaMainWindow::close, ac); KStandardAction::preferences(this, &RuqolaMainWindow::slotConfigure, ac); QAction *act = new QAction(i18n("Add Account..."), this); connect(act, &QAction::triggered, this, &RuqolaMainWindow::slotAddAccount); ac->addAction(QStringLiteral("add_account"), act); //Move in specific server widget mServerInfo = new QAction(i18n("Server Info..."), this); connect(mServerInfo, &QAction::triggered, this, &RuqolaMainWindow::slotServerInfo); ac->addAction(QStringLiteral("server_info"), mServerInfo); mLogout = new QAction(i18n("Logout"), this); connect(mLogout, &QAction::triggered, this, &RuqolaMainWindow::slotLogout); ac->addAction(QStringLiteral("logout"), mLogout); mSearchChannel = new QAction(i18n("Search Channel..."), this); connect(mSearchChannel, &QAction::triggered, this, &RuqolaMainWindow::slotSearchChannel); ac->addAction(QStringLiteral("search_channel"), mSearchChannel); mCreateNewChannel = new QAction(i18n("Create New Channel..."), this); connect(mCreateNewChannel, &QAction::triggered, this, &RuqolaMainWindow::slotCreateNewChannel); ac->addAction(QStringLiteral("create_new_channel"), mCreateNewChannel); mShowMentions = new QAction(i18n("Show Mentions..."), this); connect(mShowMentions, &QAction::triggered, this, &RuqolaMainWindow::slotShowMentions); ac->addAction(QStringLiteral("show_mentions"), mShowMentions); mShowPinnedMessages = new QAction(i18n("Show Pinned Messages..."), this); connect(mShowPinnedMessages, &QAction::triggered, this, &RuqolaMainWindow::slotPinnedMessages); ac->addAction(QStringLiteral("show_pinned_messages"), mShowPinnedMessages); mShowStarredMessages = new QAction(i18n("Show Starred Messages..."), this); connect(mShowStarredMessages, &QAction::triggered, this, &RuqolaMainWindow::slotStarredMessages); ac->addAction(QStringLiteral("show_starred_messages"), mShowStarredMessages); mShowSnipperedMessages = new QAction(i18n("Show Snippered Messages..."), this); connect(mShowSnipperedMessages, &QAction::triggered, this, &RuqolaMainWindow::slotSnipperedMessages); ac->addAction(QStringLiteral("show_snippered_messages"), mShowSnipperedMessages); mSearchMessages = new QAction(QIcon::fromTheme(QStringLiteral("edit-find")), i18n("Search Messages..."), this); connect(mSearchMessages, &QAction::triggered, this, &RuqolaMainWindow::slotSearchMessages); ac->addAction(QStringLiteral("search_messages"), mSearchMessages); mConfigureNotification = new QAction(QIcon::fromTheme(QStringLiteral("preferences-desktop-notification")), i18n("Configure Notification..."), this); connect(mConfigureNotification, &QAction::triggered, this, &RuqolaMainWindow::slotConfigureNotification); ac->addAction(QStringLiteral("configure_notification"), mConfigureNotification); mLoadChannelHistory = new QAction(i18n("Load Recent History"), this); connect(mLoadChannelHistory, &QAction::triggered, this, &RuqolaMainWindow::slotLoadRecentHistory); ac->addAction(QStringLiteral("load_recent_history"), mLoadChannelHistory); mShowFileAttachments = new QAction(i18n("Show File Attachment..."), this); connect(mShowFileAttachments, &QAction::triggered, this, &RuqolaMainWindow::slotShowFileAttachments); ac->addAction(QStringLiteral("show_file_attachments"), mShowFileAttachments); mAccountMenu = new AccountMenu(this); ac->addAction(QStringLiteral("account_menu"), mAccountMenu); } void RuqolaMainWindow::slotShowFileAttachments() { QPointer dlg = new ShowAttachmentDialog(this); dlg->exec(); delete dlg; } void RuqolaMainWindow::slotLoadRecentHistory() { Ruqola::self()->rocketChatAccount()->loadHistory(mMainWidget->roomId()); } void RuqolaMainWindow::slotConfigureNotification() { QPointer dlg = new ConfigureNotificationDialog(this); dlg->exec(); delete dlg; } void RuqolaMainWindow::slotSearchMessages() { QPointer dlg = new SearchMessageDialog(this); dlg->setRoomId(mMainWidget->roomId()); dlg->exec(); delete dlg; } void RuqolaMainWindow::slotStarredMessages() { QPointer dlg = new ShowStarredMessagesDialog(this); dlg->setRoomId(mMainWidget->roomId()); dlg->setModel(Ruqola::self()->rocketChatAccount()->listMessagesFilterProxyModel()); Ruqola::self()->rocketChatAccount()->getListMessages(mMainWidget->roomId(), ListMessagesModel::StarredMessages); dlg->exec(); delete dlg; } void RuqolaMainWindow::slotPinnedMessages() { QPointer dlg = new ShowPinnedMessagesDialog(this); dlg->setRoomId(mMainWidget->roomId()); dlg->setModel(Ruqola::self()->rocketChatAccount()->listMessagesFilterProxyModel()); Ruqola::self()->rocketChatAccount()->getListMessages(mMainWidget->roomId(), ListMessagesModel::PinnedMessages); dlg->exec(); delete dlg; } void RuqolaMainWindow::slotShowMentions() { // QPointer dlg = new ShowMentionsMessagesDialog(this); // dlg->setModel(Ruqola::self()->rocketChatAccount()->listMessagesFilterProxyModel()); // Ruqola::self()->rocketChatAccount()->getListMessages(mMainWidget->roomId(), ListMessagesModel::); // dlg->exec(); // delete dlg; } void RuqolaMainWindow::slotSnipperedMessages() { QPointer dlg = new ShowSnipperedMessagesDialog(this); dlg->setRoomId(mMainWidget->roomId()); dlg->setModel(Ruqola::self()->rocketChatAccount()->listMessagesFilterProxyModel()); Ruqola::self()->rocketChatAccount()->getListMessages(mMainWidget->roomId(), ListMessagesModel::SnipperedMessages); dlg->exec(); delete dlg; } void RuqolaMainWindow::slotCreateNewChannel() { QPointer dlg = new CreateNewChannelDialog(this); if (dlg->exec()) { const CreateNewChannelDialog::NewChannelInfo info = dlg->channelInfo(); Ruqola::self()->rocketChatAccount()->createNewChannel(info.channelName, info.readOnly, info.privateChannel, info.usersName, info.encryptedRoom, info.password, info.broadCast); } delete dlg; } void RuqolaMainWindow::slotConfigure() { QPointer dlg = new ConfigureSettingsDialog(this); if (dlg->exec()) { //TODO } delete dlg; } void RuqolaMainWindow::slotAddAccount() { QPointer dlg = new CreateNewAccountDialog(this); if (dlg->exec()) { const CreateNewAccountDialog::AccountInfo info = dlg->accountInfo(); Ruqola::self()->accountManager()->addAccount(info.accountName, info.userName, info.serverName); } delete dlg; } void RuqolaMainWindow::slotServerInfo() { QPointer dlg = new ServerInfoDialog(this); dlg->setServerConfigInfo(Ruqola::self()->rocketChatAccount()->serverConfigInfo()); dlg->exec(); delete dlg; } void RuqolaMainWindow::slotLogout() { Ruqola::self()->rocketChatAccount()->logOut(); } void RuqolaMainWindow::slotSearchChannel() { QPointer dlg = new SearchChannelDialog(this); dlg->exec(); delete dlg; }