Skip to content

Commit

Permalink
Fix compatible issues on Qt6 framework (#1487)
Browse files Browse the repository at this point in the history
  • Loading branch information
rumtid authored Sep 8, 2023
1 parent dee48d5 commit 5bc61af
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/seafile-applet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ QVariant SeafileApplet::readPreconfigureEntry(const QString& key, const QVariant
return value;
}

QString SeafileApplet::readPreconfigureExpandedString(const QString& key, const QString& default_value)
QString SeafileApplet::readPreconfigureExpandedString(const QString& key, const QVariant& default_value)
{
QVariant retval = readPreconfigureEntry(key, default_value);
if (retval.isNull() || retval.type() != QVariant::String)
Expand Down
2 changes: 1 addition & 1 deletion src/seafile-applet.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SeafileApplet : QObject {
// Read preconfigure settings
QVariant readPreconfigureEntry(const QString& key, const QVariant& default_value = QVariant());
// ExpandedVars String
QString readPreconfigureExpandedString(const QString& key, const QString& default_value = QString());
QString readPreconfigureExpandedString(const QString& key, const QVariant& default_value = QVariant());

// Create a unique device id to replace obselete ccnet id
QString getUniqueClientId();
Expand Down
2 changes: 2 additions & 0 deletions src/utils/file-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <QDir>
#include <QStringList>
#include "stl.h"
#include "utils.h"

#ifdef Q_OS_WIN32
#include <windows.h>
Expand Down Expand Up @@ -817,6 +818,7 @@ QString expandVars(const QString& origin)
retval = QString::fromWCharArray(&expanded[0], expanded_size);
// workaround with a bug
retval = QString::fromUtf8(retval.toUtf8());
retval = trimNULL(retval);
} else {
retval = origin;
}
Expand Down
1 change: 1 addition & 0 deletions src/utils/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ void RegElement::read()

// workaround with a bug
string_value_ = QString::fromUtf8(string_value_.toUtf8());
string_value_ = trimNULL(string_value_);

return;
}
Expand Down
7 changes: 7 additions & 0 deletions src/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,3 +831,10 @@ const QRect getScreenSize(int index) {
return QRect();
}
}

QString trimNULL(QString& s) {
if (s.endsWith(QChar::Null)) {
s.chop(1);
}
return s;
}
2 changes: 2 additions & 0 deletions src/utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,6 @@ bool shouldUseFramelessWindow();

const QRect getScreenSize(int index);

QString trimNULL(QString& s);

#endif

0 comments on commit 5bc61af

Please sign in to comment.