| ︙ | | |
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
+
|
// RemotesMenu
menuRemotes = new QMenu(this);
menuRemotes->addAction(ui->actionPushRemote);
menuRemotes->addAction(ui->actionPullRemote);
menuRemotes->addAction(separator);
menuRemotes->addAction(ui->actionAddRemote);
menuRemotes->addAction(ui->actionDeleteRemote);
menuRemotes->addAction(ui->actionEditRemote);
menuRemotes->addAction(ui->actionSetDefaultRemote);
// Recent Workspaces
// Locate a sequence of two separator actions in file menu
QList<QAction*> file_actions = ui->menuFile->actions();
QAction *recent_sep=0;
|
| ︙ | | |
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
|
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
|
+
-
+
|
ui->textBrowser->clear();
}
//------------------------------------------------------------------------------
void MainWindow::applySettings()
{
QSettings *store = settings.GetStore();
QString active_workspace;
int num_wks = store->beginReadArray("Workspaces");
for(int i=0; i<num_wks; ++i)
{
store->setArrayIndex(i);
QString wk = store->value("Path").toString();
// Skip invalid workspaces
if(wk.isEmpty() || !QDir(wk).exists())
continue;
addWorkspaceHistory(wk);
if(store->contains("Active") && store->value("Active").toBool())
setCurrentWorkspace(wk);
active_workspace = wk;
}
store->endArray();
store->beginReadArray("FileColumns");
for(int i=0; i<getWorkspace().getFileModel().columnCount(); ++i)
{
store->setArrayIndex(i);
|
| ︙ | | |
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
|
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
|
-
+
+
+
+
|
ui->actionViewIgnored->setChecked(store->value("ViewIgnored").toBool());
if(store->contains("ViewAsList"))
{
ui->actionViewAsList->setChecked(store->value("ViewAsList").toBool());
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);
}
//------------------------------------------------------------------------------
void MainWindow::updateSettings()
{
QSettings *store = settings.GetStore();
|
| ︙ | | |
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
|
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
|
-
+
-
-
-
+
+
-
-
-
+
+
+
+
+
+
+
|
//------------------------------------------------------------------------------
void MainWindow::on_workspaceTreeView_doubleClicked(const QModelIndex &index)
{
QVariant data = index.model()->data(index, ROLE_WORKSPACE_ITEM);
Q_ASSERT(data.isValid());
WorkspaceItem tv = data.value<WorkspaceItem>();
if(tv.Type!=WorkspaceItem::TYPE_FOLDER && tv.Type!=WorkspaceItem::TYPE_WORKSPACE)
if(tv.Type==WorkspaceItem::TYPE_FOLDER || tv.Type==WorkspaceItem::TYPE_WORKSPACE)
return;
QString target = getCurrentWorkspace() + PATH_SEPARATOR + tv.Value;
{
QString target = getCurrentWorkspace() + PATH_SEPARATOR + tv.Value;
QUrl url = QUrl::fromLocalFile(target);
QDesktopServices::openUrl(url);
QUrl url = QUrl::fromLocalFile(target);
QDesktopServices::openUrl(url);
}
else if(tv.Type==WorkspaceItem::TYPE_REMOTE)
{
on_actionEditRemote_triggered();
}
}
//------------------------------------------------------------------------------
void MainWindow::on_actionRenameFolder_triggered()
{
stringset_t paths;
getSelectionPaths(paths);
|
| ︙ | | |
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
|
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
if(!url.isLocalFile())
{
KeychainDelete(this, url);
if(!KeychainSet(this, url))
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();
}
|