const auto accountState = folder->accountState();
- qDebug() << Q_FUNC_INFO << "Opening share dialog" << sharePath << localPath;
- ShareDialog *w = new ShareDialog(accountState->account(), sharePath, localPath, resharingAllowed);
- w->getShares();
- w->setAttribute( Qt::WA_DeleteOnClose, true );
+ ShareDialog *w = 0;
+ if (_shareDialogs.contains(localPath) && _shareDialogs[localPath]) {
+ qDebug() << Q_FUNC_INFO << "Raising share dialog" << sharePath << localPath;
+ w = _shareDialogs[localPath];
+ } else {
+ qDebug() << Q_FUNC_INFO << "Opening share dialog" << sharePath << localPath;
+ w = new ShareDialog(accountState->account(), sharePath, localPath, resharingAllowed);
+ w->getShares();
+ w->setAttribute( Qt::WA_DeleteOnClose, true );
+
+ _shareDialogs[localPath] = w;
+ connect(w, SIGNAL(destroyed(QObject*)), SLOT(slotRemoveDestroyedShareDialogs()));
+ }
raiseDialog(w);
}
+void ownCloudGui::slotRemoveDestroyedShareDialogs()
+{
+ QMutableMapIterator<QString, QPointer<ShareDialog> > it(_shareDialogs);
+ while (it.hasNext()) {
+ it.next();
+ if (! it.value() || it.value() == sender()) {
+ it.remove();
+ qDebug() << "REMOVED";
+ }
+ }
+}
+
} // end namespace
class SettingsDialog;
class SettingsDialogMac;
+class ShareDialog;
class Application;
class LogBrowser;
class AccountState;
void slotOpenPath(const QString& path);
void slotAccountStateChanged();
void slotShowShareDialog(const QString &sharePath, const QString &localPath, bool resharingAllowed);
+ void slotRemoveDestroyedShareDialogs();
private slots:
void slotDisplayIdle();
QMenu *_recentActionsMenu;
QVector<QMenu*> _accountMenus;
bool _qdbusmenuWorkaround;
+ QMap<QString, QPointer<ShareDialog> > _shareDialogs;
QAction *_actionLogin;
QAction *_actionLogout;