diff --git a/src/apps/widget/ruqolaui.rc b/src/apps/widget/ruqolaui.rc index cb26fe93..a70e836b 100644 --- a/src/apps/widget/ruqolaui.rc +++ b/src/apps/widget/ruqolaui.rc @@ -1,17 +1,18 @@ &Edit + diff --git a/src/widgets/ruqolacentralwidget.cpp b/src/widgets/ruqolacentralwidget.cpp index 16df98cd..59acf62f 100644 --- a/src/widgets/ruqolacentralwidget.cpp +++ b/src/widgets/ruqolacentralwidget.cpp @@ -1,76 +1,74 @@ /* 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 "ruqolacentralwidget.h" #include "ruqolaloginwidget.h" #include "ruqolamainwidget.h" #include "ruqola.h" #include "rocketchataccount.h" #include #include #include RuqolaCentralWidget::RuqolaCentralWidget(QWidget *parent) : QWidget(parent) { QHBoxLayout *mainLayout = new QHBoxLayout(this); mainLayout->setObjectName(QStringLiteral("mainlayout")); mStackedWidget = new QStackedWidget(this); mStackedWidget->setObjectName(QStringLiteral("mStackedWidget")); mainLayout->addWidget(mStackedWidget); mRuqolaMainWidget = new RuqolaMainWidget(this); mRuqolaMainWidget->setObjectName(QStringLiteral("mRuqolaMainWidget")); mStackedWidget->addWidget(mRuqolaMainWidget); mRuqolaLoginWidget = new RuqolaLoginWidget(this); mRuqolaLoginWidget->setObjectName(QStringLiteral("mRuqolaLoginWidget")); mStackedWidget->addWidget(mRuqolaLoginWidget); - //TODO fix me - //mStackedWidget->setCurrentWidget(mRuqolaMainWidget); //Fix me multiaccount connect(Ruqola::self()->rocketChatAccount(), &RocketChatAccount::loginStatusChanged, this, &RuqolaCentralWidget::slotLoginStatusChanged); } RuqolaCentralWidget::~RuqolaCentralWidget() { } void RuqolaCentralWidget::slotLoginStatusChanged() { /* NotConnected, LoggingIn, LoggedIn, LoginFailed, LoginCodeRequired, LoggedOut, FailedToLoginPluginProblem */ if (Ruqola::self()->rocketChatAccount()->loginStatus() == DDPClient::LoggedIn) { mStackedWidget->setCurrentWidget(mRuqolaMainWidget); } else { mStackedWidget->setCurrentWidget(mRuqolaLoginWidget); mRuqolaLoginWidget->initialize(); //TODO assign value in mRuqolaLoginWidget directly } //TODO } diff --git a/src/widgets/ruqolamainwindow.cpp b/src/widgets/ruqolamainwindow.cpp index 2d50eca4..913e934c 100644 --- a/src/widgets/ruqolamainwindow.cpp +++ b/src/widgets/ruqolamainwindow.cpp @@ -1,109 +1,120 @@ /* 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 "ruqolamainwindow.h" #include "ruqolacentralwidget.h" #include "dialogs/serverinfodialog.h" +#include "dialogs/searchchanneldialog.h" #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(); readConfig(); } RuqolaMainWindow::~RuqolaMainWindow() { KSharedConfig::Ptr config = KSharedConfig::openConfig(); KConfigGroup group = config->group(myConfigGroupName); group.writeEntry("Size", size()); Ruqola::destroy(); } 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::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); } void RuqolaMainWindow::slotConfigure() { //TODO } void RuqolaMainWindow::slotAddAccount() { //TODO } void RuqolaMainWindow::slotServerInfo() { - qDebug() << " 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; +} diff --git a/src/widgets/ruqolamainwindow.h b/src/widgets/ruqolamainwindow.h index c15a29da..5963d34d 100644 --- a/src/widgets/ruqolamainwindow.h +++ b/src/widgets/ruqolamainwindow.h @@ -1,46 +1,48 @@ /* 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 RUQOLAMAINWINDOW_H #define RUQOLAMAINWINDOW_H #include #include "libruqolawidgets_export.h" class RuqolaCentralWidget; class QAction; class LIBRUQOLAWIDGETS_EXPORT RuqolaMainWindow : public KXmlGuiWindow { Q_OBJECT public: explicit RuqolaMainWindow(QWidget *parent = nullptr); ~RuqolaMainWindow(); private: void setupActions(); void readConfig(); void slotAddAccount(); void slotServerInfo(); void slotConfigure(); void slotLogout(); + void slotSearchChannel(); RuqolaCentralWidget *mMainWidget = nullptr; QAction *mServerInfo = nullptr; QAction *mLogout = nullptr; + QAction *mSearchChannel = nullptr; }; #endif // RUQOLAMAINWINDOW_H