From 5c3056584d1e13adffed05bd32898d9109f38b58 Mon Sep 17 00:00:00 2001 From: Armin <armin.felder@osalliance.com> Date: Tue, 15 May 2018 15:34:33 +0200 Subject: [PATCH] share file using the normal channel list --- rocketchat.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/rocketchat.cpp b/rocketchat.cpp index 918ce0f..d6f504e 100755 --- a/rocketchat.cpp +++ b/rocketchat.cpp @@ -91,6 +91,10 @@ void RocketChat::joinChannel( const QString &pServerId, const QString &pChannelI if ( mServerStatus ) { QMetaObject::invokeMethod( mServerMap.first(), "joinChannel", Q_ARG( QString, pChannelId ) ); + + if ( !mFileToShare.isEmpty() ) { + uploadSharedFileToChannel( pChannelId ); + } } } @@ -439,6 +443,7 @@ void RocketChat::uploadSharedFileToChannel( const QString &pChannelId ) { if ( mServerStatus ) { QMetaObject::invokeMethod( mServerMap.first(), "uploadFile", Q_ARG( QString, pChannelId ), Q_ARG( QString, mFileToShare ) ); + mFileToShare.clear(); } } @@ -636,11 +641,7 @@ void RocketChat::resetLoginMethods() void RocketChat::openIosFile( const QString &fileName ) { - //QFile file(fileName); - mFileToShare = fileName; - qDebug() << "share file received..."; - emit openShareDialog(); } void RocketChat::openUrl( const QString url ) @@ -737,7 +738,6 @@ void RocketChat::serverReadySlot() connect( pServer, &RocketChatServerData::openUrl, this, &RocketChat::openUrl, Qt::UniqueConnection ); - connect( pServer, &RocketChatServerData::allChannelsReady, this, &RocketChat::onAllChannelsReceived, Qt::UniqueConnection ); connect( pServer, &RocketChatServerData::usersReady, this, &RocketChat::channelUsersReady, Qt::UniqueConnection ); connect( pServer, &RocketChatServerData::channelDetailsReady, this, &RocketChat::channelDetailsReady, Qt::UniqueConnection ); connect( pServer, &RocketChatServerData::unreadCountChanged, this, &RocketChat::onUnreadCountChanged, Qt::UniqueConnection ); @@ -819,12 +819,6 @@ void RocketChat::onEmojisReady( const QVariantList &pEmojiList ) emit emojisReady( pEmojiList ); } -//used only for share Dialog -void RocketChat::onAllChannelsReceived( const QVariantList &pChannels ) -{ - emit allChannelsReceived( pChannels ); -} - void RocketChat::onServerSlotsReady() { #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) -- GitLab