annotate libgui/src/files-dock-widget.cc @ 22177:6e9f5408c0db

Save settings in Qt convention, delete all children in destructors (bug #45366) * QUnixTerminalImpl.cpp (QUnixTerminalImpl::~QUnixTerminalImpl): Delete dynamic objects pointed to by m_terminal (TerminalModel), m_kpty (KPty) and m_terminalView (TerminalView). (bug fix) * files-dock-widget.cc: (files_dock_widget::~files_dock_widget): Rename to save_settings. Return if variable 'settings' is not valid object pointer. (files_dock_widget::save_settings): Added. Similar code as destructor was. Call base class octave_dock_widget::save_settings at end of routine. * files-dock-widget.h: (files_dock_widget::~files_dock_widget): Provide empty destructor. (files_dock_widget::save_settings): Added, public slot. * find-files-dialog.cc: (find_files_dialog::~find_files_dialog): Moved most of the code, except the statement deleting the directory iterator, to new routine save_settings. (find_files_dialog::save_settings): Added. Large portion of the code that was in the destructor. Return immediately if variable 'settings' is not valid object pointer. * find-files-dialog.h: (find_files_dialog::save_settings): Added, public slot. * history-dock-widget.cc: (history_dock_widget::~history_dock_widget): Rename to save_settings. Return if variable 'settings' is not valid object pointer. (history_dock_widget::save_settings): Similar code as destructor was. Call base class octave_dock_widget::save_settings at end of routine. * history-dock-widget.h: (history_dock_widget::~history_dock_widget): Provide empty destructor. (history_dock_widget::save_settings): Added, public slot. * main-window.cc (main_window::prepare_to_exit): If find_files_dlg is valid, call the object's save_settings routine. (main_window::construct): Connect appropriate slot of all objects that must save_settings information to the qApp aboutToQuit signal. (Except for find_files_dlg, see above.) At end of this sequence, connect aboutToQuit to the shortcut_manager and resource_manager function that deletes instance. * octave-dock-widget.cc: (octave_dock_widget::~octave_dock_widget): Rename to save_settings. Return if variable 'settings' is not valid object pointer. (octave_dock_widget::save_settings): Similar code as destructor was. * octave-dock-widget.h: (octave_dock_widget::~octave_dock_widget): Provide empty destructor. (octave_dock_widget::save_settings): Added, public slot. * octave-qt-link.cc (octave_qt_link::do_prompt_new_edit_file): Check that 'settings' pointer is valid before using. * resource-manager.cc: Remove "singleton-cleanup.h" header reference. (resource_manager::instance_ok): Do not add cleanup_instance to worker thread's exit cleanup procedure. * resource-manager.h (resource_manager::instance) Change variable to public for connecting. (resource_manager::cleanup_instance) Change to a public slot for connecting to qApp aboutToQuit signal. (resource_manager::resource_manager): Remove an unused variation of the constructor. (resource_manager::operator =) Removed. * settings-dialog.cc: Add QMessageBox to header file list. (settings_dialog::settings_dialog): If QSettings pointer settings is not valid return immediately. (settings_dialog::show_tab): Condition setting the current index on pointer 'settings' being valid. (settings_dialog::write_changed_settings): Remove FIXME comment. If the settings are not valid, display a dialog about missing file and return. * shortcut-manager.cc: Remove "singleton-cleanup.h" header reference. (shortcut_manager::instance_ok): Do not add cleanup_instance to worker thread's exit cleanup procedure. * shortcut-manager.h (shortcut_manager::instance) Change variable to public for connecting. (shortcut_manager::cleanup_instance) Change to a public slot for connecting to qApp aboutToQuit signal. (shortcut_manager::shortcut_manager): Remove an unused variation of the constructor. (shortcut_manager::operator =) Removed. * terminal-dock-widget.cc (terminal_dock_widget::~terminal_dock_widget): Added. Delete QTerminal terminal. (bug fix) * terminal-dock-widget.h (terminal_dock_widget::~terminal_dock_widget): Added. * workspace-view.cc: (workspace_view::workspace_view): Place code hunk using QSettings pointer 'settings' within a conditional block. (workspace_view::~workspace_view): Rename to save_settings. Return if variable 'settings' is not valid object pointer. (workspace_view::save_settings): Almost same code as destructor was. Call base class octave_dock_widget::save_settings at end of routine. * workspace-view.h: (workspace_view::~workspace_view): Provide empty destructor. (workspace_view::save_settings): Added, public slot.
author Daniel J Sebald <daniel.sebald@ieee.org>
date Mon, 25 Jul 2016 17:44:02 -0400
parents 278fc29b69ca
children bac0d6f07a3e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
1 /*
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
2
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19691
diff changeset
3 Copyright (C) 2013-2015 John P. Swensen
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19691
diff changeset
4 Copyright (C) 2011-2015 Jacob Dawid
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
5
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
6 This file is part of Octave.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
7
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
9 under the terms of the GNU General Public License as published by the
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
11 option) any later version.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
12
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
16 for more details.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
17
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
18 You should have received a copy of the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
19 along with Octave; see the file COPYING. If not, see
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
20 <http://www.gnu.org/licenses/>.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
21
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
22 */
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
23
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21662
diff changeset
24 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21203
diff changeset
25 # include "config.h"
15286
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15204
diff changeset
26 #endif
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15204
diff changeset
27
14707
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
28 #include "resource-manager.h"
16460
4d4e7c6f839d use consistent names for dock-widget files
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
29 #include "files-dock-widget.h"
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
30
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
31 #include <QApplication>
16622
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
32 #include <QClipboard>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
33 #include <QFileInfo>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
34 #include <QCompleter>
13531
bb3676025b36 User can set a custom file editor instead of the built-in one.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13522
diff changeset
35 #include <QProcess>
13539
a4b5cad8f7c6 Added command line parser class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
36 #include <QDebug>
15461
1e64aff609c3 save/restore column state and sorting (column and order) in files-widget
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
37 #include <QHeaderView>
16498
605d7f0ee0d8 Added Filesdockwidget recently viewed directory pulldownlist
John Donoghue <john.donoghue@ieee.org>
parents: 16487
diff changeset
38 #include <QLineEdit>
605d7f0ee0d8 Added Filesdockwidget recently viewed directory pulldownlist
John Donoghue <john.donoghue@ieee.org>
parents: 16487
diff changeset
39 #include <QSizePolicy>
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
40 #include <QMenu>
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
41 #include <QInputDialog>
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
42 #include <QMessageBox>
16542
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
43 #include <QToolButton>
16594
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
44 #include <QUrl>
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
45 #include <QDesktopServices>
16613
99a57611d58a add menu for searching the next directory shown by the file browser
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
46 #include <QFileDialog>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
47
16555
04fb96f4bea1 allow double-click in file browser to load data files
John W. Eaton <jwe@octave.org>
parents: 16542
diff changeset
48 #include "load-save.h"
20017
4b7b7ac7af2c use get_home_directory instead of getenv ("HOME") (bug #44694)
John W. Eaton <jwe@octave.org>
parents: 20000
diff changeset
49 #include "oct-env.h"
16555
04fb96f4bea1 allow double-click in file browser to load data files
John W. Eaton <jwe@octave.org>
parents: 16542
diff changeset
50
16622
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
51 class FileTreeViewer : public QTreeView
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
52 {
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
53 public:
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
54
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
55 FileTreeViewer (QWidget *p) : QTreeView (p) { }
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
56
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
57 void mousePressEvent (QMouseEvent *e)
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
58 {
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
59 if (e->button () != Qt::RightButton)
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
60 QTreeView::mousePressEvent (e);
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
61 }
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
62 };
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
63
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
64 files_dock_widget::files_dock_widget (QWidget *p)
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents: 15552
diff changeset
65 : octave_dock_widget (p)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
66 {
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
67 setObjectName ("FilesDockWidget");
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
68 setWindowIcon (QIcon (":/actions/icons/logo.png"));
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16762
diff changeset
69 set_title (tr ("File Browser"));
20763
28eae9b7aa30 Tweak GUI ToolTip strings for consistency.
Armin Müller <arm.in@web.de>
parents: 20017
diff changeset
70 setToolTip (tr ("Browse your files"));
16450
3207f1d62e74 improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
71
20642
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
72 _sig_mapper = 0;
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
73
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
74 _columns_shown = QStringList ();
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
75 _columns_shown.append (tr ("File size"));
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
76 _columns_shown.append (tr ("File type"));
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
77 _columns_shown.append (tr ("Date modified"));
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
78 _columns_shown.append (tr ("Show hidden"));
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
79 _columns_shown.append (tr ("Alternating row colors"));
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
80
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
81 _columns_shown_keys = QStringList ();
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
82 _columns_shown_keys.append (tr ("filesdockwidget/showFileSize"));
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
83 _columns_shown_keys.append (tr ("filesdockwidget/showFileType"));
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
84 _columns_shown_keys.append (tr ("filesdockwidget/showLastModified"));
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
85 _columns_shown_keys.append (tr ("filesdockwidget/showHiddenFiles"));
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
86 _columns_shown_keys.append (tr ("filesdockwidget/useAlternatingRowColors"));
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
87
16450
3207f1d62e74 improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
88 QWidget *container = new QWidget (this);
3207f1d62e74 improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
89
3207f1d62e74 improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
90 setWidget (container);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
91
16455
38ed6bdd1f7f move signal/slot connections from main window to sub window where possible
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
92 connect (this, SIGNAL (open_file (const QString&)),
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16762
diff changeset
93 main_win (), SLOT (open_file (const QString&)));
16455
38ed6bdd1f7f move signal/slot connections from main window to sub window where possible
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
94
38ed6bdd1f7f move signal/slot connections from main window to sub window where possible
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
95 connect (this, SIGNAL (displayed_directory_changed (const QString&)),
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16762
diff changeset
96 main_win (), SLOT (set_current_working_directory (const QString&)));
16455
38ed6bdd1f7f move signal/slot connections from main window to sub window where possible
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
97
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
98 // Create a toolbar
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16515
diff changeset
99 _navigation_tool_bar = new QToolBar ("", container);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16515
diff changeset
100 _navigation_tool_bar->setAllowedAreas (Qt::TopToolBarArea);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16515
diff changeset
101 _navigation_tool_bar->setMovable (false);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
102
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16515
diff changeset
103 _current_directory = new QComboBox (_navigation_tool_bar);
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
104 _current_directory->setToolTip (tr ("Enter the path or filename"));
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
105 _current_directory->setEditable (true);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
106 _current_directory->setMaxCount (MaxMRUDirs);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
107 _current_directory->setInsertPolicy (QComboBox::NoInsert);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
108 _current_directory->setSizeAdjustPolicy (
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
109 QComboBox::AdjustToMinimumContentsLengthWithIcon);
19846
72fe9df87fe8 improve scalability of gui objects (as discussed in bug #41938)
Torsten <ttl@justmail.de>
parents: 19697
diff changeset
110 QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
111 _current_directory->setSizePolicy (sizePol);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
112
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
113 QAction *directory_up_action = new QAction (resource_manager::icon ("go-up"),
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16515
diff changeset
114 "", _navigation_tool_bar);
19902
0019ad8590f3 use unique tool-tip for both directory up actions
Torsten <ttl@justmail.de>
parents: 19899
diff changeset
115 directory_up_action->setToolTip (tr ("One directory up"));
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
116
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
117 _sync_browser_directory_action
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
118 = new QAction (resource_manager::icon ("go-first"),
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 18251
diff changeset
119 tr ("Show Octave directory"), _navigation_tool_bar);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
120 _sync_browser_directory_action->setToolTip (
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 18251
diff changeset
121 tr ("Go to current Octave directory"));
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
122 _sync_browser_directory_action->setEnabled ("false");
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
123
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
124 _sync_octave_directory_action
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
125 = new QAction (resource_manager::icon ("go-last"),
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 18251
diff changeset
126 tr ("Set Octave directory"), _navigation_tool_bar);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
127 _sync_octave_directory_action->setToolTip (
20000
e251b75fab55 Fix two typos in GUI strings (bug #44681).
Rik <rik@octave.org>
parents: 19902
diff changeset
128 tr ("Set Octave directory to current browser directory"));
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
129 _sync_octave_directory_action->setEnabled ("false");
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
130
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
131 QToolButton * popdown_button = new QToolButton ();
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
132 popdown_button->setToolTip (tr ("Actions on current directory"));
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
133 QMenu * popdown_menu = new QMenu ();
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
134 popdown_menu->addAction (resource_manager::icon ("user-home"),
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 18251
diff changeset
135 tr ("Show Home Directory"),
16762
42555422e326 Add Show home directory to files window popdown.
John Donoghue <john.donoghue@ieee.org>
parents: 16709
diff changeset
136 this, SLOT (popdownmenu_home (bool)));
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
137 popdown_menu->addAction (_sync_browser_directory_action);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
138 popdown_menu->addAction (_sync_octave_directory_action);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
139 popdown_button->setMenu (popdown_menu);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
140 popdown_button->setPopupMode (QToolButton::InstantPopup);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
141 popdown_button->setDefaultAction (new QAction (
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
142 resource_manager::icon ("applications-system"), "",
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
143 _navigation_tool_bar));
16542
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
144
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
145 popdown_menu->addSeparator ();
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
146 popdown_menu->addAction (resource_manager::icon ("folder"),
18345
dfc6ef6ac455 some text improvements in the gui (#bug 41201)
Torsten <ttl@justmail.de>
parents: 18310
diff changeset
147 tr ("Set Browser Directory..."),
16613
99a57611d58a add menu for searching the next directory shown by the file browser
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
148 this, SLOT (popdownmenu_search_dir (bool)));
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
149 popdown_menu->addSeparator ();
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
150 popdown_menu->addAction (resource_manager::icon ("edit-find"),
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 18251
diff changeset
151 tr ("Find Files..."),
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 18251
diff changeset
152 this, SLOT (popdownmenu_findfiles (bool)));
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
153 popdown_menu->addSeparator ();
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
154 popdown_menu->addAction (resource_manager::icon ("document-new"),
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 18251
diff changeset
155 tr ("New File..."),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
156 this, SLOT (popdownmenu_newfile (bool)));
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
157 popdown_menu->addAction (resource_manager::icon ("folder-new"),
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 18251
diff changeset
158 tr ("New Directory..."),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
159 this, SLOT (popdownmenu_newdir (bool)));
16542
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
160
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16515
diff changeset
161 _navigation_tool_bar->addWidget (_current_directory);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16515
diff changeset
162 _navigation_tool_bar->addAction (directory_up_action);
16542
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
163 _navigation_tool_bar->addWidget (popdown_button);
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
164
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
165 connect (directory_up_action, SIGNAL (triggered ()), this,
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16413
diff changeset
166 SLOT (change_directory_up ()));
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
167 connect (_sync_octave_directory_action, SIGNAL (triggered ()), this,
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
168 SLOT (do_sync_octave_directory ()));
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
169 connect (_sync_browser_directory_action, SIGNAL (triggered ()), this,
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
170 SLOT (do_sync_browser_directory ()));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
171
17970
f6e1be4ad923 Add functionality for showing/hiding hidden files in the file browser (bug #40636).
John Swensen <jpswensen@gmail.com>
parents: 17960
diff changeset
172 QSettings *settings = resource_manager::get_settings ();
f6e1be4ad923 Add functionality for showing/hiding hidden files in the file browser (bug #40636).
John Swensen <jpswensen@gmail.com>
parents: 17960
diff changeset
173 // FIXME: what should happen if settings is 0?
f6e1be4ad923 Add functionality for showing/hiding hidden files in the file browser (bug #40636).
John Swensen <jpswensen@gmail.com>
parents: 17960
diff changeset
174
18310
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
175 // Create the QFileSystemModel starting in the desired directory
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
176 QDir startup_dir; // take current dir
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
177
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
178 if (settings->value ("filesdockwidget/restore_last_dir",false).toBool ())
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
179 {
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
180 // restore last dir from previous session
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
181 QStringList last_dirs
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
182 = settings->value ("filesdockwidget/mru_dir_list").toStringList ();
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
183 if (last_dirs.length () > 0)
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
184 startup_dir = QDir (last_dirs.at (0)); // last dir in previous session
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
185 }
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
186 else if (! settings->value ("filesdockwidget/startup_dir").toString ().isEmpty ())
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
187 {
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
188 // do not restore but there is a startup dir configured
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
189 startup_dir = QDir (settings->value ("filesdockwidget/startup_dir").toString ());
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
190 }
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
191
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
192 if (! startup_dir.exists ())
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
193 {
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
194 // the configured startup dir does not exist, take actual one
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
195 startup_dir = QDir ();
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
196 }
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
197
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
198 _file_system_model = new QFileSystemModel (this);
16510
e22604d4bf85 * files-dock-widget.cc(constructor): initial dir is where octave was started
Torsten <ttl@justmail.de>
parents: 16509
diff changeset
199 QModelIndex rootPathIndex = _file_system_model->setRootPath (
18310
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18283
diff changeset
200 startup_dir.absolutePath ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
201
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
202 // Attach the model to the QTreeView and set the root index
16622
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
203 _file_tree_view = new FileTreeViewer (container);
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
204 _file_tree_view->setSelectionMode (QAbstractItemView::ExtendedSelection);
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
205 _file_tree_view->setModel (_file_system_model);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
206 _file_tree_view->setRootIndex (rootPathIndex);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
207 _file_tree_view->setSortingEnabled (true);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
208 _file_tree_view->setAlternatingRowColors (true);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
209 _file_tree_view->setAnimated (true);
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19847
diff changeset
210 _file_tree_view->setToolTip (
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19847
diff changeset
211 tr ("Activate to open in editor, right click for alternatives"));
13549
807e5e9b7591 Added lots of status tips.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13539
diff changeset
212
15461
1e64aff609c3 save/restore column state and sorting (column and order) in files-widget
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
213 // get sort column and order as well as cloumn state (order and width)
17970
f6e1be4ad923 Add functionality for showing/hiding hidden files in the file browser (bug #40636).
John Swensen <jpswensen@gmail.com>
parents: 17960
diff changeset
214
15461
1e64aff609c3 save/restore column state and sorting (column and order) in files-widget
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
215 _file_tree_view->sortByColumn (
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
216 settings->value ("filesdockwidget/sort_files_by_column",0).toInt (),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
217 static_cast<Qt::SortOrder>
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
218 (settings->value ("filesdockwidget/sort_files_by_order",
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
219 Qt::AscendingOrder).toUInt ())
15461
1e64aff609c3 save/restore column state and sorting (column and order) in files-widget
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
220 );
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
221 _file_tree_view->header ()->restoreState (
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
222 settings->value ("filesdockwidget/column_state").toByteArray ());
16498
605d7f0ee0d8 Added Filesdockwidget recently viewed directory pulldownlist
John Donoghue <john.donoghue@ieee.org>
parents: 16487
diff changeset
223
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
224 QStringList mru_dirs =
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
225 settings->value ("filesdockwidget/mru_dir_list").toStringList ();
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
226 _current_directory->addItems (mru_dirs);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
227
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
228 _current_directory->setEditText (
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
229 _file_system_model->fileInfo (rootPathIndex). absoluteFilePath ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
230
19691
480f0fc56bbf Allow return/double-click to activate dock file-browser open (bug #44216)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 18850
diff changeset
231 connect (_file_tree_view, SIGNAL (activated (const QModelIndex &)),
16450
3207f1d62e74 improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
232 this, SLOT (item_double_clicked (const QModelIndex &)));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
233
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
234 // add context menu to tree_view
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
235 _file_tree_view->setContextMenuPolicy (Qt::CustomContextMenu);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
236 connect (_file_tree_view,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
237 SIGNAL (customContextMenuRequested (const QPoint &)),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
238 this, SLOT (contextmenu_requested (const QPoint &)));
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
239
17960
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
240 _file_tree_view->header()->setContextMenuPolicy (Qt::CustomContextMenu);
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
241 connect (_file_tree_view->header(),
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
242 SIGNAL (customContextMenuRequested (const QPoint &)),
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
243 this, SLOT (headercontextmenu_requested (const QPoint &)));
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
244
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
245 // Layout the widgets vertically with the toolbar on top
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
246 QVBoxLayout *vbox_layout = new QVBoxLayout ();
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
247 vbox_layout->setSpacing (0);
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16515
diff changeset
248 vbox_layout->addWidget (_navigation_tool_bar);
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
249 vbox_layout->addWidget (_file_tree_view);
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
250 vbox_layout->setMargin (1);
16450
3207f1d62e74 improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
251
3207f1d62e74 improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
252 container->setLayout (vbox_layout);
3207f1d62e74 improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
253
21578
683a1beee538 maint: Use "FIXME:" for all code blocks needing further attention.
Rik <rik@octave.org>
parents: 21568
diff changeset
254 // FIXME: Add right-click contextual menus for copying, pasting,
683a1beee538 maint: Use "FIXME:" for all code blocks needing further attention.
Rik <rik@octave.org>
parents: 21568
diff changeset
255 // deleting files (and others).
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
256
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
257 connect (_current_directory->lineEdit (), SIGNAL (returnPressed ()),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
258 this, SLOT (accept_directory_line_edit ()));
16498
605d7f0ee0d8 Added Filesdockwidget recently viewed directory pulldownlist
John Donoghue <john.donoghue@ieee.org>
parents: 16487
diff changeset
259
605d7f0ee0d8 Added Filesdockwidget recently viewed directory pulldownlist
John Donoghue <john.donoghue@ieee.org>
parents: 16487
diff changeset
260 connect (_current_directory, SIGNAL (activated (const QString &)),
605d7f0ee0d8 Added Filesdockwidget recently viewed directory pulldownlist
John Donoghue <john.donoghue@ieee.org>
parents: 16487
diff changeset
261 this, SLOT (set_current_directory (const QString &)));
14803
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
262
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16622
diff changeset
263 connect (this, SIGNAL (run_file_signal (const QFileInfo&)),
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16762
diff changeset
264 main_win (), SLOT (run_file_in_terminal (const QFileInfo&)));
16506
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
265
16450
3207f1d62e74 improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
266 QCompleter *completer = new QCompleter (_file_system_model, this);
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
267 _current_directory->setCompleter (completer);
13577
e440b3f32f02 Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13549
diff changeset
268
14812
9d9eb9bac65e Improved menu structure of file, edit and window menu. Removed ambiguous shortcuts, improved focus handling for operating the GUI with the keyboard. Added new shortcuts to focus subwindows directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14803
diff changeset
269 setFocusProxy (_current_directory);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
270
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
271 _sync_octave_dir = true; // default, overwirtten with notice_settings ()
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
272 _octave_dir = "";
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
273 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
274
22177
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 22022
diff changeset
275 void
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 22022
diff changeset
276 files_dock_widget::save_settings (void)
15461
1e64aff609c3 save/restore column state and sorting (column and order) in files-widget
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
277 {
1e64aff609c3 save/restore column state and sorting (column and order) in files-widget
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
278 QSettings *settings = resource_manager::get_settings ();
22177
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 22022
diff changeset
279
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 22022
diff changeset
280 if (! settings)
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 22022
diff changeset
281 return;
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 22022
diff changeset
282
15461
1e64aff609c3 save/restore column state and sorting (column and order) in files-widget
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
283 int sort_column = _file_tree_view->header ()->sortIndicatorSection ();
1e64aff609c3 save/restore column state and sorting (column and order) in files-widget
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
284 Qt::SortOrder sort_order = _file_tree_view->header ()->sortIndicatorOrder ();
1e64aff609c3 save/restore column state and sorting (column and order) in files-widget
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
285 settings->setValue ("filesdockwidget/sort_files_by_column", sort_column);
1e64aff609c3 save/restore column state and sorting (column and order) in files-widget
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
286 settings->setValue ("filesdockwidget/sort_files_by_order", sort_order);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
287 settings->setValue ("filesdockwidget/column_state",
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
288 _file_tree_view->header ()->saveState ());
16498
605d7f0ee0d8 Added Filesdockwidget recently viewed directory pulldownlist
John Donoghue <john.donoghue@ieee.org>
parents: 16487
diff changeset
289
605d7f0ee0d8 Added Filesdockwidget recently viewed directory pulldownlist
John Donoghue <john.donoghue@ieee.org>
parents: 16487
diff changeset
290 QStringList dirs;
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
291 for (int i=0; i< _current_directory->count (); i++)
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
292 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
293 dirs.append (_current_directory->itemText (i));
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
294 }
16498
605d7f0ee0d8 Added Filesdockwidget recently viewed directory pulldownlist
John Donoghue <john.donoghue@ieee.org>
parents: 16487
diff changeset
295 settings->setValue ("filesdockwidget/mru_dir_list", dirs);
605d7f0ee0d8 Added Filesdockwidget recently viewed directory pulldownlist
John Donoghue <john.donoghue@ieee.org>
parents: 16487
diff changeset
296
16175
6f83158c714c gui: make sure settings are really written into the settings file
Torsten <ttl@justmail.de>
parents: 16057
diff changeset
297 settings->sync ();
20642
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
298
22177
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 22022
diff changeset
299 octave_dock_widget::save_settings ();
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 22022
diff changeset
300
20642
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
301 if (_sig_mapper)
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
302 delete _sig_mapper;
15461
1e64aff609c3 save/restore column state and sorting (column and order) in files-widget
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
303 }
1e64aff609c3 save/restore column state and sorting (column and order) in files-widget
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
304
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
305 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16413
diff changeset
306 files_dock_widget::item_double_clicked (const QModelIndex& index)
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
307 {
13531
bb3676025b36 User can set a custom file editor instead of the built-in one.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13522
diff changeset
308 // Retrieve the file info associated with the model index.
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
309 QFileInfo fileInfo = _file_system_model->fileInfo (index);
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16413
diff changeset
310 set_current_directory (fileInfo.absoluteFilePath ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
311 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
312
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
313 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16413
diff changeset
314 files_dock_widget::set_current_directory (const QString& dir)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
315 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16413
diff changeset
316 display_directory (dir);
14803
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
317 }
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
318
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
319 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16413
diff changeset
320 files_dock_widget::accept_directory_line_edit (void)
14803
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
321 {
16498
605d7f0ee0d8 Added Filesdockwidget recently viewed directory pulldownlist
John Donoghue <john.donoghue@ieee.org>
parents: 16487
diff changeset
322 display_directory (_current_directory->currentText ());
14803
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
323 }
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
324
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
325 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16413
diff changeset
326 files_dock_widget::change_directory_up (void)
14803
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
327 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
328 QDir dir
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
329 = QDir (_file_system_model->filePath (_file_tree_view->rootIndex ()));
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
330
14803
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
331 dir.cdUp ();
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
332 display_directory (dir.absolutePath ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
333 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
334
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
335 void
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
336 files_dock_widget::do_sync_octave_directory (void)
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
337 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
338 QDir dir
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
339 = QDir (_file_system_model->filePath (_file_tree_view->rootIndex ()));
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
340
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
341 emit displayed_directory_changed (dir.absolutePath ());
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
342 }
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
343
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
344 void
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
345 files_dock_widget::do_sync_browser_directory (void)
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
346 {
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
347 display_directory (_octave_dir,false); // false: no sync of octave dir
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
348 }
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
349
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
350 void
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
351 files_dock_widget::update_octave_directory (const QString& dir)
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
352 {
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
353 _octave_dir = dir;
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
354 if (_sync_octave_dir)
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
355 display_directory (_octave_dir,false); // false: no sync of octave dir
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
356 }
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
357
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
358 void
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
359 files_dock_widget::display_directory (const QString& dir, bool set_octave_dir)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
360 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16413
diff changeset
361 QFileInfo fileInfo (dir);
14803
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
362 if (fileInfo.exists ())
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
363 {
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
364 if (fileInfo.isDir ())
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
365 {
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
366 _file_tree_view->setRootIndex (_file_system_model->
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15300
diff changeset
367 index (fileInfo.absoluteFilePath ()));
14803
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
368 _file_system_model->setRootPath (fileInfo.absoluteFilePath ());
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
369 if (_sync_octave_dir && set_octave_dir)
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
370 process_set_current_dir (fileInfo.absoluteFilePath ());
16498
605d7f0ee0d8 Added Filesdockwidget recently viewed directory pulldownlist
John Donoghue <john.donoghue@ieee.org>
parents: 16487
diff changeset
371
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
372 // see if its in the list, and if it is,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
373 // remove it and then, put at top of the list
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
374 int index
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
375 = _current_directory->findText (fileInfo.absoluteFilePath ());
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
376 if (index != -1)
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
377 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
378 _current_directory->removeItem (index);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
379 }
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
380 _current_directory->insertItem (0, fileInfo.absoluteFilePath ());
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
381 _current_directory->setCurrentIndex (0);
14803
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
382 }
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
383 else
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
384 {
16555
04fb96f4bea1 allow double-click in file browser to load data files
John W. Eaton <jwe@octave.org>
parents: 16542
diff changeset
385 QString abs_fname = fileInfo.absoluteFilePath ();
04fb96f4bea1 allow double-click in file browser to load data files
John W. Eaton <jwe@octave.org>
parents: 16542
diff changeset
386
20706
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
387 QString suffix = fileInfo.suffix ().toLower ();
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
388 QSettings *settings = resource_manager::get_settings ();
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
389 QString ext = settings->value ("filesdockwidget/txt_file_extensions",
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
390 "m;c;cc;cpp;h;txt").toString ();
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
391 QStringList extensions = ext.split(";", QString::SkipEmptyParts);
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
392
16555
04fb96f4bea1 allow double-click in file browser to load data files
John W. Eaton <jwe@octave.org>
parents: 16542
diff changeset
393 if (QFile::exists (abs_fname))
04fb96f4bea1 allow double-click in file browser to load data files
John W. Eaton <jwe@octave.org>
parents: 16542
diff changeset
394 {
04fb96f4bea1 allow double-click in file browser to load data files
John W. Eaton <jwe@octave.org>
parents: 16542
diff changeset
395 if (is_octave_data_file (abs_fname.toStdString ()))
04fb96f4bea1 allow double-click in file browser to load data files
John W. Eaton <jwe@octave.org>
parents: 16542
diff changeset
396 emit load_file_signal (abs_fname);
20706
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
397 else if (extensions.contains (suffix))
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
398 emit open_file (fileInfo.absoluteFilePath ());
16555
04fb96f4bea1 allow double-click in file browser to load data files
John W. Eaton <jwe@octave.org>
parents: 16542
diff changeset
399 else
20706
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
400 open_item_in_app (_file_tree_view->selectionModel ()
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
401 ->currentIndex ());
16555
04fb96f4bea1 allow double-click in file browser to load data files
John W. Eaton <jwe@octave.org>
parents: 16542
diff changeset
402 }
14803
625be3eb27c5 Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14728
diff changeset
403 }
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
404 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
405 }
13536
869c62c15e95 Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13535
diff changeset
406
16594
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
407 void
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
408 files_dock_widget::open_item_in_app (const QModelIndex& index)
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
409 {
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
410 // Retrieve the file info associated with the model index.
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
411 QFileInfo fileInfo = _file_system_model->fileInfo (index);
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
412
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
413 QString file = fileInfo.absoluteFilePath ();
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
414
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
415 QDesktopServices::openUrl (QUrl::fromLocalFile (file));
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
416 }
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
417
20642
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
418 void files_dock_widget::toggle_header (int col)
17960
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
419 {
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
420 QSettings *settings = resource_manager::get_settings ();
20642
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
421
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
422 QString key = _columns_shown_keys.at (col);
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
423 bool shown = settings->value (key,false).toBool ();
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
424 settings->setValue (key, ! shown);
17960
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
425 settings->sync ();
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
426
20642
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
427 switch (col)
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
428 {
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
429 case 0:
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
430 case 1:
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
431 case 2:
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
432 // toggle column visibility
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
433 _file_tree_view->setColumnHidden (col + 1, shown);
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
434 break;
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
435 case 3:
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
436 case 4:
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
437 // other actions depending on new settings
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
438 notice_settings (settings);
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
439 break;
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
440 }
17960
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
441 }
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
442
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
443 void
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
444 files_dock_widget::headercontextmenu_requested (const QPoint& mpos)
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
445 {
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
446 QMenu menu (this);
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
447
20642
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
448 if (_sig_mapper)
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
449 delete _sig_mapper;
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
450 _sig_mapper = new QSignalMapper (this);
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
451
17960
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
452 QSettings *settings = resource_manager::get_settings ();
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
453
20642
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
454 for (int i = 0; i < _columns_shown.size (); i++)
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
455 {
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
456 QAction *action = menu.addAction (_columns_shown.at (i),
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
457 _sig_mapper, SLOT (map ()));
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
458 _sig_mapper->setMapping(action, i);
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
459 action->setCheckable (true);
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
460 action->setChecked (
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
461 settings->value (_columns_shown_keys.at (i),true).toBool ());
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
462 }
17960
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
463
20642
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
464 connect (_sig_mapper, SIGNAL (mapped (int)), this, SLOT (toggle_header (int)));
17960
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
465
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
466 menu.exec (_file_tree_view->mapToGlobal (mpos));
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
467 }
225c7be94c5f Added a context menu changing the visible columns in the file browser
John Swensen <jpswensen@gmail.com>
parents: 17935
diff changeset
468
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
469 void
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
470 files_dock_widget::contextmenu_requested (const QPoint& mpos)
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
471 {
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
472
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
473 QMenu menu (this);
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
474
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
475 QModelIndex index = _file_tree_view->indexAt (mpos);
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
476
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
477 if (index.isValid ())
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
478 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
479 QFileInfo info = _file_system_model->fileInfo (index);
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
480
18387
f1312db94896 apply the context menu of the file browser to the correct item (bug #41430)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
481 QItemSelectionModel *m = _file_tree_view->selectionModel ();
f1312db94896 apply the context menu of the file browser to the correct item (bug #41430)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
482 QModelIndexList sel = m->selectedRows ();
f1312db94896 apply the context menu of the file browser to the correct item (bug #41430)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
483
f1312db94896 apply the context menu of the file browser to the correct item (bug #41430)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
484 // check if item at mouse position is seleccted
f1312db94896 apply the context menu of the file browser to the correct item (bug #41430)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
485 if (! sel.contains (index))
f1312db94896 apply the context menu of the file browser to the correct item (bug #41430)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
486 { // is not selected -> clear actual selection and select this item
f1312db94896 apply the context menu of the file browser to the correct item (bug #41430)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
487 m->setCurrentIndex(index,
f1312db94896 apply the context menu of the file browser to the correct item (bug #41430)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
488 QItemSelectionModel::Clear | QItemSelectionModel::Select |
f1312db94896 apply the context menu of the file browser to the correct item (bug #41430)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
489 QItemSelectionModel::Rows);
f1312db94896 apply the context menu of the file browser to the correct item (bug #41430)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
490 }
f1312db94896 apply the context menu of the file browser to the correct item (bug #41430)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
491
f1312db94896 apply the context menu of the file browser to the correct item (bug #41430)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
492 // construct the context menu depending on item
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
493 menu.addAction (resource_manager::icon ("document-open"), tr ("Open"),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
494 this, SLOT (contextmenu_open (bool)));
16594
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
495
20706
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
496 if (info.isDir ())
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
497 {
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
498 menu.addAction (tr ("Open in System File Explorer"),
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
499 this, SLOT (contextmenu_open_in_app (bool)));
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
500 }
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
501
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
502 if (info.isFile ())
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
503 menu.addAction (tr ("Open in Text Editor"),
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
504 this, SLOT (contextmenu_open_in_editor (bool)));
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
505
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
506 menu.addAction (tr ("Copy Selection to Clipboard"),
16622
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
507 this, SLOT (contextmenu_copy_selection (bool)));
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
508
16515
87b78e75a2b9 gui: undo disabling menu entries in context menu of file browser
Torsten <ttl@justmail.de>
parents: 16510
diff changeset
509 if (info.isFile () && info.suffix () == "m")
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
510 menu.addAction (resource_manager::icon ("media-playback-start"),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
511 tr ("Run"), this, SLOT (contextmenu_run (bool)));
16594
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
512
16515
87b78e75a2b9 gui: undo disabling menu entries in context menu of file browser
Torsten <ttl@justmail.de>
parents: 16510
diff changeset
513 if (info.isFile ())
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
514 menu.addAction (tr ("Load Data"), this, SLOT (contextmenu_load (bool)));
16507
8cb12cf9ca32 gui: add icons to the context menu of the the file browser
Torsten <ttl@justmail.de>
parents: 16506
diff changeset
515
16509
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
516 if (info.isDir ())
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
517 {
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
518 menu.addSeparator ();
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
519 menu.addAction (resource_manager::icon ("go-first"),
16515
87b78e75a2b9 gui: undo disabling menu entries in context menu of file browser
Torsten <ttl@justmail.de>
parents: 16510
diff changeset
520 tr ("Set Current Directory"),
16509
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
521 this, SLOT (contextmenu_setcurrentdir (bool)));
16699
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
522 menu.addSeparator ();
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
523 menu.addAction (resource_manager::icon ("edit-find"),
18407
61d9ef05b06b consistently use '...' without preceding space in GUI messaages
John W. Eaton <jwe@octave.org>
parents: 18389
diff changeset
524 tr ("Find Files..."), this,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
525 SLOT (contextmenu_findfiles (bool)));
16509
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
526 }
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
527
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
528 menu.addSeparator ();
18381
5936afdc75e1 Add ellipses to file dock context menu items which open windows.
Rik <rik@octave.org>
parents: 18345
diff changeset
529 menu.addAction (tr ("Rename..."), this, SLOT (contextmenu_rename (bool)));
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
530 menu.addAction (resource_manager::icon ("edit-delete"),
18381
5936afdc75e1 Add ellipses to file dock context menu items which open windows.
Rik <rik@octave.org>
parents: 18345
diff changeset
531 tr ("Delete..."), this, SLOT (contextmenu_delete (bool)));
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
532
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
533 if (info.isDir ())
16515
87b78e75a2b9 gui: undo disabling menu entries in context menu of file browser
Torsten <ttl@justmail.de>
parents: 16510
diff changeset
534 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
535 menu.addSeparator ();
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
536 menu.addAction (resource_manager::icon ("document-new"),
18381
5936afdc75e1 Add ellipses to file dock context menu items which open windows.
Rik <rik@octave.org>
parents: 18345
diff changeset
537 tr ("New File..."),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
538 this, SLOT (contextmenu_newfile (bool)));
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19861
diff changeset
539 menu.addAction (resource_manager::icon ("folder-new"),
18381
5936afdc75e1 Add ellipses to file dock context menu items which open windows.
Rik <rik@octave.org>
parents: 18345
diff changeset
540 tr ("New Directory..."),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
541 this, SLOT (contextmenu_newdir (bool)));
16515
87b78e75a2b9 gui: undo disabling menu entries in context menu of file browser
Torsten <ttl@justmail.de>
parents: 16510
diff changeset
542 }
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
543
18387
f1312db94896 apply the context menu of the file browser to the correct item (bug #41430)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
544 // show the menu
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
545 menu.exec (_file_tree_view->mapToGlobal (mpos));
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
546
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
547 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
548 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
549
16506
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
550 void
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
551 files_dock_widget::contextmenu_open (bool)
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
552 {
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
553
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
554 QItemSelectionModel *m = _file_tree_view->selectionModel ();
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
555 QModelIndexList rows = m->selectedRows ();
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
556
18678
6113e0c6920b maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents: 18555
diff changeset
557 for (QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++)
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
558 {
18388
226285bce729 context menu open in the file browser really opens the file
Torsten <ttl@justmail.de>
parents: 18387
diff changeset
559 QFileInfo file = _file_system_model->fileInfo (*it);
226285bce729 context menu open in the file browser really opens the file
Torsten <ttl@justmail.de>
parents: 18387
diff changeset
560 if (file.exists ())
20706
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
561 display_directory (file.absoluteFilePath ());
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
562 }
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
563 }
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
564
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
565 void
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
566 files_dock_widget::contextmenu_open_in_editor (bool)
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
567 {
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
568
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
569 QItemSelectionModel *m = _file_tree_view->selectionModel ();
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
570 QModelIndexList rows = m->selectedRows ();
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
571
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
572 for (QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++)
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
573 {
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
574 QFileInfo file = _file_system_model->fileInfo (*it);
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
575 if (file.exists ())
fec7cc73507b Make the file browser open files more consistently (bug #45844)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20646
diff changeset
576 emit open_file (file.absoluteFilePath ());
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
577 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
578 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
579
16506
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
580 void
16594
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
581 files_dock_widget::contextmenu_open_in_app (bool)
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
582 {
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
583 QItemSelectionModel *m = _file_tree_view->selectionModel ();
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
584 QModelIndexList rows = m->selectedRows ();
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
585
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
586 for (QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++)
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
587 open_item_in_app (*it);
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
588 }
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
589
3ce0c312a40b contextmenu for opening files in default applications
John W. Eaton <jwe@octave.org>
parents: 16570
diff changeset
590 void
16622
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
591 files_dock_widget::contextmenu_copy_selection (bool)
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
592 {
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
593 QItemSelectionModel *m = _file_tree_view->selectionModel ();
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
594 QModelIndexList rows = m->selectedRows ();
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
595
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
596 QStringList selection;
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
597
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
598 for (QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++)
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
599 {
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
600 QFileInfo info = _file_system_model->fileInfo (*it);
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
601
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
602 selection << info.fileName ();
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
603 }
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
604
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
605 QClipboard *clipboard = QApplication::clipboard ();
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
606
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
607 clipboard->setText (selection.join ("\n"));
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
608 }
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
609
38fef1e833ea handle copying names file browser to clipboard; allow multiple selections
John W. Eaton <jwe@octave.org>
parents: 16613
diff changeset
610 void
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
611 files_dock_widget::contextmenu_load (bool)
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
612 {
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
613 QItemSelectionModel *m = _file_tree_view->selectionModel ();
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
614 QModelIndexList rows = m->selectedRows ();
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
615
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
616 if (rows.size () > 0)
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
617 {
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
618 QModelIndex index = rows[0];
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
619
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
620 QFileInfo info = _file_system_model->fileInfo (index);
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
621
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
622 emit load_file_signal (info.fileName ());
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
623 }
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
624 }
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16503
diff changeset
625
16506
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
626 void
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
627 files_dock_widget::contextmenu_run (bool)
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
628 {
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
629 QItemSelectionModel *m = _file_tree_view->selectionModel ();
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
630 QModelIndexList rows = m->selectedRows ();
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
631
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
632 if (rows.size () > 0)
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
633 {
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
634 QModelIndex index = rows[0];
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
635
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
636 QFileInfo info = _file_system_model->fileInfo (index);
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16622
diff changeset
637 emit run_file_signal (info);
16506
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
638 }
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
639 }
8a4960f2c7c3 gui: allow running files from the file browser
Torsten <ttl@justmail.de>
parents: 16504
diff changeset
640
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
641 void
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
642 files_dock_widget::contextmenu_rename (bool)
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
643 {
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
644 QItemSelectionModel *m = _file_tree_view->selectionModel ();
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
645 QModelIndexList rows = m->selectedRows ();
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
646 if (rows.size () > 0)
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
647 {
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
648 QModelIndex index = rows[0];
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
649
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
650 QFileInfo info = _file_system_model->fileInfo (index);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
651 QDir path = info.absoluteDir ();
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
652 QString old_name = info.fileName ();
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
653 bool ok;
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
654
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
655 QString new_name
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
656 = QInputDialog::getText (this, tr ("Rename file/directory"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
657 tr ("Rename file/directory:\n")
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
658 + old_name + tr ("\n to: "),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
659 QLineEdit::Normal, old_name, &ok);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
660 if (ok && new_name.length () > 0)
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
661 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
662 new_name = path.absolutePath () + "/" + new_name;
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
663 old_name = path.absolutePath () + "/" + old_name;
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
664 path.rename (old_name, new_name);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
665 _file_system_model->revert ();
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
666 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
667 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
668
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
669 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
670
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
671 void
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
672 files_dock_widget::contextmenu_delete (bool)
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
673 {
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
674 QItemSelectionModel *m = _file_tree_view->selectionModel ();
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
675 QModelIndexList rows = m->selectedRows ();
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
676
18678
6113e0c6920b maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents: 18555
diff changeset
677 for (QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++)
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
678 {
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
679 QModelIndex index = *it;
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
680
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
681 QFileInfo info = _file_system_model->fileInfo (index);
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
682
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
683 if (QMessageBox::question (this, tr ("Delete file/directory"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
684 tr ("Are you sure you want to delete\n")
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
685 + info.filePath (),
21662
5b9868c2e212 maint: Octave coding convention cleanups.
Rik <rik@octave.org>
parents: 21578
diff changeset
686 QMessageBox::Yes | QMessageBox::No)
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
687 == QMessageBox::Yes)
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
688 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
689 if (info.isDir ())
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
690 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
691 // see if direcory is empty
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
692 QDir path (info.absoluteFilePath ());
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
693 QList<QFileInfo> fileLst = path.entryInfoList (QDir::AllEntries |
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
694 QDir::NoDotAndDotDot);
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
695
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
696 if (fileLst.count () != 0)
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
697 QMessageBox::warning (this, tr ("Delete file/directory"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
698 tr ("Can not delete a directory that is not empty"));
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
699 else
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
700 _file_system_model->rmdir (index);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
701 }
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
702 else
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
703 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
704 _file_system_model->remove (index);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
705 }
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
706
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
707 _file_system_model->revert ();
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
708
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
709 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
710 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
711 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
712
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
713 void
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
714 files_dock_widget::contextmenu_newfile (bool)
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
715 {
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
716 QItemSelectionModel *m = _file_tree_view->selectionModel ();
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
717 QModelIndexList rows = m->selectedRows ();
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
718
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
719 if (rows.size () > 0)
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
720 {
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
721 QModelIndex index = rows[0];
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
722
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
723 QFileInfo info = _file_system_model->fileInfo (index);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
724 QString parent_dir = info.filePath ();
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
725
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
726 process_new_file (parent_dir);
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
727 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
728 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
729
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
730 void
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
731 files_dock_widget::contextmenu_newdir (bool)
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
732 {
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
733 QItemSelectionModel *m = _file_tree_view->selectionModel ();
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
734 QModelIndexList rows = m->selectedRows ();
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
735
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
736 if (rows.size () > 0)
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
737 {
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
738 QModelIndex index = rows[0];
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
739
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
740 QFileInfo info = _file_system_model->fileInfo (index);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
741 QString parent_dir = info.filePath ();
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
742
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
743 process_new_dir (parent_dir);
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
744 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
745 }
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
746
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
747 void
16509
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
748 files_dock_widget::contextmenu_setcurrentdir (bool)
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
749 {
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
750 QItemSelectionModel *m = _file_tree_view->selectionModel ();
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
751 QModelIndexList rows = m->selectedRows ();
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
752
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
753 if (rows.size () > 0)
16509
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
754 {
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
755 QModelIndex index = rows[0];
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
756
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
757 QFileInfo info = _file_system_model->fileInfo (index);
16509
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
758
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
759 if (info.isDir ())
16509
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
760 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
761 process_set_current_dir (info.absoluteFilePath ());
16509
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
762 }
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
763 }
14045b872a3d Add set current directory context menu to file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16507
diff changeset
764 }
16503
c1ff738d606d allow files to be renamed or deleted using the file browser
John Donoghue <john.donoghue@ieee.org>
parents: 16499
diff changeset
765
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
766 void
16699
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
767 files_dock_widget::contextmenu_findfiles (bool)
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
768 {
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
769 QItemSelectionModel *m = _file_tree_view->selectionModel ();
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
770 QModelIndexList rows = m->selectedRows ();
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
771
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
772 if (rows.size () > 0)
16699
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
773 {
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
774 QModelIndex index = rows[0];
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
775
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
776 QFileInfo info = _file_system_model->fileInfo (index);
16699
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
777
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
778 if (info.isDir ())
16699
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
779 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
780 process_find_files (info.absoluteFilePath ());
16699
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
781 }
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
782 }
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
783 }
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
784
13536
869c62c15e95 Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13535
diff changeset
785 void
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16410
diff changeset
786 files_dock_widget::notice_settings (const QSettings *settings)
13536
869c62c15e95 Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13535
diff changeset
787 {
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16410
diff changeset
788 // Qsettings pointer is checked before emitting.
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 14812
diff changeset
789
19847
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
790 int icon_size_settings = settings->value ("toolbar_icon_size",0).toInt ();
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
791 QStyle *st = style ();
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
792 int icon_size = st->pixelMetric (QStyle::PM_ToolBarIconSize);
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
793
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
794 if (icon_size_settings == 1)
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
795 icon_size = st->pixelMetric (QStyle::PM_LargeIconSize);
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
796 else if (icon_size_settings == -1)
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
797 icon_size = st->pixelMetric (QStyle::PM_SmallIconSize);
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
798
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16515
diff changeset
799 _navigation_tool_bar->setIconSize (QSize (icon_size,icon_size));
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16515
diff changeset
800
20713
2469d78a1d8b Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents: 20706
diff changeset
801 // filenames are always shown, other columns can be hidden by settings
20642
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
802 for (int i = 0; i < 3; i++)
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
803 _file_tree_view->setColumnHidden (i + 1, ! settings->value (
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
804 _columns_shown_keys.at (i),false).toBool ());
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
805
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
806 if (settings->value (_columns_shown_keys.at (3),false).toBool ())
17970
f6e1be4ad923 Add functionality for showing/hiding hidden files in the file browser (bug #40636).
John Swensen <jpswensen@gmail.com>
parents: 17960
diff changeset
807 _file_system_model->setFilter (QDir::NoDotAndDotDot | QDir::AllEntries
f6e1be4ad923 Add functionality for showing/hiding hidden files in the file browser (bug #40636).
John Swensen <jpswensen@gmail.com>
parents: 17960
diff changeset
808 | QDir::Hidden);
f6e1be4ad923 Add functionality for showing/hiding hidden files in the file browser (bug #40636).
John Swensen <jpswensen@gmail.com>
parents: 17960
diff changeset
809 else
f6e1be4ad923 Add functionality for showing/hiding hidden files in the file browser (bug #40636).
John Swensen <jpswensen@gmail.com>
parents: 17960
diff changeset
810 _file_system_model->setFilter (QDir::NoDotAndDotDot | QDir::AllEntries);
20642
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
811
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
812 _file_tree_view->setAlternatingRowColors (
3e449f43e708 revised code for header context menu in file browser
Torsten <ttl@justmail.de>
parents: 20017
diff changeset
813 settings->value (_columns_shown_keys.at (4),true).toBool ());
17970
f6e1be4ad923 Add functionality for showing/hiding hidden files in the file browser (bug #40636).
John Swensen <jpswensen@gmail.com>
parents: 17960
diff changeset
814 _file_tree_view->setModel (_file_system_model);
f6e1be4ad923 Add functionality for showing/hiding hidden files in the file browser (bug #40636).
John Swensen <jpswensen@gmail.com>
parents: 17960
diff changeset
815
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
816 // enable the buttons to sync octave/browser dir
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
817 // only if this is not done by default
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
818 _sync_octave_dir
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
819 = settings->value ("filesdockwidget/sync_octave_directory",false).toBool ();
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20773
diff changeset
820 _sync_octave_directory_action->setEnabled (! _sync_octave_dir);
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20773
diff changeset
821 _sync_browser_directory_action->setEnabled (! _sync_octave_dir);
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
822
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
823 if (_sync_octave_dir)
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
824 display_directory (_octave_dir); // sync browser to octave dir
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16498
diff changeset
825
13536
869c62c15e95 Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13535
diff changeset
826 }
16542
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
827
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
828 void
16762
42555422e326 Add Show home directory to files window popdown.
John Donoghue <john.donoghue@ieee.org>
parents: 16709
diff changeset
829 files_dock_widget::popdownmenu_home (bool)
42555422e326 Add Show home directory to files window popdown.
John Donoghue <john.donoghue@ieee.org>
parents: 16709
diff changeset
830 {
21732
6a1eded90355 use namespace for system env class
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
831 QString dir = QString::fromStdString (octave::sys::env::get_home_directory ());
20017
4b7b7ac7af2c use get_home_directory instead of getenv ("HOME") (bug #44694)
John W. Eaton <jwe@octave.org>
parents: 20000
diff changeset
832
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
833 if (dir.isEmpty ())
17008
21ed3e2c3be6 Use HOME environment var for show home folder in files_dock-widget when available
John Donoghue <john.donoghue@ieee.org>
parents: 16912
diff changeset
834 dir = QDir::homePath ();
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
835
16762
42555422e326 Add Show home directory to files window popdown.
John Donoghue <john.donoghue@ieee.org>
parents: 16709
diff changeset
836 set_current_directory (dir);
42555422e326 Add Show home directory to files window popdown.
John Donoghue <john.donoghue@ieee.org>
parents: 16709
diff changeset
837 }
42555422e326 Add Show home directory to files window popdown.
John Donoghue <john.donoghue@ieee.org>
parents: 16709
diff changeset
838
42555422e326 Add Show home directory to files window popdown.
John Donoghue <john.donoghue@ieee.org>
parents: 16709
diff changeset
839 void
16613
99a57611d58a add menu for searching the next directory shown by the file browser
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
840 files_dock_widget::popdownmenu_search_dir (bool)
99a57611d58a add menu for searching the next directory shown by the file browser
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
841 {
16709
1070f2ca1367 fix searching new directory for file browser
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
842 QString dir = QFileDialog::getExistingDirectory
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
843 (this, tr ("Set directory of file browser"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
844 _file_system_model->rootPath (),
18820
85b4ba1fe6de only show directories in search directory dialog activated from files browser
Torsten <ttl@justmail.de>
parents: 18407
diff changeset
845 QFileDialog::ShowDirsOnly | QFileDialog::DontUseNativeDialog);
16709
1070f2ca1367 fix searching new directory for file browser
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
846 set_current_directory (dir);
16613
99a57611d58a add menu for searching the next directory shown by the file browser
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
847 }
99a57611d58a add menu for searching the next directory shown by the file browser
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
848
99a57611d58a add menu for searching the next directory shown by the file browser
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
849 void
16699
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
850 files_dock_widget::popdownmenu_findfiles (bool)
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
851 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
852 process_find_files (_file_system_model->rootPath ());
16699
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
853 }
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
854
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
855 void
16542
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
856 files_dock_widget::popdownmenu_newdir (bool)
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
857 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
858 process_new_dir (_file_system_model->rootPath ());
16542
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
859 }
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
860
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
861 void
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
862 files_dock_widget::popdownmenu_newfile (bool)
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
863 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
864 process_new_file (_file_system_model->rootPath ());
16542
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
865 }
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
866
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
867 void
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
868 files_dock_widget::process_new_file (const QString &parent_dir)
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
869 {
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
870 bool ok;
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
871
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
872 QString name = QInputDialog::getText (this, tr ("Create File"),
18251
0b5f669f5b03 fix some translation issues (bug #41159)
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
873 tr ("Create file in\n","String ends with \\n!") + parent_dir,
18283
12291fb903de fix missing translations (bug #41200)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
874 QLineEdit::Normal, tr ("New File.txt"), &ok);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
875 if (ok && name.length () > 0)
16542
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
876 {
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
877 name = parent_dir + "/" + name;
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
878
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
879 QFile file (name);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
880 file.open (QIODevice::WriteOnly);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
881 _file_system_model->revert ();
16542
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
882 }
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
883 }
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
884
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
885 void
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
886 files_dock_widget::process_new_dir (const QString &parent_dir)
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
887 {
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
888 bool ok;
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
889
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
890 QString name = QInputDialog::getText (this, tr ("Create Directory"),
18251
0b5f669f5b03 fix some translation issues (bug #41159)
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
891 tr ("Create folder in\n","String ends with \\n!") + parent_dir,
18283
12291fb903de fix missing translations (bug #41200)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
892 QLineEdit::Normal, tr ("New Directory"), &ok);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
893 if (ok && name.length () > 0)
16542
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
894 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
895 QDir dir (parent_dir);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
896 dir.mkdir (name);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
897 _file_system_model->revert ();
16542
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
898 }
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
899 }
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
900
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
901 void files_dock_widget::process_set_current_dir (const QString & dir)
16542
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
902 {
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
903 emit displayed_directory_changed (dir);
016073c0cb94 Add popdown toolbutton to files-dock-window toolbar.
John Donoghue <john.donoghue@ieee.org>
parents: 16525
diff changeset
904 }
16699
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
905
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
906 void files_dock_widget::process_find_files (const QString & dir)
16699
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
907 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
908 emit find_files_signal (dir);
16699
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
909 }
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16635
diff changeset
910
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
911 void
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
912 files_dock_widget::copyClipboard ()
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
913 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
914 if (_file_tree_view->hasFocus ())
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
915 contextmenu_copy_selection (true);
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
916 if (_current_directory->hasFocus ())
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
917 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
918 QClipboard *clipboard = QApplication::clipboard ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
919
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
920 QLineEdit * edit = _current_directory->lineEdit ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
921 if (edit && edit->hasSelectedText ())
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
922 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
923 clipboard->setText (edit->selectedText ());
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
924 }
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
925 }
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
926 }
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
927
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
928 void
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
929 files_dock_widget::pasteClipboard ()
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
930 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
931 if (_current_directory->hasFocus ())
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
932 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
933 QClipboard *clipboard = QApplication::clipboard ();
21568
3d60ed163b70 maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents: 21301
diff changeset
934 QString str = clipboard->text ();
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
935 QLineEdit * edit = _current_directory->lineEdit ();
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
936 if (edit && str.length () > 0)
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
937 edit->insert (str);
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
938 }
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
939 }
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
940
18555
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
941 void
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
942 files_dock_widget::selectAll ()
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
943 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
944 if (_file_tree_view->hasFocus ())
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
945 _file_tree_view->selectAll ();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
946 if (_current_directory->hasFocus ())
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
947 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
948 QLineEdit * edit = _current_directory->lineEdit ();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
949 if (edit)
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
950 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
951 edit->selectAll ();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
952 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
953 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
954 }
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
955
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16865
diff changeset
956
18555
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18408
diff changeset
957