shareuserline.ui
sslerrordialog.ui
addcertificatedialog.ui
+ passwordinputdialog.ui
proxyauthdialog.ui
mnemonicdialog.ui
wizard/flow2authwidget.ui
openfilemanager.cpp
owncloudgui.cpp
owncloudsetupwizard.cpp
+ passwordinputdialog.cpp
selectivesyncdialog.cpp
settingsdialog.cpp
sharedialog.cpp
--- /dev/null
+/*
+ * Copyright (C) by Oleksandr Zolotov <alex@nextcloud.com>
+ *
+ * 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 "passwordinputdialog.h"
+#include "ui_passwordinputdialog.h"
+
+namespace OCC {
+
+PasswordInputDialog::PasswordInputDialog(const QString &description, const QString &error, QWidget *parent)
+ : QDialog(parent)
+ , ui(new Ui::PasswordInputDialog)
+{
+ ui->setupUi(this);
+
+ ui->passwordLineEditLabel->setText(description);
+ ui->passwordLineEditLabel->setVisible(!description.isEmpty());
+
+ ui->labelErrorMessage->setText(error);
+ ui->labelErrorMessage->setVisible(!error.isEmpty());
+
+ setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
+}
+
+PasswordInputDialog::~PasswordInputDialog()
+{
+ delete ui;
+}
+QString PasswordInputDialog::password() const
+{
+ return ui->passwordLineEdit->text();
+}
+}
--- /dev/null
+/*
+ * Copyright (C) by Oleksandr Zolotov <alex@nextcloud.com>
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include <QDialog>
+
+namespace OCC {
+
+namespace Ui {
+class PasswordInputDialog;
+}
+
+class PasswordInputDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit PasswordInputDialog(const QString &description, const QString &error, QWidget *parent = nullptr);
+ ~PasswordInputDialog() override;
+
+ QString password() const;
+
+private:
+ Ui::PasswordInputDialog *ui;
+};
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>OCC::PasswordInputDialog</class>
+ <widget class="QDialog" name="OCC::PasswordInputDialog">
+ <property name="windowModality">
+ <enum>Qt::WindowModal</enum>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>276</width>
+ <height>125</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>Password for share required</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="passwordLineEditLabel">
+ <property name="text">
+ <string>Please enter a password for your share:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="passwordLineEdit">
+ <property name="inputMask">
+ <string notr="true"/>
+ </property>
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ <property name="placeholderText">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="labelErrorMessage">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">color: rgb(255, 0, 0)</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>OCC::PasswordInputDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>OCC::PasswordInputDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
#include "sharee.h"
#include "sharelinkwidget.h"
#include "shareusergroupwidget.h"
+#include "passwordinputdialog.h"
#include "sharemanager.h"
}
}
-void ShareDialog::slotLinkShareRequiresPassword()
+void ShareDialog::slotLinkShareRequiresPassword(const QString &message)
{
- bool ok = false;
- QString password = QInputDialog::getText(this,
- tr("Password for share required"),
- tr("Please enter a password for your link share:"),
- QLineEdit::Password,
- QString(),
- &ok);
-
- if (!ok) {
- // The dialog was canceled so no need to do anything
+ const auto passwordInputDialog = new PasswordInputDialog(tr("Please enter a password for your link share:"), message, this);
+ passwordInputDialog->setWindowTitle(tr("Password for share required"));
+ passwordInputDialog->setAttribute(Qt::WA_DeleteOnClose);
+ passwordInputDialog->open();
+
+ connect(passwordInputDialog, &QDialog::finished, this, [this, passwordInputDialog](const int result) {
+ if (result == QDialog::Accepted && _manager) {
+ // Try to create the link share again with the newly entered password
+ _manager->createLinkShare(_sharePath, QString(), passwordInputDialog->password());
+ return;
+ }
emit toggleShareLinkAnimation(false);
- return;
- }
-
- if(_manager) {
- // Try to create the link share again with the newly entered password
- _manager->createLinkShare(_sharePath, QString(), password);
- }
+ });
}
void ShareDialog::slotDeleteShare()
void slotCreateLinkShare();
void slotCreatePasswordForLinkShare(const QString &password);
void slotCreatePasswordForLinkShareProcessed();
- void slotLinkShareRequiresPassword();
+ void slotLinkShareRequiresPassword(const QString &message);
void slotAdjustScrollWidgetSize();
signals: