Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Workaround notification incorrect issue #605

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/lib/cooperation/core/net/helper/sharehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <QStandardPaths>
#include <QDir>

#ifdef linux
#ifdef __linux__
# include "base/reportlog/reportlogmanager.h"
#endif

Expand All @@ -40,7 +40,7 @@ inline constexpr char NotifyAcceptAction[] { "accept" };
inline constexpr char ConnectButtonId[] { "connect-button" };
inline constexpr char DisconnectButtonId[] { "disconnect-button" };

#ifdef linux
#ifdef __linux__
inline constexpr char Kconnect[] { "connect" };
inline constexpr char Kdisconnect[] { "disconnect" };
#else
Expand Down Expand Up @@ -127,7 +127,7 @@ void ShareHelperPrivate::onAppAttributeChanged(const QString &group, const QStri

void ShareHelperPrivate::reportConnectionData()
{
#ifdef linux
#ifdef __linux__
if (!targetDeviceInfo)
return;

Expand Down Expand Up @@ -338,7 +338,7 @@ void ShareHelper::notifyConnectRequest(const QString &info)
d->recvServerPrint = infoList[2];
}

#ifdef linux
#ifdef __linux__
d->notifyMessage(body.arg(CommonUitls::elidedText(d->targetDevName, Qt::ElideMiddle, 15)), actions, 10 * 1000);
#else
CooperationUtil::instance()->activateWindow();
Expand Down Expand Up @@ -471,7 +471,7 @@ void ShareHelper::handleCancelCooperApply()
if (d->isReplied)
return;
static QString body(tr("The other party has cancelled the connection request !"));
#ifdef linux
#ifdef __linux__
d->notifyMessage(body, {}, 3 * 1000);
d->notice->resetNotifyId();
#else
Expand Down
15 changes: 4 additions & 11 deletions src/lib/cooperation/core/net/helper/transferhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <QProcess>
#include <QRegularExpression>

#ifdef linux
#ifdef __linux__
# include "base/reportlog/reportlogmanager.h"
# include <QDBusInterface>
# include <QDBusReply>
Expand All @@ -46,7 +46,7 @@ inline constexpr char NotifyViewAction[] { "view" };
using TransHistoryInfo = QMap<QString, QString>;
Q_GLOBAL_STATIC(TransHistoryInfo, transHistory)

#ifdef linux
#ifdef __linux__
inline constexpr char Khistory[] { "history" };
inline constexpr char Ksend[] { "send" };
#else
Expand Down Expand Up @@ -277,6 +277,7 @@ void TransferHelper::transferResult(bool result, const QString &msg)
if (result)
actions << NotifyViewAction << tr("View");
d->notifyMessage(msg, actions, 3 * 1000);
d->notice->resetNotifyId();
return;
}
#endif
Expand Down Expand Up @@ -364,20 +365,12 @@ void TransferHelper::notifyTransferRequest(const QString &nick, const QString &i
#endif
}

void TransferHelper::notifyTransferResult(bool result, const QString &msg)
{
QStringList actions;
if (result)
actions << NotifyViewAction << tr("View");

d->notifyMessage(msg, actions, 3 * 1000);
}

void TransferHelper::handleCancelTransferApply()
{
static QString body(tr("The other party has cancelled the transfer request !"));
#ifdef __linux__
d->notifyMessage(body, {}, 3 * 1000);
d->notice->resetNotifyId();
#else
d->transDialog()->showResultDialog(false, body);
#endif
Expand Down
1 change: 0 additions & 1 deletion src/lib/cooperation/core/net/helper/transferhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public Q_SLOTS:
void openFileLocation(const QString &path);
void onActionTriggered(const QString &action);
void notifyTransferRequest(const QString &nick, const QString &ip);
void notifyTransferResult(bool result, const QString &msg);
void handleCancelTransferApply();

// compat old protocol
Expand Down
Loading