mirror of
https://github.com/feather-wallet/feather.git
synced 2025-04-16 18:01:54 +00:00
Update Utils.cpp
This commit is contained in:
parent
465576aa5a
commit
1e8045649c
1 changed files with 22 additions and 0 deletions
|
@ -15,6 +15,8 @@
|
|||
#include <QLayoutItem>
|
||||
#include <QJsonDocument>
|
||||
#include <QThread>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QStandardPaths>
|
||||
#include <QProcess>
|
||||
|
||||
|
@ -132,6 +134,26 @@ QString getSaveFileName(QWidget* parent, const QString &caption, const QString &
|
|||
return fn;
|
||||
}
|
||||
|
||||
bool Utils::copyIconToUserFolder(const QString &sourcePath, const QString &destinationPath) {
|
||||
QDir dir(destinationPath);
|
||||
if (!dir.exists()) {
|
||||
dir.mkpath(".");
|
||||
}
|
||||
|
||||
QFile file(sourcePath);
|
||||
if (!file.exists()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QString destFilePath = destinationPath + "/feather.svg";
|
||||
QFile::remove(destFilePath); // Remove if it already exists to avoid copy failure
|
||||
return file.copy(destFilePath);
|
||||
}
|
||||
|
||||
QString Utils::getDefaultIconPath() {
|
||||
return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/icons/hicolor/scalable/apps";
|
||||
}
|
||||
|
||||
QString getOpenFileName(QWidget* parent, const QString& caption, const QString& filter) {
|
||||
QString lastPath = conf()->get(Config::lastPath).toString();
|
||||
QString fn = QFileDialog::getOpenFileName(parent, caption, lastPath, filter);
|
||||
|
|
Loading…
Reference in a new issue