mirror of https://github.com/procxx/kepka.git
No warning from verified peers.
This commit is contained in:
parent
811bef41b8
commit
b75442a10e
|
@ -66,9 +66,18 @@ QString JoinStringList(const QStringList &list, const QString &separator) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaunchWithWarning(const QString &name) {
|
void LaunchWithWarning(const QString &name, HistoryItem *item) {
|
||||||
if (!Data::IsExecutableName(name)
|
const auto warn = [&] {
|
||||||
|| !Auth().settings().exeLaunchWarning()) {
|
if (!Data::IsExecutableName(name)) {
|
||||||
|
return false;
|
||||||
|
} else if (!Auth().settings().exeLaunchWarning()) {
|
||||||
|
return false;
|
||||||
|
} else if (item && item->history()->peer->isVerified()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}();
|
||||||
|
if (!warn) {
|
||||||
File::Launch(name);
|
File::Launch(name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -359,14 +368,14 @@ void DocumentOpenClickHandler::Open(
|
||||||
Messenger::Instance().showDocument(data, context);
|
Messenger::Instance().showDocument(data, context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LaunchWithWarning(location.name());
|
LaunchWithWarning(location.name(), context);
|
||||||
}
|
}
|
||||||
location.accessDisable();
|
location.accessDisable();
|
||||||
} else {
|
} else {
|
||||||
LaunchWithWarning(location.name());
|
LaunchWithWarning(location.name(), context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LaunchWithWarning(location.name());
|
LaunchWithWarning(location.name(), context);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -735,11 +744,11 @@ void DocumentData::performActionOnLoad() {
|
||||||
if (showImage && QImageReader(loc.name()).canRead()) {
|
if (showImage && QImageReader(loc.name()).canRead()) {
|
||||||
Messenger::Instance().showDocument(this, item);
|
Messenger::Instance().showDocument(this, item);
|
||||||
} else {
|
} else {
|
||||||
LaunchWithWarning(already);
|
LaunchWithWarning(already, item);
|
||||||
}
|
}
|
||||||
loc.accessDisable();
|
loc.accessDisable();
|
||||||
} else {
|
} else {
|
||||||
LaunchWithWarning(already);
|
LaunchWithWarning(already, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue