Skip to content

Commit 441ffce

Browse files
committed
chore(sharing): remove unused methods related to name attributes
We use `label` for that Signed-off-by: Jyrki Gadinger <nilsding@nilsding.org>
1 parent 739915d commit 441ffce

7 files changed

Lines changed: 4 additions & 71 deletions

File tree

src/gui/filedetails/sharemodel.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ QVariant ShareModel::data(const QModelIndex &index, const int role) const
9393
switch (role) {
9494
case LinkRole:
9595
return linkShare->getLink();
96-
case LinkShareNameRole:
97-
return linkShare->getName();
9896
case LinkShareLabelRole:
9997
return linkShare->getLabel();
10098
case NoteEnabledRole:
@@ -184,7 +182,6 @@ QVariant ShareModel::data(const QModelIndex &index, const int role) const
184182
case HideDownloadEnabledRole:
185183
return false;
186184
case LinkRole:
187-
case LinkShareNameRole:
188185
case LinkShareLabelRole:
189186
case NoteRole:
190187
case ExpireDateRole:
@@ -666,7 +663,6 @@ void ShareModel::slotAddShare(const SharePtr &share)
666663

667664
if (const auto linkShare = share.objectCast<LinkShare>()) {
668665
connect(linkShare.data(), &LinkShare::noteSet, this, [this, shareId]{ slotShareNoteSet(shareId); });
669-
connect(linkShare.data(), &LinkShare::nameSet, this, [this, shareId]{ slotShareNameSet(shareId); });
670666
connect(linkShare.data(), &LinkShare::labelSet, this, [this, shareId]{ slotShareLabelSet(shareId); });
671667
connect(linkShare.data(), &LinkShare::expireDateSet, this, [this, shareId]{ slotShareExpireDateSet(shareId); });
672668
connect(linkShare.data(), &LinkShare::hideDownloadSet, this, [this, shareId] { slotHideDownloadSet(shareId); });
@@ -908,17 +904,6 @@ void ShareModel::slotShareNoteSet(const QString &shareId)
908904
Q_EMIT dataChanged(shareModelIndex, shareModelIndex, { NoteEnabledRole, NoteRole });
909905
}
910906

911-
void ShareModel::slotShareNameSet(const QString &shareId)
912-
{
913-
if (shareId.isEmpty() || !_shareIdIndexHash.contains(shareId)) {
914-
return;
915-
}
916-
917-
const auto sharePersistentModelIndex = _shareIdIndexHash.value(shareId);
918-
const auto shareModelIndex = index(sharePersistentModelIndex.row());
919-
Q_EMIT dataChanged(shareModelIndex, shareModelIndex, { LinkShareNameRole });
920-
}
921-
922907
void ShareModel::slotShareLabelSet(const QString &shareId)
923908
{
924909
if (shareId.isEmpty() || !_shareIdIndexHash.contains(shareId)) {

src/gui/filedetails/sharemodel.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ private slots:
216216
void slotSharePasswordSet(const QString &shareId);
217217
void slotShareNoteSet(const QString &shareId);
218218
void slotHideDownloadSet(const QString &shareId);
219-
void slotShareNameSet(const QString &shareId);
220219
void slotShareLabelSet(const QString &shareId);
221220
void slotShareExpireDateSet(const QString &shareId);
222221
void slotDeleteE2EeShare(const OCC::SharePtr &share) const;

src/gui/ocssharejob.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,6 @@ void OcsShareJob::setNote(const QString &shareId, const QString &note)
8181
start();
8282
}
8383

84-
void OcsShareJob::setName(const QString &shareId, const QString &name)
85-
{
86-
appendPath(shareId);
87-
setVerb("PUT");
88-
addParam(QString::fromLatin1("name"), name);
89-
_value = name;
90-
91-
start();
92-
}
93-
9484
void OcsShareJob::setPermissions(const QString &shareId,
9585
const Share::Permissions permissions)
9686
{

src/gui/ocssharejob.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ class OcsShareJob : public OcsJob
6969
*/
7070
void setPassword(const QString &shareId, const QString &password);
7171

72-
/**
73-
* Change the name of a share
74-
*/
75-
void setName(const QString &shareId, const QString &name);
76-
7772
/**
7873
* Set the permissions
7974
*

src/gui/sharemanager.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ LinkShare::LinkShare(AccountPtr account,
200200
const QString &uidFileOwner,
201201
const QString &ownerDisplayName,
202202
const QString &path,
203-
const QString &name,
204203
const QString &token,
205204
Permissions permissions,
206205
bool isPasswordSet,
@@ -210,7 +209,6 @@ LinkShare::LinkShare(AccountPtr account,
210209
const QString &label,
211210
const bool hideDownload)
212211
: Share(account, id, uidOwner, uidFileOwner, ownerDisplayName, path, Share::TypeLink, isPasswordSet, permissions)
213-
, _name(name)
214212
, _token(token)
215213
, _note(note)
216214
, _expireDate(expireDate)
@@ -230,11 +228,6 @@ bool LinkShare::getShowFileListing() const
230228
return _permissions & SharePermissionRead;
231229
}
232230

233-
QString LinkShare::getName() const
234-
{
235-
return _name;
236-
}
237-
238231
QString LinkShare::getNote() const
239232
{
240233
return _note;
@@ -250,11 +243,6 @@ bool LinkShare::getHideDownload() const
250243
return _hideDownload;
251244
}
252245

253-
void LinkShare::setName(const QString &name)
254-
{
255-
createShareJob(&LinkShare::slotNameSet)->setName(getId(), name);
256-
}
257-
258246
void LinkShare::setNote(const QString &note)
259247
{
260248
createShareJob(&LinkShare::slotNoteSet)->setNote(getId(), note);
@@ -310,12 +298,6 @@ void LinkShare::slotExpireDateSet(const QJsonDocument &reply, const QVariant &va
310298
emit expireDateSet();
311299
}
312300

313-
void LinkShare::slotNameSet(const QJsonDocument &, const QVariant &value)
314-
{
315-
_name = value.toString();
316-
emit nameSet();
317-
}
318-
319301
void LinkShare::slotLabelSet(const QJsonDocument &, const QVariant &label)
320302
{
321303
if (_label != label.toString()) {
@@ -663,7 +645,6 @@ QSharedPointer<LinkShare> ShareManager::parseLinkShare(const QJsonObject &data)
663645
data.value("uid_file_owner"_L1).toString(),
664646
data.value("displayname_owner"_L1).toString(),
665647
data.value("path"_L1).toString(),
666-
data.value("name"_L1).toString(),
667648
data.value("token"_L1).toString(),
668649
(Share::Permissions)data.value("permissions"_L1).toInt(),
669650
data.value("share_with"_L1).isString(), // has password?

src/gui/sharemanager.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ class LinkShare : public Share
196196
Q_PROPERTY(QUrl directDownloadLink READ getDirectDownloadLink CONSTANT)
197197
Q_PROPERTY(bool publicCanUpload READ getPublicUpload CONSTANT)
198198
Q_PROPERTY(bool publicCanReadDirectory READ getShowFileListing CONSTANT)
199-
Q_PROPERTY(QString name READ getName WRITE setName NOTIFY nameSet)
200199
Q_PROPERTY(QString note READ getNote WRITE setNote NOTIFY noteSet)
201200
Q_PROPERTY(QString label READ getLabel WRITE setLabel NOTIFY labelSet)
202201
Q_PROPERTY(bool hideDownload READ getHideDownload WRITE setHideDownload NOTIFY hideDownloadSet)
@@ -210,7 +209,6 @@ class LinkShare : public Share
210209
const QString &uidFileOwner,
211210
const QString &ownerDisplayName,
212211
const QString &path,
213-
const QString &name,
214212
const QString &token,
215213
const Permissions permissions,
216214
bool isPasswordSet,
@@ -240,11 +238,6 @@ class LinkShare : public Share
240238
*/
241239
[[nodiscard]] bool getShowFileListing() const;
242240

243-
/*
244-
* Returns the name of the link share. Can be empty.
245-
*/
246-
[[nodiscard]] QString getName() const;
247-
248241
/*
249242
* Returns the note of the link share.
250243
*/
@@ -277,13 +270,6 @@ class LinkShare : public Share
277270
OcsShareJob *createShareJob(const LinkShareSlot slotFunction);
278271

279272
public slots:
280-
/*
281-
* Set the name of the link share.
282-
*
283-
* Emits either nameSet() or serverError().
284-
*/
285-
void setName(const QString &name);
286-
287273
/*
288274
* Set the note of the link share.
289275
*/
@@ -310,18 +296,15 @@ public slots:
310296
signals:
311297
void expireDateSet();
312298
void noteSet();
313-
void nameSet();
314299
void labelSet();
315300

316301
private slots:
317302
void slotNoteSet(const QJsonDocument &, const QVariant &value);
318303
void slotExpireDateSet(const QJsonDocument &reply, const QVariant &value);
319-
void slotNameSet(const QJsonDocument &, const QVariant &value);
320304
void slotLabelSet(const QJsonDocument &, const QVariant &value);
321305
void slotHideDownloadSet(const QJsonDocument &jsonDoc, const QVariant &hideDownload);
322306

323307
private:
324-
QString _name;
325308
QString _token;
326309
QString _note;
327310
QDate _expireDate;

src/gui/socketapi/socketapi.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -808,15 +808,15 @@ class GetOrCreatePublicLinkShare : public QObject
808808
private slots:
809809
void sharesFetched(const QList<OCC::SharePtr> &shares)
810810
{
811-
auto shareName = SocketApi::tr("Context menu share");
811+
auto shareLabel = SocketApi::tr("Context menu share");
812812

813813
// If there already is a context menu share, reuse it
814814
for (const auto &share : shares) {
815815
const auto linkShare = qSharedPointerDynamicCast<LinkShare>(share);
816816
if (!linkShare)
817817
continue;
818818

819-
if (linkShare->getName() == shareName) {
819+
if (linkShare->getLabel() == shareLabel) {
820820
qCDebug(lcPublicLink) << "Found existing share, reusing";
821821
return success(linkShare->getLink().toString());
822822
}
@@ -825,9 +825,9 @@ private slots:
825825
// otherwise create a new one
826826
qCDebug(lcPublicLink) << "Creating new share";
827827
if (_isSecureFileDropOnlyFolder) {
828-
_shareManager.createSecureFileDropShare(_localFile, shareName, QString());
828+
_shareManager.createSecureFileDropShare(_localFile, shareLabel, QString());
829829
} else {
830-
_shareManager.createLinkShare(_localFile, shareName, QString());
830+
_shareManager.createLinkShare(_localFile, shareLabel, QString());
831831
}
832832
}
833833

0 commit comments

Comments
 (0)