Merge branch 'release/2.2.1' into develop
This commit is contained in:
@@ -107,6 +107,7 @@ void Config::init(const QString& fileName)
|
||||
{
|
||||
m_settings.reset(new QSettings(fileName, QSettings::IniFormat));
|
||||
|
||||
m_defaults.insert("SingleInstance", true);
|
||||
m_defaults.insert("RememberLastDatabases", true);
|
||||
m_defaults.insert("RememberLastKeyFiles", true);
|
||||
m_defaults.insert("OpenPreviousDatabasesOnStartup", true);
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
#include "Entry.h"
|
||||
|
||||
#include "config-keepassx.h"
|
||||
|
||||
#include "core/Database.h"
|
||||
#include "core/DatabaseIcons.h"
|
||||
#include "core/Group.h"
|
||||
@@ -237,6 +239,11 @@ QString Entry::url() const
|
||||
return m_attributes->value(EntryAttributes::URLKey);
|
||||
}
|
||||
|
||||
QString Entry::webUrl() const
|
||||
{
|
||||
return resolveUrl(m_attributes->value(EntryAttributes::URLKey));
|
||||
}
|
||||
|
||||
QString Entry::username() const
|
||||
{
|
||||
return m_attributes->value(EntryAttributes::UserNameKey);
|
||||
@@ -784,3 +791,31 @@ QString Entry::resolvePlaceholder(const QString& str) const
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QString Entry::resolveUrl(const QString& url) const
|
||||
{
|
||||
#ifdef WITH_XC_HTTP
|
||||
QString newUrl = url;
|
||||
if (!url.contains("://")) {
|
||||
// URL doesn't have a protocol, add https by default
|
||||
newUrl.prepend("https://");
|
||||
}
|
||||
QUrl tempUrl = QUrl(newUrl);
|
||||
|
||||
if (tempUrl.isValid()) {
|
||||
if (tempUrl.scheme() == "cmd") {
|
||||
// URL is a cmd, hopefully the second argument is an URL
|
||||
QStringList cmd = newUrl.split(" ");
|
||||
if (cmd.size() > 1) {
|
||||
return resolveUrl(cmd[1].remove("'").remove("\""));
|
||||
}
|
||||
} else if (tempUrl.scheme() == "http" || tempUrl.scheme() == "https") {
|
||||
// URL is nice
|
||||
return tempUrl.url();
|
||||
}
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(url);
|
||||
#endif
|
||||
return QString("");
|
||||
}
|
||||
@@ -78,6 +78,7 @@ public:
|
||||
const AutoTypeAssociations* autoTypeAssociations() const;
|
||||
QString title() const;
|
||||
QString url() const;
|
||||
QString webUrl() const;
|
||||
QString username() const;
|
||||
QString password() const;
|
||||
QString notes() const;
|
||||
@@ -143,6 +144,7 @@ public:
|
||||
void copyDataFrom(const Entry* other);
|
||||
QString resolveMultiplePlaceholders(const QString& str) const;
|
||||
QString resolvePlaceholder(const QString& str) const;
|
||||
QString resolveUrl(const QString& url) const;
|
||||
|
||||
/**
|
||||
* Call before and after set*() methods to create a history item
|
||||
|
||||
Reference in New Issue
Block a user