diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index eb4bacf5..5778954f 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -1,74 +1,75 @@ add_definitions( -DRUQOLA_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data") macro(add_ruqola_test _source) set( _test ${_source}) get_filename_component( _name ${_source} NAME_WE ) add_executable( ${_name} ${_test} ) add_test(NAME ${_name} COMMAND ${_name} ) ecm_mark_as_test(${_name}) target_link_libraries( ${_name} Qt5::Test libruqolacore) endmacro() add_ruqola_test(rocketchatmessagetest.cpp) add_ruqola_test(roommodeltest.cpp) add_ruqola_test(messagemodeltest.cpp) add_ruqola_test(typingnotificationtest.cpp) add_ruqola_test(utilstest.cpp) add_ruqola_test(usertest.cpp) add_ruqola_test(messageattachmenttest.cpp) add_ruqola_test(restapiutiltest.cpp) add_ruqola_test(rocketchataccountsettingstest.cpp) add_ruqola_test(messagetest.cpp) add_ruqola_test(messageurltest.cpp) add_ruqola_test(roomtest.cpp) add_ruqola_test(ruqolaserverconfigtest.cpp) add_ruqola_test(statusmodeltest.cpp) add_ruqola_test(rocketchatcachetest.cpp) add_ruqola_test(textconvertertest.cpp) add_ruqola_test(loadrecenthistorymanagertest.cpp) add_ruqola_test(notificationtest.cpp) add_ruqola_test(emojitest.cpp) add_ruqola_test(emojimanagertest.cpp) add_ruqola_test(otrtest.cpp) add_ruqola_test(otrmanagertest.cpp) add_ruqola_test(rocketchataccounttest.cpp) add_ruqola_test(usersmodeltest.cpp) add_ruqola_test(usersforroommodeltest.cpp) add_ruqola_test(filetest.cpp) add_ruqola_test(filesforroommodeltest.cpp) add_ruqola_test(filesforroomfilterproxymodeltest.cpp) add_ruqola_test(channeltest.cpp) add_ruqola_test(usersforroomfilterproxymodeltest.cpp) add_ruqola_test(usercompletermodeltest.cpp) add_ruqola_test(roomfilterproxymodeltest.cpp) add_ruqola_test(usercompleterfilterproxymodeltest.cpp) add_ruqola_test(searchchannelmodeltest.cpp) add_ruqola_test(searchchannelfilterproxymodeltest.cpp) add_ruqola_test(inputcompletermodeltest.cpp) add_ruqola_test(loginmethodmodeltest.cpp) add_ruqola_test(inputtextmanagertest.cpp) add_ruqola_test(clipboardproxytest.cpp) add_ruqola_test(authenticationinfotest.cpp) add_ruqola_test(searchmessagemodeltest.cpp) add_ruqola_test(searchmessagefilterproxymodeltest.cpp) add_ruqola_test(searchmessagetest.cpp) add_ruqola_test(accountmanagertest.cpp) add_ruqola_test(rocketchataccountmodeltest.cpp) add_ruqola_test(ruqolatest.cpp) add_ruqola_test(managerdatapathstest.cpp) add_ruqola_test(rocketchataccountfilterproxymodeltest.cpp) add_ruqola_test(roomwrappertest.cpp) add_ruqola_test(notificationoptionstest.cpp) add_ruqola_test(reactionstest.cpp) add_ruqola_test(reactiontest.cpp) #RESTAPI add_ruqola_test(restapimethodtest.cpp) add_ruqola_test(serverinfojobtest.cpp) add_ruqola_test(uploadfilejobtest.cpp) add_ruqola_test(owninfojobtest.cpp) add_ruqola_test(getavatarjobtest.cpp) add_ruqola_test(logoutjobtest.cpp) add_ruqola_test(loginjobtest.cpp) add_ruqola_test(privateinfojobtest.cpp) +add_ruqola_test(channellistjobtest.cpp) add_subdirectory(qml) diff --git a/src/restapi/serverinfojob.h b/autotests/channellistjobtest.cpp similarity index 59% copy from src/restapi/serverinfojob.h copy to autotests/channellistjobtest.cpp index 0955cfd3..410e726a 100644 --- a/src/restapi/serverinfojob.h +++ b/autotests/channellistjobtest.cpp @@ -1,49 +1,36 @@ /* Copyright (c) 2018 Montel Laurent 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 SERVERINFOJOB_H -#define SERVERINFOJOB_H - -#include -#include "restapiabstractjob.h" -#include "libruqola_private_export.h" -class QNetworkRequest; -class LIBRUQOLACORE_TESTS_EXPORT ServerInfoJob : public RestApiAbstractJob -{ - Q_OBJECT -public: - explicit ServerInfoJob(QObject *parent = nullptr); - ~ServerInfoJob() override; - - bool start() override; +#include "channellistjobtest.h" +#include "restapi/channellistjob.h" - QNetworkRequest request() const; +#include +QTEST_GUILESS_MAIN(ChannelListJobTest) - bool requireHttpAuthentication() const override; +ChannelListJobTest::ChannelListJobTest(QObject *parent) + : QObject(parent) +{ -Q_SIGNALS: - void serverInfoDone(const QString &versionInfo); +} -private: - Q_DISABLE_COPY(ServerInfoJob) - void slotServerInfoFinished(); -}; +void ChannelListJobTest::shouldHaveDefaultValue() +{ -#endif // SERVERINFOJOB_H +} diff --git a/src/restapi/serverinfojob.h b/autotests/channellistjobtest.h similarity index 62% copy from src/restapi/serverinfojob.h copy to autotests/channellistjobtest.h index 0955cfd3..c5632092 100644 --- a/src/restapi/serverinfojob.h +++ b/autotests/channellistjobtest.h @@ -1,49 +1,37 @@ /* Copyright (c) 2018 Montel Laurent 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 SERVERINFOJOB_H -#define SERVERINFOJOB_H +#ifndef CHANNELLISTJOBTEST_H +#define CHANNELLISTJOBTEST_H #include -#include "restapiabstractjob.h" -#include "libruqola_private_export.h" -class QNetworkRequest; -class LIBRUQOLACORE_TESTS_EXPORT ServerInfoJob : public RestApiAbstractJob + +class ChannelListJobTest : public QObject { Q_OBJECT public: - explicit ServerInfoJob(QObject *parent = nullptr); - ~ServerInfoJob() override; - - bool start() override; - - QNetworkRequest request() const; - - bool requireHttpAuthentication() const override; - -Q_SIGNALS: - void serverInfoDone(const QString &versionInfo); + explicit ChannelListJobTest(QObject *parent = nullptr); + ~ChannelListJobTest() = default; -private: - Q_DISABLE_COPY(ServerInfoJob) - void slotServerInfoFinished(); +private Q_SLOTS: + void shouldHaveDefaultValue(); }; -#endif // SERVERINFOJOB_H +#endif // CHANNELLISTJOBTEST_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9fadde80..ddb29427 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,172 +1,173 @@ set (Ruqola_restapi_SRCS restapi/restapirequest.cpp restapi/restapiutil.cpp restapi/restapimethod.cpp restapi/uploadfilejob.cpp restapi/serverinfojob.cpp restapi/restapiabstractjob.cpp restapi/owninfojob.cpp restapi/getavatarjob.cpp restapi/logoutjob.cpp restapi/loginjob.cpp restapi/privateinfojob.cpp + restapi/channellistjob.cpp ) set(Ruqola_ddpapi_SRCS ddpapi/ddpclient.cpp ) set (Ruqola_model_core_srcs model/messagemodel.cpp model/roommodel.cpp model/roomfilterproxymodel.cpp model/usersforroommodel.cpp model/usersforroomfilterproxymodel.cpp model/usersmodel.cpp model/usercompleterfilterproxymodel.cpp model/usercompletermodel.cpp model/statusmodel.cpp model/filesforroommodel.cpp model/filesforroomfilterproxymodel.cpp model/searchchannelmodel.cpp model/searchchannelfilterproxymodel.cpp model/inputcompletermodel.cpp model/loginmethodmodel.cpp model/searchmessagemodel.cpp model/searchmessagefilterproxymodel.cpp model/rocketchataccountmodel.cpp model/rocketchataccountfilterproxymodel.cpp ) set(Ruqola_plugins_srcs plugins/pluginauthenticationinterface.cpp plugins/pluginauthentication.cpp ) set(Ruqola_aboutdata_srcs aboutdata/qmlaboutdata.cpp aboutdata/qmlaboutdataauthormodel.cpp ) set (Ruqola_core_srcs ${Ruqola_model_core_srcs} ${Ruqola_plugins_srcs} ${Ruqola_aboutdata_srcs} ${Ruqola_ddpapi_SRCS} ${Ruqola_restapi_SRCS} authenticationinfo.cpp message.cpp room.cpp roomwrapper.cpp ruqola.cpp ruqolautils.cpp rocketchatbackend.cpp notification.cpp messagequeue.cpp rocketchatmessage.cpp typingnotification.cpp changetemporarystatus.cpp user.cpp utils.cpp emoji.cpp emojimanager.cpp clipboardproxy.cpp otr.cpp otrmanager.cpp abstractwebsocket.cpp ruqolawebsocket.cpp messageattachment.cpp messageurl.cpp rocketchataccount.cpp rocketchataccountsettings.cpp ruqolalogger.cpp ruqolaregisterengine.cpp ruqolaserverconfig.cpp rocketchatcache.cpp texthighlighter.cpp textconverter.cpp loadrecenthistorymanager.cpp unityservicemanager.cpp file.cpp channel.cpp inputtextmanager.cpp authenticationmanager.cpp searchmessage.cpp accountmanager.cpp managerdatapaths.cpp notificationoptions.cpp reactions.cpp reaction.cpp ) ecm_qt_declare_logging_category(Ruqola_core_srcs HEADER ruqola_debug.h IDENTIFIER RUQOLA_LOG CATEGORY_NAME org.kde.ruqola) ecm_qt_declare_logging_category(Ruqola_core_srcs HEADER ruqola_message_debug.h IDENTIFIER RUQOLA_MESSAGE_LOG CATEGORY_NAME org.kde.ruqola.message) ecm_qt_declare_logging_category(Ruqola_core_srcs HEADER ruqola_ddpapi_debug.h IDENTIFIER RUQOLA_DDPAPI_LOG CATEGORY_NAME org.kde.ruqola.ddpapi) ecm_qt_declare_logging_category(Ruqola_core_srcs HEADER ruqola_ddpapi_command_debug.h IDENTIFIER RUQOLA_DDPAPI_COMMAND_LOG CATEGORY_NAME org.kde.ruqola.ddpapi.command) ecm_qt_declare_logging_category(Ruqola_core_srcs HEADER ruqola_restapi_debug.h IDENTIFIER RUQOLA_RESTAPI_LOG CATEGORY_NAME org.kde.ruqola.restapi) add_library(libruqolacore ${Ruqola_core_srcs}) generate_export_header(libruqolacore BASE_NAME libruqolacore) target_link_libraries(libruqolacore Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Qml Qt5::Quick Qt5::WebSockets Qt5::Network Qt5::NetworkAuth Qt5::DBus KF5::CoreAddons KF5::I18n KF5::Crash KF5::Notifications KF5::KIOCore KF5::SyntaxHighlighting ) if (WIN32 OR APPLE) target_link_libraries(libruqolacore KF5::IconThemes) endif() if (Qt5Keychain_FOUND) target_link_libraries(libruqolacore qt5keychain) target_include_directories(libruqolacore PRIVATE ${QTKEYCHAIN_INCLUDE_DIRS}) endif() set_target_properties(libruqolacore PROPERTIES OUTPUT_NAME ruqolacore VERSION ${RUQOLA_LIB_VERSION} SOVERSION ${RUQOLA_LIB_SOVERSION} ) qt5_add_resources(RuqolaResources qml/qml.qrc) add_executable(ruqola main.cpp ${RuqolaResources}) target_link_libraries(ruqola libruqolacore) install(TARGETS ruqola ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS libruqolacore ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) install(PROGRAMS data/org.kde.ruqola.desktop DESTINATION ${KDE_INSTALL_APPDIR}) install(FILES data/org.kde.ruqola.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) add_subdirectory(plugins) add_subdirectory(icons) diff --git a/src/restapi/serverinfojob.h b/src/restapi/channellistjob.cpp similarity index 60% copy from src/restapi/serverinfojob.h copy to src/restapi/channellistjob.cpp index 0955cfd3..9ea0f4ca 100644 --- a/src/restapi/serverinfojob.h +++ b/src/restapi/channellistjob.cpp @@ -1,49 +1,50 @@ /* Copyright (c) 2018 Montel Laurent 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 SERVERINFOJOB_H -#define SERVERINFOJOB_H - -#include -#include "restapiabstractjob.h" -#include "libruqola_private_export.h" -class QNetworkRequest; -class LIBRUQOLACORE_TESTS_EXPORT ServerInfoJob : public RestApiAbstractJob +#include "channellistjob.h" +#include "ruqola_restapi_debug.h" +#include "restapimethod.h" +#include "restapirequest.h" +#include +#include +#include +#include + + +ChannelListJob::ChannelListJob(QObject *parent) + : RestApiAbstractJob(parent) { - Q_OBJECT -public: - explicit ServerInfoJob(QObject *parent = nullptr); - ~ServerInfoJob() override; +} - bool start() override; - - QNetworkRequest request() const; - - bool requireHttpAuthentication() const override; +ChannelListJob::~ChannelListJob() +{ +} -Q_SIGNALS: - void serverInfoDone(const QString &versionInfo); -private: - Q_DISABLE_COPY(ServerInfoJob) - void slotServerInfoFinished(); -}; +bool ChannelListJob::start() +{ + //TODO + return false; +} -#endif // SERVERINFOJOB_H +bool ChannelListJob::requireHttpAuthentication() const +{ + return true; +} diff --git a/src/restapi/serverinfojob.h b/src/restapi/channellistjob.h similarity index 71% copy from src/restapi/serverinfojob.h copy to src/restapi/channellistjob.h index 0955cfd3..90c94cab 100644 --- a/src/restapi/serverinfojob.h +++ b/src/restapi/channellistjob.h @@ -1,49 +1,42 @@ /* Copyright (c) 2018 Montel Laurent 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 SERVERINFOJOB_H -#define SERVERINFOJOB_H +#ifndef CHANNELLISTJOB_H +#define CHANNELLISTJOB_H -#include #include "restapiabstractjob.h" #include "libruqola_private_export.h" -class QNetworkRequest; -class LIBRUQOLACORE_TESTS_EXPORT ServerInfoJob : public RestApiAbstractJob + +class LIBRUQOLACORE_TESTS_EXPORT ChannelListJob : public RestApiAbstractJob { Q_OBJECT public: - explicit ServerInfoJob(QObject *parent = nullptr); - ~ServerInfoJob() override; + explicit ChannelListJob(QObject *parent = nullptr); + ~ChannelListJob() override; bool start() override; - - QNetworkRequest request() const; - bool requireHttpAuthentication() const override; -Q_SIGNALS: - void serverInfoDone(const QString &versionInfo); - private: - Q_DISABLE_COPY(ServerInfoJob) - void slotServerInfoFinished(); + Q_DISABLE_COPY(ChannelListJob) + }; -#endif // SERVERINFOJOB_H +#endif // CHANNELLISTJOB_H diff --git a/src/restapi/serverinfojob.h b/src/restapi/serverinfojob.h index 0955cfd3..113cb0f9 100644 --- a/src/restapi/serverinfojob.h +++ b/src/restapi/serverinfojob.h @@ -1,49 +1,48 @@ /* Copyright (c) 2018 Montel Laurent 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 SERVERINFOJOB_H #define SERVERINFOJOB_H -#include #include "restapiabstractjob.h" #include "libruqola_private_export.h" class QNetworkRequest; class LIBRUQOLACORE_TESTS_EXPORT ServerInfoJob : public RestApiAbstractJob { Q_OBJECT public: explicit ServerInfoJob(QObject *parent = nullptr); ~ServerInfoJob() override; bool start() override; QNetworkRequest request() const; bool requireHttpAuthentication() const override; Q_SIGNALS: void serverInfoDone(const QString &versionInfo); private: Q_DISABLE_COPY(ServerInfoJob) void slotServerInfoFinished(); }; #endif // SERVERINFOJOB_H