Fixed workspace remote storage
Added Delete Remote action Double-cliking a remote triggers a remote editing FossilOrigin-Name: 6c042af93ec30f09386497c176b9c0736ac47690
This commit is contained in:
parent
06695db9fe
commit
422bbafdf6
22
manifest
22
manifest
@ -1,5 +1,5 @@
|
||||
C Initial\swork\son\smultiple\sremotes\n
|
||||
D 2015-05-28T19:29:09.765
|
||||
C Fixed\sworkspace\sremote\sstorage\nAdded\sDelete\sRemote\saction\nDouble-cliking\sa\sremote\striggers\sa\sremote\sediting\n
|
||||
D 2015-05-29T18:45:44.456
|
||||
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
||||
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
||||
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
||||
@ -224,8 +224,8 @@ F src/FslSettingsDialog.cpp 2531d3709f0eab66651671e3edead2ca720d07d5
|
||||
F src/FslSettingsDialog.h dfe2a61884a55a74cbb9206b6f6b482b979725e7
|
||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||
F src/MainWindow.cpp 351608ee4b8c21add1bdac28cf939e9cd6624924
|
||||
F src/MainWindow.h 7695cd800ee82df10dd7c17016152aff92572d39
|
||||
F src/MainWindow.cpp bc954c5923c874255399755b9d3eee6077e464f4
|
||||
F src/MainWindow.h 1ecfb255c8e013cf4e2d07bfd485ed41d26c97c7
|
||||
F src/RemoteDialog.cpp 7f4272117080260c31c748e2ada3e33adc024826
|
||||
F src/RemoteDialog.h 5e0438c2bd7c79b1bb44bfbd58c2181b544a9e5d
|
||||
F src/RevisionDialog.cpp 51065c65a07c118dd1a7363da4a55a135d1c6c9c
|
||||
@ -236,9 +236,9 @@ F src/Settings.cpp 7a674604caa9d9f5ffb6b73d95745bde09525389
|
||||
F src/Settings.h 883ac5c0f38a6ac93b400b7b96447b017ee50c06
|
||||
F src/SettingsDialog.cpp 25be4c351dd21ea9132321944f42dc0bc22fb128
|
||||
F src/SettingsDialog.h b324dfd77ca3ad24fd83588aaf79a7e4c291e716
|
||||
F src/Utils.cpp abfd679b8a4a320207abe385b8f3a4af8f646a55
|
||||
F src/Utils.h c293175ea08801aa4f0513bf2820213f8958f704
|
||||
F src/Workspace.cpp 3722904319b7ad7c172cfe6fa56712308e5d2fd6
|
||||
F src/Utils.cpp 09ba0fc6d6d293ebbd2f7c7283286b68d3cb04fb
|
||||
F src/Utils.h e22c5d86722e3987894fa06bdee3d57597ff425e
|
||||
F src/Workspace.cpp c3ff643688224aaac2f96c4b3a5e1f96a407e16e
|
||||
F src/Workspace.h 7ae2e63196433ae34864d182e49e3a2f0726fb78
|
||||
F src/main.cpp d8c65ea5e54102e4989fef9fd8cfd4f13ef8a8f0
|
||||
F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x
|
||||
@ -248,11 +248,11 @@ F ui/CloneDialog.ui 4886e7d4f258ea8b852b5eefc860396e35145712
|
||||
F ui/CommitDialog.ui aea77347eef82b6b591f31fb058a1bb96193c728
|
||||
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
|
||||
F ui/FslSettingsDialog.ui eb3d4cb764cab90b01e82922237d8c42d6ce1749
|
||||
F ui/MainWindow.ui d51fe6d742278eafffedfd13dd543a3daf30c4a8
|
||||
F ui/MainWindow.ui 5857b45ed96fb027b6159e44742e9afaa3e89cfb
|
||||
F ui/RemoteDialog.ui 95a4750d972ed8c49bb10b95db91ff16cfe2dd0b
|
||||
F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd
|
||||
F ui/SettingsDialog.ui 4c480cd595a32664d01c85bf74845c4282fc0068
|
||||
P 54518e5519ad4d5d478c815cc78859c9120997fe
|
||||
R 10cdbc5cfc32fc545a4e7e4dafc82685
|
||||
P 9674708cb5f2e8543e01d64211b6768d2cb726d6
|
||||
R e972a555bf8af66b3d0a2b5167c83ea1
|
||||
U kostas
|
||||
Z 3161499b5cec5757d1886c4cd078bc1c
|
||||
Z ac3734f99e92a433200bdfee8aa7103b
|
||||
|
@ -1 +1 @@
|
||||
9674708cb5f2e8543e01d64211b6768d2cb726d6
|
||||
6c042af93ec30f09386497c176b9c0736ac47690
|
@ -181,6 +181,7 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
|
||||
menuRemotes->addAction(ui->actionPullRemote);
|
||||
menuRemotes->addAction(separator);
|
||||
menuRemotes->addAction(ui->actionAddRemote);
|
||||
menuRemotes->addAction(ui->actionDeleteRemote);
|
||||
menuRemotes->addAction(ui->actionEditRemote);
|
||||
menuRemotes->addAction(ui->actionSetDefaultRemote);
|
||||
|
||||
@ -958,6 +959,7 @@ void MainWindow::on_actionClearLog_triggered()
|
||||
void MainWindow::applySettings()
|
||||
{
|
||||
QSettings *store = settings.GetStore();
|
||||
QString active_workspace;
|
||||
|
||||
int num_wks = store->beginReadArray("Workspaces");
|
||||
for(int i=0; i<num_wks; ++i)
|
||||
@ -972,7 +974,7 @@ void MainWindow::applySettings()
|
||||
addWorkspaceHistory(wk);
|
||||
|
||||
if(store->contains("Active") && store->value("Active").toBool())
|
||||
setCurrentWorkspace(wk);
|
||||
active_workspace = wk;
|
||||
}
|
||||
store->endArray();
|
||||
|
||||
@ -1027,7 +1029,10 @@ void MainWindow::applySettings()
|
||||
ui->actionViewAsFolders->setChecked(!store->value("ViewAsList").toBool());
|
||||
viewMode = store->value("ViewAsList").toBool()? VIEWMODE_LIST : VIEWMODE_TREE;
|
||||
}
|
||||
//ui->workspaceTreeView->setVisible(viewMode == VIEWMODE_TREE);
|
||||
|
||||
// Set the workspace after loading the settings, since it may trigger a remote info storage
|
||||
if(!active_workspace.isEmpty())
|
||||
setCurrentWorkspace(active_workspace);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -1759,13 +1764,16 @@ void MainWindow::on_workspaceTreeView_doubleClicked(const QModelIndex &index)
|
||||
Q_ASSERT(data.isValid());
|
||||
WorkspaceItem tv = data.value<WorkspaceItem>();
|
||||
|
||||
if(tv.Type!=WorkspaceItem::TYPE_FOLDER && tv.Type!=WorkspaceItem::TYPE_WORKSPACE)
|
||||
return;
|
||||
|
||||
QString target = getCurrentWorkspace() + PATH_SEPARATOR + tv.Value;
|
||||
|
||||
QUrl url = QUrl::fromLocalFile(target);
|
||||
QDesktopServices::openUrl(url);
|
||||
if(tv.Type==WorkspaceItem::TYPE_FOLDER || tv.Type==WorkspaceItem::TYPE_WORKSPACE)
|
||||
{
|
||||
QString target = getCurrentWorkspace() + PATH_SEPARATOR + tv.Value;
|
||||
QUrl url = QUrl::fromLocalFile(target);
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
else if(tv.Type==WorkspaceItem::TYPE_REMOTE)
|
||||
{
|
||||
on_actionEditRemote_triggered();
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -2595,7 +2603,29 @@ void MainWindow::on_actionAddRemote_triggered()
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not store information to keychain."), QMessageBox::Ok );
|
||||
}
|
||||
|
||||
url.setPassword("");
|
||||
url.setUserName("");
|
||||
|
||||
getWorkspace().addRemote(url, name);
|
||||
updateWorkspaceView();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionDeleteRemote_triggered()
|
||||
{
|
||||
QStringList remotes;
|
||||
getSelectionRemotes(remotes);
|
||||
if(remotes.empty())
|
||||
return;
|
||||
|
||||
QUrl url(remotes.first());
|
||||
|
||||
Remote *remote = getWorkspace().findRemote(url);
|
||||
Q_ASSERT(remote);
|
||||
|
||||
if(QMessageBox::Yes != DialogQuery(this, tr("Delete Remote"), tr("Are you sure want to delete the remote '%0' ?").arg(remote->name)))
|
||||
return;
|
||||
|
||||
getWorkspace().removeRemote(url);
|
||||
updateWorkspaceView();
|
||||
}
|
||||
|
@ -130,6 +130,7 @@ private slots:
|
||||
void on_actionEditRemote_triggered();
|
||||
void on_actionSetDefaultRemote_triggered();
|
||||
void on_actionAddRemote_triggered();
|
||||
void on_actionDeleteRemote_triggered();
|
||||
|
||||
private:
|
||||
class MainWinUICallback : public UICallback
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QFileDialog>
|
||||
#include <QEventLoop>
|
||||
#include "ext/qtkeychain/keychain.h"
|
||||
#define KEYCHAIN_ROOT "Fuel-SCM"
|
||||
#include <QCryptographicHash>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
QMessageBox::StandardButton DialogQuery(QWidget *parent, const QString &title, const QString &query, QMessageBox::StandardButtons buttons)
|
||||
@ -444,3 +444,13 @@ bool KeychainDelete(QObject* parent, const QUrl& url)
|
||||
|
||||
return job.error() == QKeychain::NoError;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
QString HashString(const QString& str)
|
||||
{
|
||||
QCryptographicHash hash(QCryptographicHash::Sha1);
|
||||
const QByteArray ba(str.toUtf8());
|
||||
hash.addData(ba.data(), ba.size());
|
||||
QString str_out(hash.result().toHex());
|
||||
return str_out;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ void BuildNameToModelIndex(name_modelindex_map_t &map, const QStandardItemM
|
||||
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);
|
||||
|
||||
|
||||
typedef QMap<QString, QString> QStringMap;
|
||||
|
@ -36,7 +36,9 @@ void Workspace::storeWorkspace(QSettings &store)
|
||||
return;
|
||||
|
||||
store.beginGroup("Remotes");
|
||||
store.beginWriteArray(QDir::toNativeSeparators(workspace));
|
||||
QString workspace_hash = HashString(QDir::toNativeSeparators(workspace));
|
||||
|
||||
store.beginWriteArray(workspace_hash);
|
||||
int index = 0;
|
||||
for(remote_map_t::iterator it=remotes.begin(); it!=remotes.end(); ++it, ++index)
|
||||
{
|
||||
@ -75,13 +77,18 @@ bool Workspace::switchWorkspace(const QString& workspace, QSettings &store)
|
||||
fossil().setCurrentWorkspace(new_workspace);
|
||||
|
||||
// Load Remotes
|
||||
QString workspace_hash = HashString(QDir::toNativeSeparators(new_workspace));
|
||||
|
||||
QString gr = store.group();
|
||||
|
||||
store.beginGroup("Remotes");
|
||||
int num_remotes = store.beginReadArray(QDir::toNativeSeparators(new_workspace));
|
||||
gr = store.group();
|
||||
int num_remotes = store.beginReadArray(workspace_hash);
|
||||
for(int i=0; i<num_remotes; ++i)
|
||||
{
|
||||
store.setArrayIndex(i);
|
||||
|
||||
QString name = store.value("name").toString();
|
||||
QString name = store.value("Name").toString();
|
||||
QUrl url = store.value("Url").toUrl();
|
||||
bool def = store.value("Default", false).toBool();
|
||||
addRemote(url, name);
|
||||
|
@ -1032,6 +1032,11 @@
|
||||
<string>Adds a Remote Url</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDeleteRemote">
|
||||
<property name="text">
|
||||
<string>Delete Remote</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
Loading…
x
Reference in New Issue
Block a user