Only show share dialog if we are connected.
authorRoeland Jago Douma <roeland@famdouma.nl>
Mon, 16 Mar 2015 15:26:35 +0000 (16:26 +0100)
committerChristian Kamm <kamm@incasoftware.de>
Wed, 8 Apr 2015 07:53:57 +0000 (09:53 +0200)
src/gui/socketapi.cpp

index 025abe3b6e0ea75711476570c67cd961e60d1903..0f42154a8af722f6b0df07b97376c8f3dedf29d2 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) by Dominik Schmidt <dev@dominik-schmidt.de>
  * Copyright (C) by Klaas Freitag <freitag@owncloud.com>
+ * Copyright (C) by Roeland Jago Douma <roeland@famdouma.nl>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,6 +25,7 @@
 #include "syncfileitem.h"
 #include "filesystem.h"
 #include "version.h"
+#include "accountstate.h"
 
 #include <QDebug>
 #include <QUrl>
@@ -425,6 +427,10 @@ void SocketApi::command_SHARE(const QString& localFile, QLocalSocket* socket)
         const QString message = QLatin1String("SHARE:NOP:")+QDir::toNativeSeparators(localFile);
         // files that are not within a sync folder are not synced.
         sendMessage(socket, message);
+    } else if (!shareFolder->accountState()->isConnected()) {
+        const QString message = QLatin1String("SHARE:NOTCONNECTED:")+QDir::toNativeSeparators(localFile);
+        // if the folder isn't connected, don't open the share dialog
+        sendMessage(socket, message);
     } else {
         const QString folderForPath = shareFolder->path();
         const QString remotePath = shareFolder->remotePath() + localFile.right(localFile.count()-folderForPath.count()+1);