mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Sharing: Display the error from the server when trying to share with users or group
This commit is contained in:
parent
bb5c370575
commit
1ed02f6494
5 changed files with 23 additions and 9 deletions
|
@ -505,8 +505,8 @@ void ShareLinkWidget::setShareCheckBoxTitle(bool haveShares)
|
|||
void ShareLinkWidget::displayError(int code, const QString &message)
|
||||
{
|
||||
const QString arg = QString("%1, %2").arg(code).arg(message);
|
||||
const QString errMsg = tr("OCS API error code: %1").arg(arg);
|
||||
displayError(errMsg);
|
||||
qDebug() << "Error from server" << code << message;
|
||||
displayError(message);
|
||||
}
|
||||
|
||||
void ShareLinkWidget::displayError(const QString& errMsg)
|
||||
|
@ -515,10 +515,5 @@ void ShareLinkWidget::displayError(const QString& errMsg)
|
|||
_ui->errorLabel->show();
|
||||
}
|
||||
|
||||
void ShareLinkWidget::displayError(int code)
|
||||
{
|
||||
const QString errMsg = tr("OCS API error code: %1").arg(code);
|
||||
displayError(errMsg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -74,7 +74,6 @@ private slots:
|
|||
|
||||
private:
|
||||
void setShareCheckBoxTitle(bool haveShares);
|
||||
void displayError(int code);
|
||||
void displayError(const QString& errMsg);
|
||||
void setShareLink( const QString& url );
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
|
|
@ -74,6 +74,7 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, const QString &sh
|
|||
_manager = new ShareManager(_account, this);
|
||||
connect(_manager, SIGNAL(sharesFetched(QList<QSharedPointer<Share>>)), SLOT(slotSharesFetched(QList<QSharedPointer<Share>>)));
|
||||
connect(_manager, SIGNAL(shareCreated(QSharedPointer<Share>)), SLOT(getShares()));
|
||||
connect(_manager, SIGNAL(serverError(int,QString)), this, SLOT(displayError(int,QString)));
|
||||
connect(_ui->shareeLineEdit, SIGNAL(returnPressed()), SLOT(slotLineEditReturn()));
|
||||
|
||||
// By making the next two QueuedConnections we can override
|
||||
|
@ -91,6 +92,7 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, const QString &sh
|
|||
_completionTimer.setInterval(600);
|
||||
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
|
||||
_ui->errorLabel->hide();
|
||||
}
|
||||
|
||||
ShareUserGroupWidget::~ShareUserGroupWidget()
|
||||
|
@ -230,6 +232,13 @@ void ShareUserGroupWidget::slotCompleterHighlighted(const QModelIndex & index)
|
|||
_ui->shareeLineEdit->setText(index.data(Qt::DisplayRole).toString());
|
||||
}
|
||||
|
||||
void ShareUserGroupWidget::displayError(int code, const QString& message)
|
||||
{
|
||||
qDebug() << "Error from server" << code << message;
|
||||
_ui->errorLabel->setText(message);
|
||||
_ui->errorLabel->show();
|
||||
}
|
||||
|
||||
ShareWidget::ShareWidget(QSharedPointer<Share> share,
|
||||
bool isFile,
|
||||
QWidget *parent) :
|
||||
|
|
|
@ -109,6 +109,7 @@ private slots:
|
|||
void slotCompleterHighlighted(const QModelIndex & index);
|
||||
void slotShareesReady();
|
||||
void slotAdjustScrollWidgetSize();
|
||||
void displayError(int code ,const QString &message);
|
||||
|
||||
private:
|
||||
Ui::ShareUserGroupWidget *_ui;
|
||||
|
|
|
@ -41,13 +41,23 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>441</width>
|
||||
<height>128</height>
|
||||
<height>98</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3"/>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="errorLabel">
|
||||
<property name="text">
|
||||
<string notr="true">Placeholder for Error text</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
|
|
Loading…
Reference in a new issue