[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [ruqola] src: Allow to create channel as readonly + createPrivateGroup
From: Montel Laurent <null () kde ! org>
Date: 2017-10-31 21:31:16
Message-ID: E1e9e7w-0005EB-PT () code ! kde ! org
[Download RAW message or body]
Git commit f1efc14207af16af14f4165e5cff3b8c2f6590ec by Montel Laurent.
Committed on 31/10/2017 at 21:30.
Pushed by mlaurent into branch 'master'.
Allow to create channel as readonly + createPrivateGroup
M +4 -7 src/ddpapi/ddpclient.cpp
M +3 -3 src/ddpapi/ddpclient.h
M +3 -3 src/qml/AboutDialog.qml
M +23 -3 src/qml/CreateNewChannelDialog.qml
M +1 -2 src/qml/Desktop.qml
M +6 -3 src/rocketchataccount.cpp
M +1 -1 src/rocketchataccount.h
https://commits.kde.org/ruqola/f1efc14207af16af14f4165e5cff3b8c2f6590ec
diff --git a/src/ddpapi/ddpclient.cpp b/src/ddpapi/ddpclient.cpp
index f6b394c..0ced67c 100644
--- a/src/ddpapi/ddpclient.cpp
+++ b/src/ddpapi/ddpclient.cpp
@@ -211,22 +211,19 @@ quint64 DDPClient::hideRoom(const QString &roomID)
quint64 DDPClient::toggleFavorite(const QString &roomID, bool favorite)
{
- qDebug() << " quint64 DDPClient::toggleFavorite(const QString &roomID, bool \
favorite)"<<roomID << favorite;
const RocketChatMessage::RocketChatMessageResult result = \
mRocketChatMessage->toggleFavorite(roomID, favorite, m_uid); return method(result, \
empty_callback, DDPClient::Persistent); }
-quint64 DDPClient::createChannel(const QString &name, bool readOnly)
+quint64 DDPClient::createChannel(const QString &name, const QStringList &userList, \
bool readOnly) {
- //TODO userList
- const RocketChatMessage::RocketChatMessageResult result = \
mRocketChatMessage->createChannel(name, QStringList(), readOnly, m_uid); + const \
RocketChatMessage::RocketChatMessageResult result = \
mRocketChatMessage->createChannel(name, userList, readOnly, m_uid); return \
method(result, create_channel, DDPClient::Persistent); }
-quint64 DDPClient::createPrivateGroup(const QString &name)
+quint64 DDPClient::createPrivateGroup(const QString &name, const QStringList \
&userList) {
- //TODO userList
- const RocketChatMessage::RocketChatMessageResult result = \
mRocketChatMessage->createPrivateGroup(name, QStringList(), m_uid); + const \
RocketChatMessage::RocketChatMessageResult result = \
mRocketChatMessage->createPrivateGroup(name, userList, m_uid); return method(result, \
empty_callback, DDPClient::Persistent); }
diff --git a/src/ddpapi/ddpclient.h b/src/ddpapi/ddpclient.h
index 31eb41e..80e46cd 100644
--- a/src/ddpapi/ddpclient.h
+++ b/src/ddpapi/ddpclient.h
@@ -147,8 +147,8 @@ public:
LoginStatus loginStatus() const;
quint64 toggleFavorite(const QString &roomID, bool favorite);
- quint64 createChannel(const QString &name, bool readOnly);
- quint64 createPrivateGroup(const QString &name);
+ quint64 createChannel(const QString &name, const QStringList &userList, bool \
readOnly); + quint64 createPrivateGroup(const QString &name, const QStringList \
&userList); quint64 joinRoom(const QString &roomId, const QString &joinCode);
Q_SIGNALS:
void connectedChanged();
@@ -187,7 +187,7 @@ private:
/**
* @brief Unique message ID for each message sent over network
*/
- quint64 m_uid;
+ quint64 m_uid = 0;
/**
* @brief Stores callback function associated with each message
diff --git a/src/qml/AboutDialog.qml b/src/qml/AboutDialog.qml
index e85bcc5..8c3b77a 100644
--- a/src/qml/AboutDialog.qml
+++ b/src/qml/AboutDialog.qml
@@ -58,11 +58,11 @@ Dialog {
}
TabButton {
text: i18n("Thanks To")
- visible: applicationData.creditsModel.count > 0
+ //FIXME visible: applicationData.creditsModel.count > 0
}
TabButton {
text: i18n("Translation")
- visible: applicationData.translatorModel.count > 0
+ //FIXME visible: applicationData.translatorModel.count > 0
}
}
@@ -189,7 +189,7 @@ Dialog {
Repeater {
id: creditList
- model: applicationData.creditModel
+ model: applicationData.creditsModel
Column {
Text {
text: username
diff --git a/src/qml/CreateNewChannelDialog.qml b/src/qml/CreateNewChannelDialog.qml
index 607c61a..1113fdc 100644
--- a/src/qml/CreateNewChannelDialog.qml
+++ b/src/qml/CreateNewChannelDialog.qml
@@ -26,7 +26,7 @@ import QtQuick.Window 2.0
Dialog {
id: createNewChannelDialog
- signal createNewChannel(string name)
+ signal createNewChannel(string name, bool readOnly, bool privateRoom)
title: i18n("Create Channel")
@@ -36,8 +36,10 @@ Dialog {
y: parent.height / 2 - height / 2
width: 300
- height: 400
+ height: 200
modal: true
+ //TODO convert to GridLayout
+
Column {
RowLayout {
Label {
@@ -48,10 +50,28 @@ Dialog {
placeholderText: i18n("Channel Name")
}
}
+ RowLayout {
+ Label {
+ text: i18n("Read-Only:");
+ }
+ Switch {
+ id: readOnlyRoom
+ checked: false
+ }
+ }
+ RowLayout {
+ Label {
+ text: i18n("Private:");
+ }
+ Switch {
+ id: privateRoom
+ checked: false
+ }
+ }
}
onAccepted: {
- createNewChannelDialog.createNewChannel(channelName.text)
+ createNewChannelDialog.createNewChannel(channelName.text, \
readOnlyRoom.checked, privateRoom.checked) }
}
diff --git a/src/qml/Desktop.qml b/src/qml/Desktop.qml
index 3d03f96..4f2322a 100644
--- a/src/qml/Desktop.qml
+++ b/src/qml/Desktop.qml
@@ -109,8 +109,7 @@ Kirigami.ApplicationWindow {
CreateNewChannelDialog {
id: createNewChannelDialog
onCreateNewChannel: {
- Ruqola.rocketChatAccount().createNewChannel(name);
- console.log("create new channel" + name)
+ Ruqola.rocketChatAccount().createNewChannel(name, readOnly, \
privateRoom); }
}
diff --git a/src/rocketchataccount.cpp b/src/rocketchataccount.cpp
index 2189b90..86ca881 100644
--- a/src/rocketchataccount.cpp
+++ b/src/rocketchataccount.cpp
@@ -329,10 +329,13 @@ void RocketChatAccount::joinJitsiConfCall()
//TODO
}
-void RocketChatAccount::createNewChannel(const QString &name)
+void RocketChatAccount::createNewChannel(const QString &name, bool readOnly, bool \
privateRoom) {
- //TODO define readonly or not ?
- ddp()->createChannel(name, false);
+ if (privateRoom) {
+ ddp()->createPrivateGroup(name, QStringList());
+ } else {
+ ddp()->createChannel(name, QStringList(), readOnly);
+ }
}
void RocketChatAccount::joinRoom(const QString &roomId)
diff --git a/src/rocketchataccount.h b/src/rocketchataccount.h
index 6b8db04..b0c58b6 100644
--- a/src/rocketchataccount.h
+++ b/src/rocketchataccount.h
@@ -93,7 +93,7 @@ public:
Q_INVOKABLE void openDirectChat(const QString &url);
Q_INVOKABLE void openChannel(const QString &url);
Q_INVOKABLE void joinJitsiConfCall();
- Q_INVOKABLE void createNewChannel(const QString &name);
+ Q_INVOKABLE void createNewChannel(const QString &name, bool readOnly, bool \
privateRoom); Q_INVOKABLE void joinRoom(const QString &roomId);
Q_SIGNALS:
void userNameChanged();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic