From e45a023961c0960c09d2c56a4c95bbd91abdb487 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 2 Nov 2022 17:27:49 +0100 Subject: [PATCH] Remove unused internal link widget from old share dialog Signed-off-by: Claudio Cambra --- src/gui/CMakeLists.txt | 3 - src/gui/internallinkwidget.cpp | 86 ----------------- src/gui/internallinkwidget.h | 59 ------------ src/gui/internallinkwidget.ui | 168 --------------------------------- 4 files changed, 316 deletions(-) delete mode 100644 src/gui/internallinkwidget.cpp delete mode 100644 src/gui/internallinkwidget.h delete mode 100644 src/gui/internallinkwidget.ui diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 77d875b854854..5d4f8f479220e 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -28,7 +28,6 @@ set(theme_dir ${CMAKE_SOURCE_DIR}/theme) set(client_UI_SRCS accountsettings.ui conflictdialog.ui - internallinkwidget.ui invalidfilenamedialog.ui foldercreationdialog.ui folderwizardsourcepage.ui @@ -102,8 +101,6 @@ set(client_SRCS generalsettings.cpp legalnotice.h legalnotice.cpp - internallinkwidget.h - internallinkwidget.cpp ignorelisteditor.h ignorelisteditor.cpp ignorelisttablewidget.h diff --git a/src/gui/internallinkwidget.cpp b/src/gui/internallinkwidget.cpp deleted file mode 100644 index e8c65005fe5f4..0000000000000 --- a/src/gui/internallinkwidget.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2022 by Claudio Cambra - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License - * for more details. - */ - -#include "internallinkwidget.h" -#include "accountstate.h" -#include "folderman.h" -#include "theme.h" - -#include "QProgressIndicator.h" -#include - -namespace OCC { - -Q_LOGGING_CATEGORY(lcInternalLink, "nextcloud.gui.internallink", QtInfoMsg) - -InternalLinkWidget::InternalLinkWidget(const QString &localPath, - QWidget *parent) - : QWidget(parent) - , _localPath(localPath) -{ - _ui->setupUi(this); - - const auto folder = FolderMan::instance()->folderForPath(_localPath); - const auto folderRelativePath = _localPath.mid(folder->cleanPath().length() + 1); - const auto serverRelativePath = QDir(folder->remotePath()).filePath(folderRelativePath); - - const auto bindLinkSlot = [this](QString link) { slotLinkFetched(link); }; - - fetchPrivateLinkUrl( - folder->accountState()->account(), - serverRelativePath, - {}, - this, - bindLinkSlot - ); - - _ui->copyInternalLinkButton->setEnabled(false); - _ui->internalLinkProgressIndicator->setVisible(true); - _ui->internalLinkProgressIndicator->startAnimation(); - - connect(_ui->copyInternalLinkButton, &QPushButton::clicked, this, &InternalLinkWidget::slotCopyInternalLink); -} - -void InternalLinkWidget::slotLinkFetched(const QString &url) -{ - _internalUrl = url; - _ui->copyInternalLinkButton->setEnabled(true); - _ui->internalLinkProgressIndicator->setVisible(false); - _ui->internalLinkProgressIndicator->stopAnimation(); - _ui->horizontalSpacer->changeSize(0, 0); - _ui->horizontalSpacer_2->changeSize(0, 0); -} - -void InternalLinkWidget::slotCopyInternalLink() const -{ - QApplication::clipboard()->setText(_internalUrl); -} - -void InternalLinkWidget::setupUiOptions() -{ - customizeStyle(); -} - -void InternalLinkWidget::slotStyleChanged() -{ - customizeStyle(); -} - -void InternalLinkWidget::customizeStyle() -{ - _ui->copyInternalLinkButton->setIcon(Theme::createColorAwareIcon(":/client/theme/copy.svg")); - _ui->internalLinkIconLabel->setPixmap(Theme::createColorAwarePixmap(":/client/theme/external.svg")); -} - -} diff --git a/src/gui/internallinkwidget.h b/src/gui/internallinkwidget.h deleted file mode 100644 index cb343a11e876b..0000000000000 --- a/src/gui/internallinkwidget.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2022 by Claudio Cambra - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License - * for more details. - */ - -#ifndef INTERNALLINKWIDGET_H -#define INTERNALLINKWIDGET_H - -#include "QProgressIndicator.h" -#include -#include - -#include "ui_internallinkwidget.h" - -namespace OCC { - -/** - * @brief The ShareDialog class - * @ingroup gui - */ -class InternalLinkWidget : public QWidget -{ - Q_OBJECT - -public: - explicit InternalLinkWidget(const QString &localPath, - QWidget *parent = nullptr); - ~InternalLinkWidget() override = default; - - void setupUiOptions(); - -public slots: - void slotStyleChanged(); - -private slots: - void slotLinkFetched(const QString &url); - void slotCopyInternalLink() const; - -private: - void customizeStyle(); - - std::unique_ptr _ui = std::make_unique(); - QString _localPath; - QString _internalUrl; - - QPushButton *_copyInternalLinkButton{}; -}; -} - -#endif // INTERNALLINKWIDGET_H diff --git a/src/gui/internallinkwidget.ui b/src/gui/internallinkwidget.ui deleted file mode 100644 index 202ec7240e729..0000000000000 --- a/src/gui/internallinkwidget.ui +++ /dev/null @@ -1,168 +0,0 @@ - - - OCC::InternalLinkWidget - - - - 0 - 0 - 400 - 238 - - - - - 0 - 0 - - - - - 0 - - - 12 - - - 0 - - - 20 - - - - - 6 - - - 0 - - - - - - - - :/client/theme/external.svg - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - 0 - 0 - - - - Internal link - - - - - - - - 0 - 0 - - - - true - - - color: rgb(118, 118, 118) - - - Only works for users with access to this folder - - - true - - - - - - - - - Qt::Horizontal - - - - 40 - 25 - - - - - - - - - 0 - 0 - - - - - 28 - 27 - - - - - - - - Qt::Horizontal - - - - 40 - 25 - - - - - - - - - - - - :/client/theme/copy.svg:/client/theme/copy.svg - - - false - - - true - - - - - - - - - - - QProgressIndicator - QWidget -
QProgressIndicator.h
- 1 -
-
- - - - -