Ported new features to QT4
FossilOrigin-Name: 28087b899e38a3881855cf1e7272da3fb13b3462
This commit is contained in:
@@ -141,11 +141,11 @@ bool Fossil::pushRepository(const QUrl &url)
|
||||
|
||||
if(!url.isEmpty())
|
||||
{
|
||||
params << url.toString();
|
||||
params << url.toEncoded();
|
||||
params << "--once";
|
||||
|
||||
QStringList log_params = params;
|
||||
log_params[1] = url.toDisplayString();
|
||||
log_params[1] = UrlToStringDisplay(url);
|
||||
log_params.push_front("fossil");
|
||||
|
||||
runFlags = RUNFLAGS_SILENT_INPUT;
|
||||
@@ -165,11 +165,12 @@ bool Fossil::pullRepository(const QUrl &url)
|
||||
|
||||
if(!url.isEmpty())
|
||||
{
|
||||
params << url.toString();
|
||||
params << url.toEncoded();
|
||||
params << "--once";
|
||||
|
||||
QStringList log_params = params;
|
||||
log_params[1] = url.toDisplayString();
|
||||
log_params[1] = UrlToStringDisplay(url);
|
||||
|
||||
log_params.push_front("fossil");
|
||||
|
||||
runFlags = RUNFLAGS_SILENT_INPUT;
|
||||
@@ -403,7 +404,7 @@ bool Fossil::setFossilSetting(const QString& name, const QString& value, bool gl
|
||||
//------------------------------------------------------------------------------
|
||||
bool Fossil::setRemoteUrl(const QUrl& url)
|
||||
{
|
||||
QString u = url.toString(QUrl::FullyEncoded);
|
||||
QString u = url.toEncoded();
|
||||
|
||||
if(url.isEmpty())
|
||||
u = "off";
|
||||
|
@@ -660,7 +660,7 @@ void MainWindow::scanWorkspace()
|
||||
lblRevision->setText(tr("Revision: %0").arg(fossil().getCurrentRevision()));
|
||||
lblRevision->setVisible(true);
|
||||
|
||||
lblTags->setText(tr("Tags: %0").arg(fossil().getCurrentTags().join(' ')));
|
||||
lblTags->setText(tr("Tags: %0").arg(fossil().getCurrentTags().join(" ")));
|
||||
lblTags->setVisible(true);
|
||||
}
|
||||
|
||||
@@ -807,7 +807,8 @@ void MainWindow::updateWorkspaceView()
|
||||
{
|
||||
QStandardItem *remote_item = new QStandardItem(getInternalIcon(":icons/icon-item-remote"), it->name);
|
||||
remote_item->setData(WorkspaceItem(WorkspaceItem::TYPE_REMOTE, it->url.toString()), ROLE_WORKSPACE_ITEM);
|
||||
remote_item->setToolTip(it->url.toDisplayString());
|
||||
|
||||
remote_item->setToolTip(UrlToStringDisplay(it->url));
|
||||
|
||||
// Mark the default url as bold
|
||||
if(it->isDefault)
|
||||
|
@@ -29,7 +29,7 @@ bool RemoteDialog::run(QWidget *parent, QUrl &url, QString &name)
|
||||
// Set URL components
|
||||
if(!url.isEmpty())
|
||||
{
|
||||
QString url_no_credentials = url.toString(QUrl::PrettyDecoded|QUrl::RemoveUserInfo);
|
||||
QString url_no_credentials = UrlToStringNoCredentials(url);
|
||||
dlg.ui->lineURL->setText(url_no_credentials);
|
||||
dlg.ui->lineUserName->setText(url.userName());
|
||||
dlg.ui->linePassword->setText(url.password());
|
||||
@@ -56,7 +56,7 @@ bool RemoteDialog::run(QWidget *parent, QUrl &url, QString &name)
|
||||
|
||||
name =dlg.ui->lineName->text().trimmed();
|
||||
if(name.isEmpty())
|
||||
name = url.toString(QUrl::PrettyDecoded|QUrl::RemoveUserInfo);
|
||||
name = UrlToStringNoCredentials(url);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -14,7 +14,15 @@ RevisionDialog::RevisionDialog(QWidget *parent, const QStringList &completions,
|
||||
ui->cmbRevision->addItems(completions);
|
||||
|
||||
if(!defaultValue.isEmpty())
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
int index = ui->cmbRevision->findText(defaultValue);
|
||||
if(index>=0)
|
||||
ui->cmbRevision->setCurrentIndex(index);
|
||||
#else
|
||||
ui->cmbRevision->setCurrentText(defaultValue);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -3,6 +3,7 @@
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFileDialog>
|
||||
#include <QEventLoop>
|
||||
#include <QUrl>
|
||||
#include "ext/qtkeychain/keychain.h"
|
||||
#include <QCryptographicHash>
|
||||
|
||||
@@ -397,7 +398,7 @@ void BuildNameToModelIndex(name_modelindex_map_t &map, const QStandardItemModel
|
||||
bool KeychainSet(QObject *parent, const QUrl &url)
|
||||
{
|
||||
QEventLoop loop(parent);
|
||||
QKeychain::WritePasswordJob job(url.toString(QUrl::PrettyDecoded|QUrl::RemoveUserInfo));
|
||||
QKeychain::WritePasswordJob job(UrlToStringNoCredentials(url));
|
||||
job.connect( &job, SIGNAL(finished(QKeychain::Job*)), &loop, SLOT(quit()) );
|
||||
job.setAutoDelete( false );
|
||||
job.setInsecureFallback(false);
|
||||
@@ -412,7 +413,7 @@ bool KeychainSet(QObject *parent, const QUrl &url)
|
||||
bool KeychainGet(QObject *parent, QUrl &url)
|
||||
{
|
||||
QEventLoop loop(parent);
|
||||
QKeychain::ReadPasswordJob job(url.toString(QUrl::PrettyDecoded|QUrl::RemoveUserInfo));
|
||||
QKeychain::ReadPasswordJob job(UrlToStringNoCredentials(url));
|
||||
job.connect( &job, SIGNAL(finished(QKeychain::Job*)), &loop, SLOT(quit()));
|
||||
job.setAutoDelete( false );
|
||||
job.setInsecureFallback(false);
|
||||
@@ -433,7 +434,7 @@ bool KeychainGet(QObject *parent, QUrl &url)
|
||||
bool KeychainDelete(QObject* parent, const QUrl& url)
|
||||
{
|
||||
QEventLoop loop(parent);
|
||||
QKeychain::DeletePasswordJob job(url.toString(QUrl::PrettyDecoded|QUrl::RemoveUserInfo));
|
||||
QKeychain::DeletePasswordJob job(UrlToStringNoCredentials(url));
|
||||
job.connect( &job, SIGNAL(finished(QKeychain::Job*)), &loop, SLOT(quit()));
|
||||
job.setAutoDelete( false );
|
||||
job.setInsecureFallback(false);
|
||||
@@ -454,3 +455,23 @@ QString HashString(const QString& str)
|
||||
QString str_out(hash.result().toHex());
|
||||
return str_out;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
QString UrlToStringDisplay(const QUrl& url)
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
return url.toString(QUrl::RemovePassword);
|
||||
#else
|
||||
return url.toDisplayString();
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
QString UrlToStringNoCredentials(const QUrl& url)
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||
return url.toString(QUrl::RemoveUserInfo);
|
||||
#else
|
||||
return url.toString(QUrl::PrettyDecoded|QUrl::RemoveUserInfo);
|
||||
#endif
|
||||
}
|
||||
|
@@ -26,6 +26,8 @@ bool KeychainSet(QObject* parent, const QUrl& url);
|
||||
bool KeychainGet(QObject* parent, QUrl& url);
|
||||
bool KeychainDelete(QObject* parent, const QUrl& url);
|
||||
QString HashString(const QString &str);
|
||||
QString UrlToStringDisplay(const QUrl &url);
|
||||
QString UrlToStringNoCredentials(const QUrl& url);
|
||||
|
||||
|
||||
typedef QMap<QString, QString> QStringMap;
|
||||
|
@@ -107,7 +107,7 @@ bool Workspace::switchWorkspace(const QString& workspace, QSettings &store)
|
||||
// Add Default remote if not available already
|
||||
if(findRemote(default_remote)==NULL)
|
||||
{
|
||||
addRemote(default_remote, default_remote.toDisplayString());
|
||||
addRemote(default_remote, UrlToStringDisplay(default_remote));
|
||||
setRemoteDefault(default_remote);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user