-/*
+/*
* Copyright (C) by Roeland Jago Douma <roeland@famdouma.nl>
*
* This program is free software; you can redistribute it and/or modify
const auto remainingTime = QDateTime::currentDateTime().secsTo(QDateTime::fromSecsSinceEpoch(lockExpirationTime));
const auto remainingTimeInMinute = static_cast<int>(remainingTime > 0 ? remainingTime / SECONDS_PER_MINUTE : 0);
_ui->label_lockinfo->setText(tr("Locked by %1 - Expire in %2 minutes", "remaining time before lock expire", remainingTimeInMinute).arg(_filelockState._lockOwnerDisplayName).arg(remainingTimeInMinute));
+ } else {
+ _ui->label_lockinfo->setVisible(false);
}
QString ocDir(_sharePath);
if(_linkWidgetList.size() == 0) {
_emptyShareLinkWidget = new ShareLinkWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, _ui->scrollArea);
_linkWidgetList.append(_emptyShareLinkWidget);
+
+ _emptyShareLinkWidget->slotStyleChanged(); // Get the initial customizeStyle() to happen
+
connect(this, &ShareDialog::toggleShareLinkAnimation, _emptyShareLinkWidget, &ShareLinkWidget::slotToggleShareLinkAnimation);
- connect(_emptyShareLinkWidget, &ShareLinkWidget::createLinkShare, this, &ShareDialog::slotCreateLinkShare);
+ connect(this, &ShareDialog::styleChanged, _emptyShareLinkWidget, &ShareLinkWidget::slotStyleChanged);
+ connect(_emptyShareLinkWidget, &ShareLinkWidget::createLinkShare, this, &ShareDialog::slotCreateLinkShare);
connect(_emptyShareLinkWidget, &ShareLinkWidget::createPassword, this, &ShareDialog::slotCreatePasswordForLinkShare);
_ui->verticalLayout->insertWidget(_linkWidgetList.size()+1, _emptyShareLinkWidget);
// Connect styleChanged events to our widget, so it can adapt (Dark-/Light-Mode switching)
connect(this, &ShareDialog::styleChanged, _userGroupWidget, &ShareUserGroupWidget::slotStyleChanged);
+ _userGroupWidget->slotStyleChanged();
+
_ui->verticalLayout->insertWidget(1, _userGroupWidget);
_scrollAreaLayout->addLayout(_userGroupWidget->shareUserGroupLayout());
}
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
- <layout class="QGridLayout" name="gridLayout" rowstretch="0,0" columnstretch="0,0">
+ <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0" columnstretch="0,0">
<property name="leftMargin">
<number>0</number>
</property>
<number>0</number>
</property>
<property name="spacing">
- <number>10</number>
+ <number>2</number>
</property>
- <item row="0" column="0" rowspan="2">
- <widget class="QLabel" name="label_icon">
+ <item row="0" column="1">
+ <widget class="QLabel" name="label_name">
<property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
- <width>40</width>
- <height>40</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
+ <width>315</width>
+ <height>0</height>
</size>
</property>
<property name="text">
- <string>Icon</string>
+ <string>share label</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::PlainText</enum>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QLabel" name="label_name">
+ <item row="3" column="1">
+ <widget class="QLabel" name="label_lockinfo">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
</size>
</property>
<property name="text">
- <string>share label</string>
+ <string notr="true">TextLabel</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="1" column="1">
<widget class="QLabel" name="label_sharePath">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QLabel" name="label_lockinfo">
+ <item row="0" column="0" rowspan="3">
+ <widget class="QLabel" name="label_icon">
<property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
- <width>315</width>
- <height>0</height>
+ <width>40</width>
+ <height>40</height>
</size>
</property>
- <property name="text">
- <string notr="true">TextLabel</string>
- </property>
- <property name="textFormat">
- <enum>Qt::PlainText</enum>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
</property>
- <property name="wordWrap">
- <bool>true</bool>
+ <property name="text">
+ <string>Icon</string>
</property>
</widget>
</item>
}
// Adds action to unshare widget (check box)
- _unshareLinkAction = _linkContextMenu->addAction(QIcon(":/client/theme/delete.svg"),
- tr("Delete link"));
+ _unshareLinkAction.reset(_linkContextMenu->addAction(QIcon(":/client/theme/delete.svg"),
+ tr("Delete link")));
_linkContextMenu->addSeparator();
- _addAnotherLinkAction = _linkContextMenu->addAction(QIcon(":/client/theme/add.svg"),
- tr("Add another link"));
+ _addAnotherLinkAction.reset(_linkContextMenu->addAction(QIcon(":/client/theme/add.svg"),
+ tr("Add another link")));
_ui->enableShareLink->setIcon(QIcon(":/client/theme/copy.svg"));
disconnect(_ui->enableShareLink, &QPushButton::clicked, this, &ShareLinkWidget::slotCreateShareLink);
const auto state = action->isChecked();
SharePermissions perm = SharePermissionRead;
- if (action == _addAnotherLinkAction) {
+ if (action == _addAnotherLinkAction.data()) {
emit createLinkShare();
} else if (action == _readOnlyLinkAction && state) {
} else if (action == _noteLinkAction) {
toggleNoteOptions(state);
- } else if (action == _unshareLinkAction) {
+ } else if (action == _unshareLinkAction.data()) {
confirmAndDeleteShare();
}
}
void ShareLinkWidget::customizeStyle()
{
- _unshareLinkAction->setIcon(Theme::createColorAwareIcon(":/client/theme/delete.svg"));
+ if(_unshareLinkAction) {
+ _unshareLinkAction->setIcon(Theme::createColorAwareIcon(":/client/theme/delete.svg"));
+ }
- _addAnotherLinkAction->setIcon(Theme::createColorAwareIcon(":/client/theme/add.svg"));
+ if(_addAnotherLinkAction) {
+ _addAnotherLinkAction->setIcon(Theme::createColorAwareIcon(":/client/theme/add.svg"));
+ }
_ui->enableShareLink->setIcon(Theme::createColorAwareIcon(":/client/theme/copy.svg"));
QAction *_allowUploadLinkAction;
QAction *_passwordProtectLinkAction;
QAction *_expirationDateLinkAction;
- QAction *_unshareLinkAction;
- QAction *_addAnotherLinkAction;
+ QScopedPointer<QAction> _unshareLinkAction;
+ QScopedPointer<QAction> _addAnotherLinkAction;
QAction *_noteLinkAction;
QHBoxLayout *_shareLinkLayout{};
QLabel *_shareLinkLabel{};
_completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
_ui->shareeLineEdit->setCompleter(_completer);
- auto searchGloballyAction = new QAction(_ui->shareeLineEdit);
- searchGloballyAction->setIcon(QIcon(":/client/theme/magnifying-glass.svg"));
- searchGloballyAction->setToolTip(tr("Search globally"));
+ _searchGloballyAction.reset(new QAction(_ui->shareeLineEdit));
+ _searchGloballyAction->setIcon(Theme::createColorAwareIcon(":/client/theme/magnifying-glass.svg"));
+ _searchGloballyAction->setToolTip(tr("Search globally"));
- connect(searchGloballyAction, &QAction::triggered, this, [this]() {
+ connect(_searchGloballyAction.data(), &QAction::triggered, this, [this]() {
searchForSharees(ShareeModel::GlobalSearch);
});
- _ui->shareeLineEdit->addAction(searchGloballyAction, QLineEdit::LeadingPosition);
+ _ui->shareeLineEdit->addAction(_searchGloballyAction.data(), QLineEdit::LeadingPosition);
_manager = new ShareManager(_account, this);
connect(_manager, &ShareManager::sharesFetched, this, &ShareUserGroupWidget::slotSharesFetched);
void ShareUserGroupWidget::customizeStyle()
{
+ _searchGloballyAction->setIcon(Theme::createColorAwareIcon(":/client/theme/magnifying-glass.svg"));
+
_ui->confirmShare->setIcon(Theme::createColorAwareIcon(":/client/theme/confirm.svg"));
_pi_sharee.setColor(QGuiApplication::palette().color(QPalette::Text));
void activateShareeLineEdit();
Ui::ShareUserGroupWidget *_ui;
+ QScopedPointer<QAction> _searchGloballyAction;
QScrollArea *_parentScrollArea;
QVBoxLayout *_shareUserGroup;
AccountPtr _account;