Changeset View
Changeset View
Standalone View
Standalone View
src/kgrapheditor.cpp
Show All 10 Lines | 1 | /* This file is part of KGraphViewer. | |||
---|---|---|---|---|---|
11 | General Public License for more details. | 11 | General Public License for more details. | ||
12 | 12 | | |||
13 | You should have received a copy of the GNU General Public License | 13 | You should have received a copy of the GNU General Public License | ||
14 | along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software | ||
15 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 15 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
16 | 02110-1301, USA | 16 | 02110-1301, USA | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | | ||||
20 | #include "kgrapheditor.h" | 19 | #include "kgrapheditor.h" | ||
20 | #include "KGraphEditorElementTreeWidget.h" | ||||
21 | #include "KGraphEditorNodesTreeWidget.h" | ||||
21 | #include "kgrapheditorConfigDialog.h" | 22 | #include "kgrapheditorConfigDialog.h" | ||
22 | #include "kgrapheditorsettings.h" | | |||
23 | #include "kgrapheditor_debug.h" | 23 | #include "kgrapheditor_debug.h" | ||
24 | #include "KGraphEditorNodesTreeWidget.h" | 24 | #include "kgrapheditorsettings.h" | ||
25 | #include "KGraphEditorElementTreeWidget.h" | 25 | #include "part/kgraphviewer_part.h" | ||
26 | #include "ui_preferencesReload.h" | | |||
27 | #include "ui_preferencesParsing.h" | | |||
28 | #include "ui_preferencesOpenInExistingWindow.h" | 26 | #include "ui_preferencesOpenInExistingWindow.h" | ||
27 | #include "ui_preferencesParsing.h" | ||||
28 | #include "ui_preferencesReload.h" | ||||
29 | #include "ui_preferencesReopenPreviouslyOpenedFiles.h" | 29 | #include "ui_preferencesReopenPreviouslyOpenedFiles.h" | ||
30 | #include "part/kgraphviewer_part.h" | | |||
31 | 30 | | |||
32 | #include <kshortcutsdialog.h> | 31 | #include <KActionCollection> | ||
33 | #include <QFileDialog> | | |||
34 | #include <kconfig.h> | | |||
35 | #include <QUrl> | | |||
36 | #include <QTabWidget> | | |||
37 | #include <kparts/partmanager.h> | | |||
38 | #include <kedittoolbar.h> | | |||
39 | #include <QDebug> | | |||
40 | #include <QStandardPaths> | | |||
41 | #include <kstandardaction.h> | | |||
42 | #include <ktoggleaction.h> | | |||
43 | #include <KPluginLoader> | 32 | #include <KPluginLoader> | ||
44 | #include <KService> | 33 | #include <KService> | ||
34 | #include <QDebug> | ||||
35 | #include <QDockWidget> | ||||
36 | #include <QFileDialog> | ||||
45 | #include <QMessageBox> | 37 | #include <QMessageBox> | ||
38 | #include <QStandardPaths> | ||||
46 | #include <QStatusBar> | 39 | #include <QStatusBar> | ||
40 | #include <QTabWidget> | ||||
41 | #include <QTreeWidget> | ||||
42 | #include <QUrl> | ||||
43 | #include <QtDBus/QtDBus> | ||||
44 | #include <kconfig.h> | ||||
47 | #include <kconfigdialog.h> | 45 | #include <kconfigdialog.h> | ||
48 | #include <QDebug> | 46 | #include <kedittoolbar.h> | ||
47 | #include <klocalizedstring.h> | ||||
48 | #include <kparts/partmanager.h> | ||||
49 | #include <krecentfilesaction.h> | 49 | #include <krecentfilesaction.h> | ||
50 | #include <kshortcutsdialog.h> | ||||
51 | #include <kstandardaction.h> | ||||
52 | #include <ktoggleaction.h> | ||||
50 | #include <ktoolbar.h> | 53 | #include <ktoolbar.h> | ||
51 | #include <KActionCollection> | | |||
52 | #include <klocalizedstring.h> | | |||
53 | #include <QtDBus/QtDBus> | | |||
54 | #include <QDockWidget> | | |||
55 | #include <QTreeWidget> | | |||
56 | 54 | | |||
57 | #include <iostream> | 55 | #include <iostream> | ||
58 | 56 | | |||
59 | using namespace KGraphViewer; | 57 | using namespace KGraphViewer; | ||
60 | 58 | | |||
61 | KGraphEditor::KGraphEditor() : | 59 | KGraphEditor::KGraphEditor() | ||
62 | KParts::MainWindow(), | 60 | : KParts::MainWindow() | ||
63 | m_rfa(nullptr), | 61 | , m_rfa(nullptr) | ||
64 | m_currentPart(nullptr) | 62 | , m_currentPart(nullptr) | ||
65 | { | 63 | { | ||
66 | // set the shell's ui resource file | 64 | // set the shell's ui resource file | ||
67 | setXMLFile("kgrapheditorui.rc"); | 65 | setXMLFile("kgrapheditorui.rc"); | ||
68 | 66 | | |||
69 | m_widget = new QTabWidget(this); | 67 | m_widget = new QTabWidget(this); | ||
70 | m_widget->setTabsClosable(true); | 68 | m_widget->setTabsClosable(true); | ||
71 | connect(m_widget, SIGNAL(tabCloseRequested(int)), this, SLOT(close(int))); | 69 | connect(m_widget, SIGNAL(tabCloseRequested(int)), this, SLOT(close(int))); | ||
72 | connect(m_widget, SIGNAL(currentChanged(int)), this, SLOT(newTabSelectedSlot(int))); | 70 | connect(m_widget, SIGNAL(currentChanged(int)), this, SLOT(newTabSelectedSlot(int))); | ||
73 | 71 | | |||
74 | setCentralWidget(m_widget); | 72 | setCentralWidget(m_widget); | ||
75 | 73 | | |||
76 | QDockWidget* topLeftDockWidget = new QDockWidget(this); | 74 | QDockWidget *topLeftDockWidget = new QDockWidget(this); | ||
77 | topLeftDockWidget->setObjectName(QStringLiteral("TopLeftDockWidget")); | 75 | topLeftDockWidget->setObjectName(QStringLiteral("TopLeftDockWidget")); | ||
78 | m_treeWidget = new KGraphEditorNodesTreeWidget(topLeftDockWidget); | 76 | m_treeWidget = new KGraphEditorNodesTreeWidget(topLeftDockWidget); | ||
79 | connect(m_treeWidget,SIGNAL(itemChanged(QTreeWidgetItem*,int)), | 77 | connect(m_treeWidget, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemChanged(QTreeWidgetItem *, int))); | ||
80 | this,SLOT(slotItemChanged(QTreeWidgetItem*,int))); | 78 | connect(m_treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(slotItemClicked(QTreeWidgetItem *, int))); | ||
81 | connect(m_treeWidget,SIGNAL(itemClicked(QTreeWidgetItem*,int)), | 79 | connect(m_treeWidget, SIGNAL(removeNode(QString)), this, SLOT(slotRemoveNode(QString))); | ||
82 | this,SLOT(slotItemClicked(QTreeWidgetItem*,int))); | 80 | connect(m_treeWidget, SIGNAL(addAttribute(QString)), this, SLOT(slotAddAttribute(QString))); | ||
83 | connect(m_treeWidget, SIGNAL(removeNode(QString)), | 81 | connect(m_treeWidget, SIGNAL(removeAttribute(QString, QString)), this, SLOT(slotRemoveAttribute(QString, QString))); | ||
84 | this, SLOT(slotRemoveNode(QString))); | | |||
85 | connect(m_treeWidget, SIGNAL(addAttribute(QString)), | | |||
86 | this, SLOT(slotAddAttribute(QString))); | | |||
87 | connect(m_treeWidget, SIGNAL(removeAttribute(QString,QString)), | | |||
88 | this, SLOT(slotRemoveAttribute(QString,QString))); | | |||
89 | 82 | | |||
90 | // m_treeWidget->setItemDelegate(new VariantDelegate(m_treeWidget)); | 83 | // m_treeWidget->setItemDelegate(new VariantDelegate(m_treeWidget)); | ||
91 | m_treeWidget->setColumnCount(2); | 84 | m_treeWidget->setColumnCount(2); | ||
92 | topLeftDockWidget->setWidget(m_treeWidget); | 85 | topLeftDockWidget->setWidget(m_treeWidget); | ||
93 | addDockWidget ( Qt::LeftDockWidgetArea, topLeftDockWidget ); | 86 | addDockWidget(Qt::LeftDockWidgetArea, topLeftDockWidget); | ||
94 | 87 | | |||
95 | QDockWidget* bottomLeftDockWidget = new QDockWidget(this); | 88 | QDockWidget *bottomLeftDockWidget = new QDockWidget(this); | ||
96 | bottomLeftDockWidget->setObjectName(QStringLiteral("BottomLeftDockWidget")); | 89 | bottomLeftDockWidget->setObjectName(QStringLiteral("BottomLeftDockWidget")); | ||
97 | m_newElementAttributesWidget = new KGraphEditorElementTreeWidget(bottomLeftDockWidget); | 90 | m_newElementAttributesWidget = new KGraphEditorElementTreeWidget(bottomLeftDockWidget); | ||
98 | connect(m_newElementAttributesWidget,SIGNAL(itemChanged(QTreeWidgetItem*,int)), | 91 | connect(m_newElementAttributesWidget, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotNewElementItemChanged(QTreeWidgetItem *, int))); | ||
99 | this,SLOT(slotNewElementItemChanged(QTreeWidgetItem*,int))); | 92 | connect(m_newElementAttributesWidget, SIGNAL(addAttribute(QString)), this, SLOT(slotAddNewElementAttribute(QString))); | ||
100 | connect(m_newElementAttributesWidget, SIGNAL(addAttribute(QString)), | 93 | connect(m_newElementAttributesWidget, SIGNAL(removeAttribute(QString)), this, SLOT(slotRemoveNewElementAttribute(QString))); | ||
101 | this, SLOT(slotAddNewElementAttribute(QString))); | | |||
102 | connect(m_newElementAttributesWidget, SIGNAL(removeAttribute(QString)), | | |||
103 | this, SLOT(slotRemoveNewElementAttribute(QString))); | | |||
104 | m_newElementAttributesWidget->setColumnCount(2); | 94 | m_newElementAttributesWidget->setColumnCount(2); | ||
105 | bottomLeftDockWidget->setWidget(m_newElementAttributesWidget); | 95 | bottomLeftDockWidget->setWidget(m_newElementAttributesWidget); | ||
106 | addDockWidget ( Qt::LeftDockWidgetArea, bottomLeftDockWidget ); | 96 | addDockWidget(Qt::LeftDockWidgetArea, bottomLeftDockWidget); | ||
107 | 97 | | |||
108 | 98 | if (QDBusConnection::sessionBus().registerService("org.kde.kgrapheditor")) { | |||
109 | if (QDBusConnection::sessionBus().registerService( "org.kde.kgrapheditor" )) | | |||
110 | { | | |||
111 | qCDebug(KGRAPHEDITOR_LOG) << "Service Registered successfully"; | 99 | qCDebug(KGRAPHEDITOR_LOG) << "Service Registered successfully"; | ||
112 | QDBusConnection::sessionBus().registerObject("/", this, QDBusConnection::ExportAllSlots); | 100 | QDBusConnection::sessionBus().registerObject("/", this, QDBusConnection::ExportAllSlots); | ||
113 | 101 | | |||
114 | } | 102 | } else { | ||
115 | else | | |||
116 | { | | |||
117 | qCDebug(KGRAPHEDITOR_LOG) << "Failed to register service..."; | 103 | qCDebug(KGRAPHEDITOR_LOG) << "Failed to register service..."; | ||
118 | } | 104 | } | ||
119 | 105 | | |||
120 | // Create a KParts part manager, to handle part activation/deactivation | 106 | // Create a KParts part manager, to handle part activation/deactivation | ||
121 | m_manager = new KParts::PartManager( this ); | 107 | m_manager = new KParts::PartManager(this); | ||
122 | 108 | | |||
123 | // When the manager says the active part changes, the window updates (recreates) the GUI | 109 | // When the manager says the active part changes, the window updates (recreates) the GUI | ||
124 | connect( m_manager, SIGNAL(activePartChanged(KParts::Part*)), | 110 | connect(m_manager, SIGNAL(activePartChanged(KParts::Part *)), this, SLOT(createGUI(KParts::Part *))); | ||
125 | this, SLOT(createGUI(KParts::Part*)) ); | | |||
126 | 111 | | |||
127 | setupGUI(ToolBar | Keys | StatusBar | Save); | 112 | setupGUI(ToolBar | Keys | StatusBar | Save); | ||
128 | 113 | | |||
129 | // then, setup our actions | 114 | // then, setup our actions | ||
130 | setupActions(); | 115 | setupActions(); | ||
131 | 116 | | |||
132 | // this routine will find and load our Part. it finds the Part by | 117 | // this routine will find and load our Part. it finds the Part by | ||
133 | // name which is a bad idea usually.. but it's alright in this | 118 | // name which is a bad idea usually.. but it's alright in this | ||
134 | // case since our Part is made for this Shell | 119 | // case since our Part is made for this Shell | ||
135 | 120 | | |||
136 | // Creates the GUI with a null part to make appear the main app menus and tools | 121 | // Creates the GUI with a null part to make appear the main app menus and tools | ||
137 | createGUI(0); | 122 | createGUI(0); | ||
138 | } | 123 | } | ||
139 | 124 | | |||
140 | KGraphEditor::~KGraphEditor() | 125 | KGraphEditor::~KGraphEditor() | ||
141 | { | 126 | { | ||
142 | } | 127 | } | ||
143 | 128 | | |||
144 | void KGraphEditor::reloadPreviousFiles() | 129 | void KGraphEditor::reloadPreviousFiles() | ||
145 | { | 130 | { | ||
146 | QStringList previouslyOpenedFiles = KGraphEditorSettings::previouslyOpenedFiles(); | 131 | QStringList previouslyOpenedFiles = KGraphEditorSettings::previouslyOpenedFiles(); | ||
147 | if ( (previouslyOpenedFiles.empty() == false) | 132 | if ((previouslyOpenedFiles.empty() == false) && (QMessageBox::question(this, i18n("Session Restore"), i18n("Do you want to reload files from previous session?")) == QMessageBox::Yes)) { | ||
148 | && (QMessageBox::question(this, | | |||
149 | i18n("Session Restore"), | | |||
150 | i18n("Do you want to reload files from previous session?")) == QMessageBox::Yes) ) | | |||
151 | { | | |||
152 | QStringList::const_iterator it, it_end; | 133 | QStringList::const_iterator it, it_end; | ||
153 | it = previouslyOpenedFiles.constBegin(); it_end = previouslyOpenedFiles.constEnd(); | 134 | it = previouslyOpenedFiles.constBegin(); | ||
154 | for (; it != it_end; it++) | 135 | it_end = previouslyOpenedFiles.constEnd(); | ||
155 | { | 136 | for (; it != it_end; it++) { | ||
156 | openUrl(*it); | 137 | openUrl(*it); | ||
157 | } | 138 | } | ||
158 | } | 139 | } | ||
159 | } | 140 | } | ||
160 | 141 | | |||
161 | KParts::ReadOnlyPart *KGraphEditor::slotNewGraph() | 142 | KParts::ReadOnlyPart *KGraphEditor::slotNewGraph() | ||
162 | { | 143 | { | ||
163 | KPluginFactory *factory = KPluginLoader("kgraphviewerpart").factory(); | 144 | KPluginFactory *factory = KPluginLoader("kgraphviewerpart").factory(); | ||
164 | if (!factory) | 145 | if (!factory) { | ||
165 | { | | |||
166 | // if we couldn't find our Part, we exit since the Shell by | 146 | // if we couldn't find our Part, we exit since the Shell by | ||
167 | // itself can't do anything useful | 147 | // itself can't do anything useful | ||
168 | QMessageBox::critical(this, i18n("Unable to start"), i18n("Could not find the KGraphViewer part.")); | 148 | QMessageBox::critical(this, i18n("Unable to start"), i18n("Could not find the KGraphViewer part.")); | ||
169 | qApp->quit(); | 149 | qApp->quit(); | ||
170 | // we return here, cause kapp->quit() only means "exit the | 150 | // we return here, cause kapp->quit() only means "exit the | ||
171 | // next time we enter the event loop... | 151 | // next time we enter the event loop... | ||
172 | return nullptr; | 152 | return nullptr; | ||
173 | } | 153 | } | ||
174 | KParts::ReadOnlyPart* part = factory->create<KParts::ReadOnlyPart>(this); | 154 | KParts::ReadOnlyPart *part = factory->create<KParts::ReadOnlyPart>(this); | ||
175 | KGraphViewerInterface *view = qobject_cast<KGraphViewerInterface *>(part); | 155 | KGraphViewerInterface *view = qobject_cast<KGraphViewerInterface *>(part); | ||
176 | if (!view) | 156 | if (!view) { | ||
177 | { | | |||
178 | // This should not happen | 157 | // This should not happen | ||
179 | qCWarning(KGRAPHEDITOR_LOG) << "Failed to get KPart" << endl; | 158 | qCWarning(KGRAPHEDITOR_LOG) << "Failed to get KPart" << endl; | ||
180 | return nullptr; | 159 | return nullptr; | ||
181 | } | 160 | } | ||
182 | view->setReadWrite(); | 161 | view->setReadWrite(); | ||
183 | 162 | | |||
184 | QWidget *w = part->widget(); | 163 | QWidget *w = part->widget(); | ||
185 | 164 | | |||
186 | m_tabsPartsMap[w] = part; | 165 | m_tabsPartsMap[w] = part; | ||
187 | m_tabsFilesMap[w] = ""; | 166 | m_tabsFilesMap[w] = ""; | ||
188 | connect(this,SIGNAL(hide(KParts::Part*)),part,SLOT(slotHide(KParts::Part*))); | 167 | connect(this, SIGNAL(hide(KParts::Part *)), part, SLOT(slotHide(KParts::Part *))); | ||
189 | 168 | | |||
190 | m_manager->addPart(part, true); | 169 | m_manager->addPart(part, true); | ||
191 | 170 | | |||
192 | m_widget->addTab(w, QIcon::fromTheme("kgraphviewer"), ""); | 171 | m_widget->addTab(w, QIcon::fromTheme("kgraphviewer"), ""); | ||
193 | m_widget->setCurrentWidget(w); | 172 | m_widget->setCurrentWidget(w); | ||
194 | m_closeAction->setEnabled(true); | 173 | m_closeAction->setEnabled(true); | ||
195 | return part; | 174 | return part; | ||
196 | } | 175 | } | ||
197 | 176 | | |||
198 | void KGraphEditor::openUrl(const QUrl& url) | 177 | void KGraphEditor::openUrl(const QUrl &url) | ||
199 | { | 178 | { | ||
200 | qCDebug(KGRAPHEDITOR_LOG) << url; | 179 | qCDebug(KGRAPHEDITOR_LOG) << url; | ||
201 | KParts::ReadOnlyPart *part = slotNewGraph(); | 180 | KParts::ReadOnlyPart *part = slotNewGraph(); | ||
202 | 181 | | |||
203 | // (KGraphEditorSettings::parsingMode() == "external") | 182 | // (KGraphEditorSettings::parsingMode() == "external") | ||
204 | // ?kgv->setLayoutMethod(KGraphViewerInterface::ExternalProgram) | 183 | // ?kgv->setLayoutMethod(KGraphViewerInterface::ExternalProgram) | ||
205 | // :kgv->setLayoutMethod(KGraphViewerInterface::InternalLibrary); | 184 | // :kgv->setLayoutMethod(KGraphViewerInterface::InternalLibrary); | ||
206 | 185 | | |||
207 | QString label = url.path().section('/',-1,-1); | 186 | QString label = url.path().section('/', -1, -1); | ||
208 | // @TODO set label | 187 | // @TODO set label | ||
209 | m_widget->setTabText(m_widget->currentIndex(), label); | 188 | m_widget->setTabText(m_widget->currentIndex(), label); | ||
210 | m_tabsFilesMap[m_widget->currentWidget()] = url.path(); | 189 | m_tabsFilesMap[m_widget->currentWidget()] = url.path(); | ||
211 | part->openUrl(url); | 190 | part->openUrl(url); | ||
212 | 191 | | |||
213 | if (m_rfa) { | 192 | if (m_rfa) { | ||
214 | m_rfa->addUrl(url); | 193 | m_rfa->addUrl(url); | ||
215 | } | 194 | } | ||
Show All 9 Lines | 200 | { | |||
225 | QFileDialog fileDialog(this); | 204 | QFileDialog fileDialog(this); | ||
226 | fileDialog.setMimeTypeFilters(QStringList(QStringLiteral("text/vnd.graphviz"))); | 205 | fileDialog.setMimeTypeFilters(QStringList(QStringLiteral("text/vnd.graphviz"))); | ||
227 | fileDialog.setAcceptMode(QFileDialog::AcceptOpen); | 206 | fileDialog.setAcceptMode(QFileDialog::AcceptOpen); | ||
228 | fileDialog.setFileMode(QFileDialog::ExistingFiles); | 207 | fileDialog.setFileMode(QFileDialog::ExistingFiles); | ||
229 | if (fileDialog.exec() != QFileDialog::Accepted) { | 208 | if (fileDialog.exec() != QFileDialog::Accepted) { | ||
230 | return; | 209 | return; | ||
231 | } | 210 | } | ||
232 | 211 | | |||
233 | foreach (const QUrl& url, fileDialog.selectedUrls()) { | 212 | foreach (const QUrl &url, fileDialog.selectedUrls()) { | ||
234 | openUrl(url); | 213 | openUrl(url); | ||
235 | } | 214 | } | ||
236 | } | 215 | } | ||
237 | 216 | | |||
238 | | ||||
239 | void KGraphEditor::setupActions() | 217 | void KGraphEditor::setupActions() | ||
240 | { | 218 | { | ||
241 | // create our actions | 219 | // create our actions | ||
242 | 220 | | |||
243 | actionCollection()->addAction( KStandardAction::New, "file_new", this, SLOT(fileNew()) ); | 221 | actionCollection()->addAction(KStandardAction::New, "file_new", this, SLOT(fileNew())); | ||
244 | actionCollection()->addAction( KStandardAction::Open, "file_open", this, SLOT(fileOpen()) ); | 222 | actionCollection()->addAction(KStandardAction::Open, "file_open", this, SLOT(fileOpen())); | ||
245 | m_rfa = (KRecentFilesAction*) actionCollection()->addAction(KStandardAction::OpenRecent, "file_open_recent", this, SLOT(slotURLSelected(QUrl)) ); | 223 | m_rfa = (KRecentFilesAction *)actionCollection()->addAction(KStandardAction::OpenRecent, "file_open_recent", this, SLOT(slotURLSelected(QUrl))); | ||
246 | m_rfa->loadEntries(KConfigGroup(KSharedConfig::openConfig(), "kgrapheditor")); | 224 | m_rfa->loadEntries(KConfigGroup(KSharedConfig::openConfig(), "kgrapheditor")); | ||
247 | actionCollection()->addAction( KStandardAction::Save, "file_save", this, SLOT(fileSave()) ); | 225 | actionCollection()->addAction(KStandardAction::Save, "file_save", this, SLOT(fileSave())); | ||
248 | actionCollection()->addAction( KStandardAction::SaveAs, "file_save_as", this, SLOT(fileSaveAs()) ); | 226 | actionCollection()->addAction(KStandardAction::SaveAs, "file_save_as", this, SLOT(fileSaveAs())); | ||
249 | 227 | | |||
250 | m_closeAction = actionCollection()->addAction( KStandardAction::Close, "file_close", this, SLOT(close()) ); | 228 | m_closeAction = actionCollection()->addAction(KStandardAction::Close, "file_close", this, SLOT(close())); | ||
251 | m_closeAction->setWhatsThis(i18n("Closes the current file")); | 229 | m_closeAction->setWhatsThis(i18n("Closes the current file")); | ||
252 | m_closeAction->setEnabled(false); | 230 | m_closeAction->setEnabled(false); | ||
253 | 231 | | |||
254 | actionCollection()->addAction( KStandardAction::Quit, "file_quit", qApp, SLOT(quit()) ); | 232 | actionCollection()->addAction(KStandardAction::Quit, "file_quit", qApp, SLOT(quit())); | ||
255 | 233 | | |||
256 | m_statusbarAction = KStandardAction::showStatusbar(this, SLOT(optionsShowStatusbar()), this); | 234 | m_statusbarAction = KStandardAction::showStatusbar(this, SLOT(optionsShowStatusbar()), this); | ||
257 | 235 | | |||
258 | actionCollection()->addAction( KStandardAction::KeyBindings, "options_configure_keybinding", this, SLOT(optionsConfigureKeys()) ); | 236 | actionCollection()->addAction(KStandardAction::KeyBindings, "options_configure_keybinding", this, SLOT(optionsConfigureKeys())); | ||
259 | // KStandardAction::keyBindings(this, SLOT(optionsConfigureKeys()), this); | 237 | // KStandardAction::keyBindings(this, SLOT(optionsConfigureKeys()), this); | ||
260 | actionCollection()->addAction( KStandardAction::ConfigureToolbars, "options_configure_toolbars", this, SLOT(optionsConfigureToolbars()) ); | 238 | actionCollection()->addAction(KStandardAction::ConfigureToolbars, "options_configure_toolbars", this, SLOT(optionsConfigureToolbars())); | ||
261 | actionCollection()->addAction( KStandardAction::Preferences, "options_configure", this, SLOT(optionsConfigure()) ); | 239 | actionCollection()->addAction(KStandardAction::Preferences, "options_configure", this, SLOT(optionsConfigure())); | ||
262 | 240 | | |||
263 | QAction* edit_new_vertex = actionCollection()->addAction( "edit_new_vertex" ); | 241 | QAction *edit_new_vertex = actionCollection()->addAction("edit_new_vertex"); | ||
264 | edit_new_vertex->setText(i18n("Create a New Vertex")); | 242 | edit_new_vertex->setText(i18n("Create a New Vertex")); | ||
265 | edit_new_vertex->setIcon(QPixmap(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kgraphviewerpart/pics/kgraphviewer-newnode.png"))); | 243 | edit_new_vertex->setIcon(QPixmap(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kgraphviewerpart/pics/kgraphviewer-newnode.png"))); | ||
266 | connect( edit_new_vertex, SIGNAL(triggered(bool)), this, SLOT(slotEditNewVertex()) ); | 244 | connect(edit_new_vertex, SIGNAL(triggered(bool)), this, SLOT(slotEditNewVertex())); | ||
267 | 245 | | |||
268 | QAction* edit_new_edge = actionCollection()->addAction( "edit_new_edge" ); | 246 | QAction *edit_new_edge = actionCollection()->addAction("edit_new_edge"); | ||
269 | edit_new_edge->setText(i18n("Create a New Edge")); | 247 | edit_new_edge->setText(i18n("Create a New Edge")); | ||
270 | edit_new_edge->setIcon(QPixmap(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kgraphviewerpart/pics/kgraphviewer-newedge.png"))); | 248 | edit_new_edge->setIcon(QPixmap(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kgraphviewerpart/pics/kgraphviewer-newedge.png"))); | ||
271 | connect( edit_new_edge, SIGNAL(triggered(bool)), this, SLOT(slotEditNewEdge()) ); | 249 | connect(edit_new_edge, SIGNAL(triggered(bool)), this, SLOT(slotEditNewEdge())); | ||
272 | } | 250 | } | ||
273 | 251 | | |||
274 | void KGraphEditor::closeEvent(QCloseEvent *event) | 252 | void KGraphEditor::closeEvent(QCloseEvent *event) | ||
275 | { | 253 | { | ||
276 | KGraphEditorSettings::setPreviouslyOpenedFiles(m_openedFiles); | 254 | KGraphEditorSettings::setPreviouslyOpenedFiles(m_openedFiles); | ||
277 | m_rfa->saveEntries(KConfigGroup(KSharedConfig::openConfig(), "kgrapheditor")); | 255 | m_rfa->saveEntries(KConfigGroup(KSharedConfig::openConfig(), "kgrapheditor")); | ||
278 | 256 | | |||
279 | KGraphEditorSettings::self()->save(); | 257 | KGraphEditorSettings::self()->save(); | ||
280 | KXmlGuiWindow::closeEvent(event); | 258 | KXmlGuiWindow::closeEvent(event); | ||
281 | } | 259 | } | ||
282 | 260 | | |||
283 | void KGraphEditor::fileNew() | 261 | void KGraphEditor::fileNew() | ||
284 | { | 262 | { | ||
285 | // this slot is called whenever the File->New menu is selected, | 263 | // this slot is called whenever the File->New menu is selected, | ||
286 | // the New shortcut is pressed (usually CTRL+N) or the New toolbar | 264 | // the New shortcut is pressed (usually CTRL+N) or the New toolbar | ||
287 | // button is clicked | 265 | // button is clicked | ||
288 | 266 | | |||
289 | slotNewGraph(); | 267 | slotNewGraph(); | ||
290 | } | 268 | } | ||
291 | 269 | | |||
292 | | ||||
293 | void KGraphEditor::optionsShowToolbar() | 270 | void KGraphEditor::optionsShowToolbar() | ||
294 | { | 271 | { | ||
295 | // this is all very cut and paste code for showing/hiding the | 272 | // this is all very cut and paste code for showing/hiding the | ||
296 | // toolbar | 273 | // toolbar | ||
297 | if (m_toolbarAction->isChecked()) | 274 | if (m_toolbarAction->isChecked()) | ||
298 | toolBar()->show(); | 275 | toolBar()->show(); | ||
299 | else | 276 | else | ||
300 | toolBar()->hide(); | 277 | toolBar()->hide(); | ||
Show All 16 Lines | |||||
317 | 294 | | |||
318 | void KGraphEditor::optionsConfigureToolbars() | 295 | void KGraphEditor::optionsConfigureToolbars() | ||
319 | { | 296 | { | ||
320 | KConfigGroup conf(KConfigGroup(KSharedConfig::openConfig(), "kgrapheditor")); | 297 | KConfigGroup conf(KConfigGroup(KSharedConfig::openConfig(), "kgrapheditor")); | ||
321 | saveMainWindowSettings(conf); | 298 | saveMainWindowSettings(conf); | ||
322 | 299 | | |||
323 | // use the standard toolbar editor | 300 | // use the standard toolbar editor | ||
324 | KEditToolBar dlg(factory()); | 301 | KEditToolBar dlg(factory()); | ||
325 | connect(&dlg, SIGNAL(newToolbarConfig()), | 302 | connect(&dlg, SIGNAL(newToolbarConfig()), this, SLOT(applyNewToolbarConfig())); | ||
326 | this, SLOT(applyNewToolbarConfig())); | | |||
327 | dlg.exec(); | 303 | dlg.exec(); | ||
328 | } | 304 | } | ||
329 | 305 | | |||
330 | void KGraphEditor::optionsConfigure() | 306 | void KGraphEditor::optionsConfigure() | ||
331 | { | 307 | { | ||
332 | //An instance of your dialog could be already created and could be cached, | 308 | // An instance of your dialog could be already created and could be cached, | ||
333 | //in which case you want to display the cached dialog instead of creating | 309 | // in which case you want to display the cached dialog instead of creating | ||
334 | //another one | 310 | // another one | ||
335 | if ( KgeConfigurationDialog::showDialog( "settings" ) ) | 311 | if (KgeConfigurationDialog::showDialog("settings")) | ||
336 | return; | 312 | return; | ||
337 | 313 | | |||
338 | //KConfigDialog didn't find an instance of this dialog, so lets create it : | 314 | // KConfigDialog didn't find an instance of this dialog, so lets create it : | ||
339 | KgeConfigurationDialog* dialog = new KgeConfigurationDialog(this, "settings", KGraphEditorSettings::self()); | 315 | KgeConfigurationDialog *dialog = new KgeConfigurationDialog(this, "settings", KGraphEditorSettings::self()); | ||
340 | 316 | | |||
341 | Ui::KGraphViewerPreferencesParsingWidget* parsingWidget = dialog->m_parsingWidget; | 317 | Ui::KGraphViewerPreferencesParsingWidget *parsingWidget = dialog->m_parsingWidget; | ||
342 | qCDebug(KGRAPHEDITOR_LOG) << KGraphEditorSettings::parsingMode(); | 318 | qCDebug(KGRAPHEDITOR_LOG) << KGraphEditorSettings::parsingMode(); | ||
343 | if (KGraphEditorSettings::parsingMode() == "external") | 319 | if (KGraphEditorSettings::parsingMode() == "external") { | ||
344 | { | | |||
345 | parsingWidget->external->setChecked(true); | 320 | parsingWidget->external->setChecked(true); | ||
346 | } | 321 | } else if (KGraphEditorSettings::parsingMode() == "internal") { | ||
347 | else if (KGraphEditorSettings::parsingMode() == "internal") | | |||
348 | { | | |||
349 | parsingWidget->internal->setChecked(true); | 322 | parsingWidget->internal->setChecked(true); | ||
350 | } | 323 | } | ||
351 | connect((QObject*)parsingWidget->external, SIGNAL(toggled(bool)), this, SLOT(slotParsingModeExternalToggled(bool)) ); | 324 | connect((QObject *)parsingWidget->external, SIGNAL(toggled(bool)), this, SLOT(slotParsingModeExternalToggled(bool))); | ||
352 | connect((QObject*)parsingWidget->internal, SIGNAL(toggled(bool)), this, SLOT(slotParsingModeInternalToggled(bool)) ); | 325 | connect((QObject *)parsingWidget->internal, SIGNAL(toggled(bool)), this, SLOT(slotParsingModeInternalToggled(bool))); | ||
353 | 326 | | |||
354 | | ||||
355 | /* KGraphViewerPreferencesReloadWidget* reloadWidget = | 327 | /* KGraphViewerPreferencesReloadWidget* reloadWidget = | ||
356 | new KGraphViewerPreferencesReloadWidget( 0, "KGraphViewer Settings" ); | 328 | new KGraphViewerPreferencesReloadWidget( 0, "KGraphViewer Settings" ); | ||
357 | if (KGraphEditorSettings::reloadOnChangeMode() == "yes") | 329 | if (KGraphEditorSettings::reloadOnChangeMode() == "yes") | ||
358 | { | 330 | { | ||
359 | reloadWidget->reloadOnChangeMode->setButton(0); | 331 | reloadWidget->reloadOnChangeMode->setButton(0); | ||
360 | } | 332 | } | ||
361 | else if (KGraphEditorSettings::reloadOnChangeMode() == "no") | 333 | else if (KGraphEditorSettings::reloadOnChangeMode() == "no") | ||
362 | { | 334 | { | ||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Line(s) | |||||
485 | // return; | 457 | // return; | ||
486 | // } | 458 | // } | ||
487 | // | 459 | // | ||
488 | // std::cerr << "emiting" << std::endl; | 460 | // std::cerr << "emiting" << std::endl; | ||
489 | // emit(settingsChanged()); | 461 | // emit(settingsChanged()); | ||
490 | // KGraphEditorSettings::save(); | 462 | // KGraphEditorSettings::save(); | ||
491 | // } | 463 | // } | ||
492 | 464 | | |||
493 | | ||||
494 | void KGraphEditor::slotURLSelected(const QUrl& url) | 465 | void KGraphEditor::slotURLSelected(const QUrl &url) | ||
495 | { | 466 | { | ||
496 | openUrl(url); | 467 | openUrl(url); | ||
497 | } | 468 | } | ||
498 | 469 | | |||
499 | void KGraphEditor::close(int index) | 470 | void KGraphEditor::close(int index) | ||
500 | { | 471 | { | ||
501 | QWidget *tab = m_widget->widget(index); | 472 | QWidget *tab = m_widget->widget(index); | ||
502 | m_openedFiles.removeAll(m_tabsFilesMap[tab]); | 473 | m_openedFiles.removeAll(m_tabsFilesMap[tab]); | ||
503 | m_widget->removeTab(index); | 474 | m_widget->removeTab(index); | ||
504 | tab->hide(); | 475 | tab->hide(); | ||
505 | KParts::ReadOnlyPart *part = m_tabsPartsMap[tab]; | 476 | KParts::ReadOnlyPart *part = m_tabsPartsMap[tab]; | ||
506 | m_manager->removePart(part); | 477 | m_manager->removePart(part); | ||
507 | m_tabsPartsMap.remove(tab); | 478 | m_tabsPartsMap.remove(tab); | ||
508 | m_tabsFilesMap.remove(tab); | 479 | m_tabsFilesMap.remove(tab); | ||
509 | delete part; part = nullptr; | 480 | delete part; | ||
481 | part = nullptr; | ||||
510 | /* delete tab; | 482 | /* delete tab; | ||
511 | tab = nullptr;*/ | 483 | tab = nullptr;*/ | ||
512 | m_closeAction->setEnabled(m_widget->count() > 0); | 484 | m_closeAction->setEnabled(m_widget->count() > 0); | ||
513 | } | 485 | } | ||
514 | 486 | | |||
515 | void KGraphEditor::close() | 487 | void KGraphEditor::close() | ||
516 | { | 488 | { | ||
517 | int currentPage = m_widget->currentIndex(); | 489 | int currentPage = m_widget->currentIndex(); | ||
518 | if (currentPage != -1) | 490 | if (currentPage != -1) { | ||
519 | { | | |||
520 | close(currentPage); | 491 | close(currentPage); | ||
521 | } | 492 | } | ||
522 | } | 493 | } | ||
523 | 494 | | |||
524 | void KGraphEditor::fileSave() | 495 | void KGraphEditor::fileSave() | ||
525 | { | 496 | { | ||
526 | QWidget* currentPage = m_widget->currentWidget(); | 497 | QWidget *currentPage = m_widget->currentWidget(); | ||
527 | if (currentPage) | 498 | if (currentPage) { | ||
528 | { | | |||
529 | emit(saveTo(QUrl(m_tabsFilesMap[currentPage]).path())); | 499 | emit(saveTo(QUrl(m_tabsFilesMap[currentPage]).path())); | ||
530 | } | 500 | } | ||
531 | } | 501 | } | ||
532 | 502 | | |||
533 | void KGraphEditor::fileSaveAs() | 503 | void KGraphEditor::fileSaveAs() | ||
534 | { | 504 | { | ||
535 | QWidget* currentPage = m_widget->currentWidget(); | 505 | QWidget *currentPage = m_widget->currentWidget(); | ||
536 | if (currentPage) | 506 | if (currentPage) { | ||
537 | { | | |||
538 | QFileDialog fileDialog(currentPage, i18n("Save current graph")); | 507 | QFileDialog fileDialog(currentPage, i18n("Save current graph")); | ||
539 | fileDialog.setMimeTypeFilters(QStringList(QStringLiteral("text/vnd.graphviz"))); | 508 | fileDialog.setMimeTypeFilters(QStringList(QStringLiteral("text/vnd.graphviz"))); | ||
540 | fileDialog.setAcceptMode(QFileDialog::AcceptSave); | 509 | fileDialog.setAcceptMode(QFileDialog::AcceptSave); | ||
541 | if (fileDialog.exec() != QFileDialog::Accepted) { | 510 | if (fileDialog.exec() != QFileDialog::Accepted) { | ||
542 | return; | 511 | return; | ||
543 | } | 512 | } | ||
544 | const QString fileName = fileDialog.selectedFiles().at(0); | 513 | const QString fileName = fileDialog.selectedFiles().at(0); | ||
545 | if (fileName.isEmpty()) { | 514 | if (fileName.isEmpty()) { | ||
546 | return; | 515 | return; | ||
547 | } | 516 | } | ||
548 | 517 | | |||
549 | m_tabsFilesMap[currentPage] = fileName; | 518 | m_tabsFilesMap[currentPage] = fileName; | ||
550 | emit(saveTo(fileName)); | 519 | emit(saveTo(fileName)); | ||
551 | } | 520 | } | ||
552 | } | 521 | } | ||
553 | 522 | | |||
554 | void KGraphEditor::newTabSelectedSlot(int index) | 523 | void KGraphEditor::newTabSelectedSlot(int index) | ||
555 | { | 524 | { | ||
556 | // qCDebug(KGRAPHEDITOR_LOG) << tab; | 525 | // qCDebug(KGRAPHEDITOR_LOG) << tab; | ||
557 | emit(hide((KParts::Part*)(m_manager->activePart()))); | 526 | emit(hide((KParts::Part *)(m_manager->activePart()))); | ||
558 | QWidget *tab = m_widget->widget(index); | 527 | QWidget *tab = m_widget->widget(index); | ||
559 | if (tab) { | 528 | if (tab) { | ||
560 | slotSetActiveGraph(m_tabsPartsMap[tab]); | 529 | slotSetActiveGraph(m_tabsPartsMap[tab]); | ||
561 | m_manager->setActivePart(m_tabsPartsMap[tab]); | 530 | m_manager->setActivePart(m_tabsPartsMap[tab]); | ||
562 | } | 531 | } | ||
563 | } | 532 | } | ||
564 | 533 | | |||
565 | void KGraphEditor::slotSetActiveGraph(KParts::ReadOnlyPart *part) | 534 | void KGraphEditor::slotSetActiveGraph(KParts::ReadOnlyPart *part) | ||
566 | { | 535 | { | ||
567 | if (m_currentPart) | 536 | if (m_currentPart) { | ||
568 | { | | |||
569 | disconnect(this,SIGNAL(prepareAddNewElement(QMap<QString,QString>)),m_currentPart,SLOT(prepareAddNewElement(QMap<QString,QString>))); | 537 | disconnect(this, SIGNAL(prepareAddNewElement(QMap<QString, QString>)), m_currentPart, SLOT(prepareAddNewElement(QMap<QString, QString>))); | ||
570 | disconnect(this,SIGNAL(prepareAddNewEdge(QMap<QString,QString>)),m_currentPart,SLOT(prepareAddNewEdge(QMap<QString,QString>))); | 538 | disconnect(this, SIGNAL(prepareAddNewEdge(QMap<QString, QString>)), m_currentPart, SLOT(prepareAddNewEdge(QMap<QString, QString>))); | ||
571 | disconnect(this,SIGNAL(saveTo(QString)),m_currentPart,SLOT(saveTo(QString))); | 539 | disconnect(this, SIGNAL(saveTo(QString)), m_currentPart, SLOT(saveTo(QString))); | ||
572 | disconnect(this,SIGNAL(removeNode(QString)),m_currentPart,SLOT(slotRemoveNode(QString))); | 540 | disconnect(this, SIGNAL(removeNode(QString)), m_currentPart, SLOT(slotRemoveNode(QString))); | ||
573 | disconnect(this,SIGNAL(addAttribute(QString)),m_currentPart,SLOT(slotAddAttribute(QString))); | 541 | disconnect(this, SIGNAL(addAttribute(QString)), m_currentPart, SLOT(slotAddAttribute(QString))); | ||
574 | disconnect(this,SIGNAL(removeAttribute(QString,QString)),m_currentPart,SLOT(slotRemoveAttribute(QString,QString))); | 542 | disconnect(this, SIGNAL(removeAttribute(QString, QString)), m_currentPart, SLOT(slotRemoveAttribute(QString, QString))); | ||
575 | disconnect(this,SIGNAL(update()),m_currentPart,SLOT(slotUpdate())); | 543 | disconnect(this, SIGNAL(update()), m_currentPart, SLOT(slotUpdate())); | ||
576 | disconnect(this,SIGNAL(selectNode(QString)),m_currentPart,SLOT(slotSelectNode(QString))); | 544 | disconnect(this, SIGNAL(selectNode(QString)), m_currentPart, SLOT(slotSelectNode(QString))); | ||
577 | disconnect(this,SIGNAL(saddNewEdge(QString,QString,QMap<QString,QString>)), | 545 | disconnect(this, SIGNAL(saddNewEdge(QString, QString, QMap<QString, QString>)), m_currentPart, SLOT(slotAddNewEdge(QString, QString, QMap<QString, QString>))); | ||
578 | m_currentPart,SLOT(slotAddNewEdge(QString,QString,QMap<QString,QString>))); | 546 | disconnect(this, SIGNAL(renameNode(QString, QString)), m_currentPart, SLOT(slotRenameNode(QString, QString))); | ||
579 | disconnect(this,SIGNAL(renameNode(QString,QString)), | | |||
580 | m_currentPart,SLOT(slotRenameNode(QString,QString))); | | |||
581 | disconnect(this,SIGNAL(setAttribute(QString,QString,QString)),m_currentPart,SLOT(slotSetAttribute(QString,QString,QString))); | 547 | disconnect(this, SIGNAL(setAttribute(QString, QString, QString)), m_currentPart, SLOT(slotSetAttribute(QString, QString, QString))); | ||
582 | } | 548 | } | ||
583 | m_currentPart = part; | 549 | m_currentPart = part; | ||
584 | m_treeWidget->clear(); | 550 | m_treeWidget->clear(); | ||
585 | if (m_currentPart == nullptr) | 551 | if (m_currentPart == nullptr) { | ||
586 | { | | |||
587 | return; | 552 | return; | ||
588 | } | 553 | } | ||
589 | connect(this,SIGNAL(prepareAddNewElement(QMap<QString,QString>)),part,SLOT(prepareAddNewElement(QMap<QString,QString>))); | 554 | connect(this, SIGNAL(prepareAddNewElement(QMap<QString, QString>)), part, SLOT(prepareAddNewElement(QMap<QString, QString>))); | ||
590 | connect(this,SIGNAL(prepareAddNewEdge(QMap<QString,QString>)),part,SLOT(prepareAddNewEdge(QMap<QString,QString>))); | 555 | connect(this, SIGNAL(prepareAddNewEdge(QMap<QString, QString>)), part, SLOT(prepareAddNewEdge(QMap<QString, QString>))); | ||
591 | connect(this,SIGNAL(saveTo(QString)),part,SLOT(saveTo(QString))); | 556 | connect(this, SIGNAL(saveTo(QString)), part, SLOT(saveTo(QString))); | ||
592 | connect(this,SIGNAL(removeNode(QString)),part,SLOT(slotRemoveNode(QString))); | 557 | connect(this, SIGNAL(removeNode(QString)), part, SLOT(slotRemoveNode(QString))); | ||
593 | connect(this,SIGNAL(addAttribute(QString)),part,SLOT(slotAddAttribute(QString))); | 558 | connect(this, SIGNAL(addAttribute(QString)), part, SLOT(slotAddAttribute(QString))); | ||
594 | connect(this,SIGNAL(removeAttribute(QString,QString)),part,SLOT(slotRemoveAttribute(QString,QString))); | 559 | connect(this, SIGNAL(removeAttribute(QString, QString)), part, SLOT(slotRemoveAttribute(QString, QString))); | ||
595 | connect(this,SIGNAL(update()),part,SLOT(slotUpdate())); | 560 | connect(this, SIGNAL(update()), part, SLOT(slotUpdate())); | ||
596 | connect(this,SIGNAL(selectNode(QString)),part,SLOT(slotSelectNode(QString))); | 561 | connect(this, SIGNAL(selectNode(QString)), part, SLOT(slotSelectNode(QString))); | ||
597 | connect( this,SIGNAL(removeElement(QString)),m_currentPart,SLOT(slotRemoveElement(QString))); | 562 | connect(this, SIGNAL(removeElement(QString)), m_currentPart, SLOT(slotRemoveElement(QString))); | ||
598 | connect(this,SIGNAL(saddNewEdge(QString,QString,QMap<QString,QString>)),m_currentPart,SLOT(slotAddNewEdge(QString,QString,QMap<QString,QString>))); | 563 | connect(this, SIGNAL(saddNewEdge(QString, QString, QMap<QString, QString>)), m_currentPart, SLOT(slotAddNewEdge(QString, QString, QMap<QString, QString>))); | ||
599 | connect(this,SIGNAL(renameNode(QString,QString)),m_currentPart,SLOT(slotRenameNode(QString,QString))); | 564 | connect(this, SIGNAL(renameNode(QString, QString)), m_currentPart, SLOT(slotRenameNode(QString, QString))); | ||
600 | connect(this,SIGNAL(setAttribute(QString,QString,QString)),m_currentPart,SLOT(slotSetAttribute(QString,QString,QString))); | 565 | connect(this, SIGNAL(setAttribute(QString, QString, QString)), m_currentPart, SLOT(slotSetAttribute(QString, QString, QString))); | ||
601 | 566 | | |||
602 | QList<QString> nodesIds;//TODO = m_currentPart->nodesIds(); | 567 | QList<QString> nodesIds; // TODO = m_currentPart->nodesIds(); | ||
603 | QList<QTreeWidgetItem *> items; | 568 | QList<QTreeWidgetItem *> items; | ||
604 | foreach (const QString& nodeId, nodesIds) | 569 | foreach (const QString &nodeId, nodesIds) { | ||
605 | { | | |||
606 | qCDebug(KGRAPHEDITOR_LOG)<< "new item " << nodeId; | 570 | qCDebug(KGRAPHEDITOR_LOG) << "new item " << nodeId; | ||
607 | QTreeWidgetItem* item = new QTreeWidgetItem((QTreeWidget*)nullptr, QStringList(nodeId)); | 571 | QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget *)nullptr, QStringList(nodeId)); | ||
608 | item->setFlags(item->flags() | Qt::ItemIsEditable); | 572 | item->setFlags(item->flags() | Qt::ItemIsEditable); | ||
609 | QMap<QString,QString> attributes;//TODO = m_currentPart->nodeAtributes(nodeId); | 573 | QMap<QString, QString> attributes; // TODO = m_currentPart->nodeAtributes(nodeId); | ||
610 | foreach (const QString& attrib, attributes.keys()) | 574 | foreach (const QString &attrib, attributes.keys()) { | ||
611 | { | 575 | if (attrib != "_draw_" && attrib != "_ldraw_") { | ||
612 | if (attrib != "_draw_" && attrib != "_ldraw_") | | |||
613 | { | | |||
614 | QStringList list(attrib); | 576 | QStringList list(attrib); | ||
615 | list << attributes[attrib]; | 577 | list << attributes[attrib]; | ||
616 | QTreeWidgetItem* child = new QTreeWidgetItem((QTreeWidget*)nullptr, list); | 578 | QTreeWidgetItem *child = new QTreeWidgetItem((QTreeWidget *)nullptr, list); | ||
617 | child->setFlags(child->flags() | Qt::ItemIsEditable); | 579 | child->setFlags(child->flags() | Qt::ItemIsEditable); | ||
618 | item->addChild(child); | 580 | item->addChild(child); | ||
619 | } | 581 | } | ||
620 | } | 582 | } | ||
621 | items.append(item); | 583 | items.append(item); | ||
622 | } | 584 | } | ||
623 | qCDebug(KGRAPHEDITOR_LOG) << "inserting"; | 585 | qCDebug(KGRAPHEDITOR_LOG) << "inserting"; | ||
624 | m_treeWidget->insertTopLevelItems(0, items); | 586 | m_treeWidget->insertTopLevelItems(0, items); | ||
625 | 587 | | |||
588 | connect(m_currentPart, SIGNAL(graphLoaded()), this, SLOT(slotGraphLoaded())); | ||||
626 | 589 | | |||
627 | connect( m_currentPart, SIGNAL(graphLoaded()), | 590 | connect(m_currentPart, SIGNAL(newNodeAdded(QString)), this, SLOT(slotNewNodeAdded(QString))); | ||
628 | this, SLOT(slotGraphLoaded()) ); | | |||
629 | 591 | | |||
630 | connect( m_currentPart, SIGNAL(newNodeAdded(QString)), | 592 | connect(m_currentPart, SIGNAL(newEdgeAdded(QString, QString)), this, SLOT(slotNewEdgeAdded(QString, QString))); | ||
631 | this, SLOT(slotNewNodeAdded(QString)) ); | | |||
632 | 593 | | |||
633 | connect( m_currentPart, SIGNAL(newEdgeAdded(QString,QString)), | 594 | connect(m_currentPart, SIGNAL(removeElement(QString)), this, SLOT(slotRemoveElement(QString))); | ||
634 | this, SLOT(slotNewEdgeAdded(QString,QString)) ); | | |||
635 | 595 | | |||
636 | connect( m_currentPart, SIGNAL(removeElement(QString)), | 596 | connect(m_currentPart, SIGNAL(selectionIs(QList<QString>, QPoint)), this, SLOT(slotSelectionIs(QList<QString>, QPoint))); | ||
637 | this, SLOT(slotRemoveElement(QString)) ); | | |||
638 | 597 | | |||
639 | connect( m_currentPart, SIGNAL(selectionIs(QList<QString>,QPoint)), | 598 | connect(m_currentPart, SIGNAL(newEdgeFinished(QString, QString, QMap<QString, QString>)), this, SLOT(slotNewEdgeFinished(QString, QString, QMap<QString, QString>))); | ||
640 | this, SLOT(slotSelectionIs(QList<QString>,QPoint)) ); | | |||
641 | 599 | | |||
642 | connect( m_currentPart, SIGNAL(newEdgeFinished(QString,QString,QMap<QString, QString>)), | 600 | connect(m_currentPart, SIGNAL(hoverEnter(QString)), this, SLOT(slotHoverEnter(QString))); | ||
643 | this, SLOT(slotNewEdgeFinished(QString,QString,QMap<QString, QString>)) ); | | |||
644 | 601 | | |||
645 | connect( m_currentPart, SIGNAL(hoverEnter(QString)), | 602 | connect(m_currentPart, SIGNAL(hoverLeave(QString)), this, SLOT(slotHoverLeave(QString))); | ||
646 | this, SLOT(slotHoverEnter(QString)) ); | | |||
647 | | ||||
648 | connect( m_currentPart, SIGNAL(hoverLeave(QString)), | | |||
649 | this, SLOT(slotHoverLeave(QString)) ); | | |||
650 | } | 603 | } | ||
651 | 604 | | |||
652 | void KGraphEditor::slotNewNodeAdded(const QString& id) | 605 | void KGraphEditor::slotNewNodeAdded(const QString &id) | ||
653 | { | 606 | { | ||
654 | qCDebug(KGRAPHEDITOR_LOG) << id; | 607 | qCDebug(KGRAPHEDITOR_LOG) << id; | ||
655 | update(); | 608 | update(); | ||
656 | } | 609 | } | ||
657 | 610 | | |||
658 | void KGraphEditor::slotNewEdgeAdded(const QString& ids, const QString& idt) | 611 | void KGraphEditor::slotNewEdgeAdded(const QString &ids, const QString &idt) | ||
659 | { | 612 | { | ||
660 | qCDebug(KGRAPHEDITOR_LOG) << ids << idt; | 613 | qCDebug(KGRAPHEDITOR_LOG) << ids << idt; | ||
661 | update(); | 614 | update(); | ||
662 | } | 615 | } | ||
663 | 616 | | |||
664 | void KGraphEditor::slotNewEdgeFinished( const QString& srcId, const QString& tgtId, const QMap<QString, QString>&attribs) | 617 | void KGraphEditor::slotNewEdgeFinished(const QString &srcId, const QString &tgtId, const QMap<QString, QString> &attribs) | ||
665 | { | 618 | { | ||
666 | qCDebug(KGRAPHEDITOR_LOG) << srcId << tgtId << attribs; | 619 | qCDebug(KGRAPHEDITOR_LOG) << srcId << tgtId << attribs; | ||
667 | emit saddNewEdge(srcId,tgtId,attribs); | 620 | emit saddNewEdge(srcId, tgtId, attribs); | ||
668 | update(); | 621 | update(); | ||
669 | } | 622 | } | ||
670 | 623 | | |||
671 | void KGraphEditor::slotGraphLoaded() | 624 | void KGraphEditor::slotGraphLoaded() | ||
672 | { | 625 | { | ||
673 | qCDebug(KGRAPHEDITOR_LOG); | 626 | qCDebug(KGRAPHEDITOR_LOG); | ||
674 | disconnect(m_treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), | 627 | disconnect(m_treeWidget, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemChanged(QTreeWidgetItem *, int))); | ||
675 | this,SLOT(slotItemChanged(QTreeWidgetItem*,int))); | 628 | disconnect(m_treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(slotItemClicked(QTreeWidgetItem *, int))); | ||
676 | disconnect(m_treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), | | |||
677 | this,SLOT(slotItemClicked(QTreeWidgetItem*,int))); | | |||
678 | 629 | | |||
679 | QList<QString> nodesIds;//TODO = m_currentPart->nodesIds(); | 630 | QList<QString> nodesIds; // TODO = m_currentPart->nodesIds(); | ||
680 | QList<QTreeWidgetItem *> items; | 631 | QList<QTreeWidgetItem *> items; | ||
681 | foreach (const QString& nodeId, nodesIds) | 632 | foreach (const QString &nodeId, nodesIds) { | ||
682 | { | | |||
683 | qCDebug(KGRAPHEDITOR_LOG)<< "item " << nodeId; | 633 | qCDebug(KGRAPHEDITOR_LOG) << "item " << nodeId; | ||
684 | QTreeWidgetItem* item; | 634 | QTreeWidgetItem *item; | ||
685 | QList<QTreeWidgetItem*> existingItems = m_treeWidget->findItems(nodeId,Qt::MatchRecursive|Qt::MatchExactly); | 635 | QList<QTreeWidgetItem *> existingItems = m_treeWidget->findItems(nodeId, Qt::MatchRecursive | Qt::MatchExactly); | ||
686 | if (existingItems.isEmpty()) | 636 | if (existingItems.isEmpty()) { | ||
687 | { | | |||
688 | item = new QTreeWidgetItem((QTreeWidget*)nullptr, QStringList(nodeId)); | 637 | item = new QTreeWidgetItem((QTreeWidget *)nullptr, QStringList(nodeId)); | ||
689 | items.append(item); | 638 | items.append(item); | ||
690 | } | 639 | } else { | ||
691 | else | | |||
692 | { | | |||
693 | item = existingItems[0]; | 640 | item = existingItems[0]; | ||
694 | } | 641 | } | ||
695 | item->setFlags(item->flags() | Qt::ItemIsEditable); | 642 | item->setFlags(item->flags() | Qt::ItemIsEditable); | ||
696 | QMap<QString,QString> attributes; //TODO = m_currentPart->nodeAtributes(nodeId); | 643 | QMap<QString, QString> attributes; // TODO = m_currentPart->nodeAtributes(nodeId); | ||
697 | QList<QString> keys = attributes.keys(); | 644 | QList<QString> keys = attributes.keys(); | ||
698 | for (int i=0; i < item->childCount();i++) | 645 | for (int i = 0; i < item->childCount(); i++) { | ||
699 | { | 646 | if (keys.contains(item->child(i)->text(0))) { | ||
700 | if (keys.contains(item->child(i)->text(0))) | | |||
701 | { | | |||
702 | item->child(i)->setText(1,attributes[item->child(i)->text(0)]); | 647 | item->child(i)->setText(1, attributes[item->child(i)->text(0)]); | ||
703 | keys.removeAll(item->child(i)->text(0)); | 648 | keys.removeAll(item->child(i)->text(0)); | ||
704 | } | 649 | } | ||
705 | } | 650 | } | ||
706 | foreach (const QString &attrib, keys) | 651 | foreach (const QString &attrib, keys) { | ||
707 | { | 652 | if (attrib != "_draw_" && attrib != "_ldraw_") { | ||
708 | if (attrib != "_draw_" && attrib != "_ldraw_") | | |||
709 | { | | |||
710 | QStringList list(attrib); | 653 | QStringList list(attrib); | ||
711 | list << attributes[attrib]; | 654 | list << attributes[attrib]; | ||
712 | QTreeWidgetItem* child = new QTreeWidgetItem((QTreeWidget*)nullptr, list); | 655 | QTreeWidgetItem *child = new QTreeWidgetItem((QTreeWidget *)nullptr, list); | ||
713 | child->setFlags(child->flags() | Qt::ItemIsEditable); | 656 | child->setFlags(child->flags() | Qt::ItemIsEditable); | ||
714 | item->addChild(child); | 657 | item->addChild(child); | ||
715 | } | 658 | } | ||
716 | } | 659 | } | ||
717 | } | 660 | } | ||
718 | qCDebug(KGRAPHEDITOR_LOG) << "inserting"; | 661 | qCDebug(KGRAPHEDITOR_LOG) << "inserting"; | ||
719 | m_treeWidget->insertTopLevelItems(0, items); | 662 | m_treeWidget->insertTopLevelItems(0, items); | ||
720 | connect(m_treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), | 663 | connect(m_treeWidget, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemChanged(QTreeWidgetItem *, int))); | ||
721 | this,SLOT(slotItemChanged(QTreeWidgetItem*,int))); | 664 | connect(m_treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(slotItemClicked(QTreeWidgetItem *, int))); | ||
722 | connect(m_treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), | | |||
723 | this,SLOT(slotItemClicked(QTreeWidgetItem*,int))); | | |||
724 | } | 665 | } | ||
725 | 666 | | |||
726 | void KGraphEditor::slotItemChanged ( QTreeWidgetItem * item, int column ) | 667 | void KGraphEditor::slotItemChanged(QTreeWidgetItem *item, int column) | ||
727 | { | 668 | { | ||
728 | qCDebug(KGRAPHEDITOR_LOG) ; | 669 | qCDebug(KGRAPHEDITOR_LOG); | ||
729 | /* values column */ | 670 | /* values column */ | ||
730 | if (column == 0) | 671 | if (column == 0) { | ||
731 | { | | |||
732 | QString oldNodeName = m_currentTreeWidgetItemText; | 672 | QString oldNodeName = m_currentTreeWidgetItemText; | ||
733 | QString newNodeName = item->text(0); | 673 | QString newNodeName = item->text(0); | ||
734 | emit(renameNode(oldNodeName,newNodeName)); | 674 | emit(renameNode(oldNodeName, newNodeName)); | ||
735 | } | 675 | } else if (column == 1) { | ||
736 | else if (column == 1) | | |||
737 | { | | |||
738 | /* there is a parent ; it is an attribute line */ | 676 | /* there is a parent ; it is an attribute line */ | ||
739 | if (item->parent()) | 677 | if (item->parent()) { | ||
740 | { | | |||
741 | QString nodeLabel = item->parent()->text(0); | 678 | QString nodeLabel = item->parent()->text(0); | ||
742 | QString attributeName = item->text(0); | 679 | QString attributeName = item->text(0); | ||
743 | QString attributeValue = item->text(1); | 680 | QString attributeValue = item->text(1); | ||
744 | emit (setAttribute(nodeLabel,attributeName,attributeValue)); | 681 | emit(setAttribute(nodeLabel, attributeName, attributeValue)); | ||
745 | } | 682 | } | ||
746 | } | 683 | } | ||
747 | emit update(); | 684 | emit update(); | ||
748 | } | 685 | } | ||
749 | 686 | | |||
750 | void KGraphEditor::slotItemClicked ( QTreeWidgetItem * item, int column ) | 687 | void KGraphEditor::slotItemClicked(QTreeWidgetItem *item, int column) | ||
751 | { | 688 | { | ||
752 | qCDebug(KGRAPHEDITOR_LOG) << column; | 689 | qCDebug(KGRAPHEDITOR_LOG) << column; | ||
753 | m_currentTreeWidgetItemText = item->text(0); | 690 | m_currentTreeWidgetItemText = item->text(0); | ||
754 | 691 | | |||
755 | QString nodeName = item->parent() ? | 692 | QString nodeName = item->parent() ? item->parent()->text(0) : item->text(0); | ||
756 | item->parent()->text(0) : | | |||
757 | item->text(0); | | |||
758 | emit selectNode(nodeName); | 693 | emit selectNode(nodeName); | ||
759 | } | 694 | } | ||
760 | 695 | | |||
761 | void KGraphEditor::slotEditNewVertex() | 696 | void KGraphEditor::slotEditNewVertex() | ||
762 | { | 697 | { | ||
763 | if (m_currentPart == nullptr) | 698 | if (m_currentPart == nullptr) { | ||
764 | { | | |||
765 | qCDebug(KGRAPHEDITOR_LOG) << "new vertex: no part selected"; | 699 | qCDebug(KGRAPHEDITOR_LOG) << "new vertex: no part selected"; | ||
766 | return; | 700 | return; | ||
767 | } | 701 | } | ||
768 | qCDebug(KGRAPHEDITOR_LOG) << "new vertex"; | 702 | qCDebug(KGRAPHEDITOR_LOG) << "new vertex"; | ||
769 | emit(prepareAddNewElement(m_newElementAttributes)); | 703 | emit(prepareAddNewElement(m_newElementAttributes)); | ||
770 | } | 704 | } | ||
771 | 705 | | |||
772 | void KGraphEditor::slotEditNewEdge() | 706 | void KGraphEditor::slotEditNewEdge() | ||
773 | { | 707 | { | ||
774 | if (m_currentPart == nullptr) | 708 | if (m_currentPart == nullptr) { | ||
775 | { | | |||
776 | qCDebug(KGRAPHEDITOR_LOG) << "new edge: no part selected"; | 709 | qCDebug(KGRAPHEDITOR_LOG) << "new edge: no part selected"; | ||
777 | return; | 710 | return; | ||
778 | } | 711 | } | ||
779 | qCDebug(KGRAPHEDITOR_LOG) << "new edge"; | 712 | qCDebug(KGRAPHEDITOR_LOG) << "new edge"; | ||
780 | emit(prepareAddNewEdge(m_newElementAttributes)); | 713 | emit(prepareAddNewEdge(m_newElementAttributes)); | ||
781 | } | 714 | } | ||
782 | 715 | | |||
783 | void KGraphEditor::slotRemoveNode(const QString& nodeName) | 716 | void KGraphEditor::slotRemoveNode(const QString &nodeName) | ||
784 | { | 717 | { | ||
785 | emit removeNode(nodeName); | 718 | emit removeNode(nodeName); | ||
786 | emit update(); | 719 | emit update(); | ||
787 | } | 720 | } | ||
788 | 721 | | |||
789 | void KGraphEditor::slotAddAttribute(const QString& attribName) | 722 | void KGraphEditor::slotAddAttribute(const QString &attribName) | ||
790 | { | 723 | { | ||
791 | emit addAttribute(attribName); | 724 | emit addAttribute(attribName); | ||
792 | emit update(); | 725 | emit update(); | ||
793 | } | 726 | } | ||
794 | 727 | | |||
795 | void KGraphEditor::slotRemoveAttribute(const QString& nodeName, const QString& attribName) | 728 | void KGraphEditor::slotRemoveAttribute(const QString &nodeName, const QString &attribName) | ||
796 | { | 729 | { | ||
797 | emit removeAttribute(nodeName,attribName); | 730 | emit removeAttribute(nodeName, attribName); | ||
798 | emit update(); | 731 | emit update(); | ||
799 | } | 732 | } | ||
800 | 733 | | |||
801 | void KGraphEditor::slotNewElementItemChanged(QTreeWidgetItem* item ,int column) | 734 | void KGraphEditor::slotNewElementItemChanged(QTreeWidgetItem *item, int column) | ||
802 | { | 735 | { | ||
803 | qCDebug(KGRAPHEDITOR_LOG); | 736 | qCDebug(KGRAPHEDITOR_LOG); | ||
804 | if (column == 0) | 737 | if (column == 0) { | ||
805 | { | | |||
806 | qCWarning(KGRAPHEDITOR_LOG) << "Item id change not handled"; | 738 | qCWarning(KGRAPHEDITOR_LOG) << "Item id change not handled"; | ||
807 | return; | 739 | return; | ||
808 | } | 740 | } else if (column == 1) { | ||
809 | else if (column == 1) | | |||
810 | { | | |||
811 | m_newElementAttributes[item->text(0)] = item->text(1); | 741 | m_newElementAttributes[item->text(0)] = item->text(1); | ||
812 | } | 742 | } else { | ||
813 | else | | |||
814 | { | | |||
815 | qCWarning(KGRAPHEDITOR_LOG) << "Unknown column" << column; | 743 | qCWarning(KGRAPHEDITOR_LOG) << "Unknown column" << column; | ||
816 | return; | 744 | return; | ||
817 | } | 745 | } | ||
818 | } | 746 | } | ||
819 | 747 | | |||
820 | void KGraphEditor::slotAddNewElementAttribute(const QString& attrib) | 748 | void KGraphEditor::slotAddNewElementAttribute(const QString &attrib) | ||
821 | { | 749 | { | ||
822 | m_newElementAttributes[attrib] = QString(); | 750 | m_newElementAttributes[attrib] = QString(); | ||
823 | } | 751 | } | ||
824 | 752 | | |||
825 | void KGraphEditor::slotRemoveNewElementAttribute(const QString& attrib) | 753 | void KGraphEditor::slotRemoveNewElementAttribute(const QString &attrib) | ||
826 | { | 754 | { | ||
827 | m_newElementAttributes.remove(attrib); | 755 | m_newElementAttributes.remove(attrib); | ||
828 | } | 756 | } | ||
829 | 757 | | |||
830 | void KGraphEditor::slotRemoveElement(const QString& id) | 758 | void KGraphEditor::slotRemoveElement(const QString &id) | ||
831 | { | 759 | { | ||
832 | qCDebug(KGRAPHEDITOR_LOG) << id; | 760 | qCDebug(KGRAPHEDITOR_LOG) << id; | ||
833 | m_treeWidget->slotRemoveElement(id); | 761 | m_treeWidget->slotRemoveElement(id); | ||
834 | emit(removeElement(id)); | 762 | emit(removeElement(id)); | ||
835 | } | 763 | } | ||
836 | 764 | | |||
837 | void KGraphEditor::slotSelectionIs(const QList<QString>& elements , const QPoint& p) | 765 | void KGraphEditor::slotSelectionIs(const QList<QString> &elements, const QPoint &p) | ||
838 | { | 766 | { | ||
839 | qCDebug(KGRAPHEDITOR_LOG); | 767 | qCDebug(KGRAPHEDITOR_LOG); | ||
840 | Q_UNUSED(p); | 768 | Q_UNUSED(p); | ||
841 | QList<QTreeWidgetItem*> items = m_treeWidget->selectedItems(); | 769 | QList<QTreeWidgetItem *> items = m_treeWidget->selectedItems(); | ||
842 | foreach (QTreeWidgetItem* item, items) | 770 | foreach (QTreeWidgetItem *item, items) { | ||
843 | { | | |||
844 | item->setSelected(false); | 771 | item->setSelected(false); | ||
845 | } | 772 | } | ||
846 | foreach (const QString &elementName, elements) | 773 | foreach (const QString &elementName, elements) { | ||
847 | { | | |||
848 | QList<QTreeWidgetItem*> items = m_treeWidget->findItems(elementName,Qt::MatchExactly,0); | 774 | QList<QTreeWidgetItem *> items = m_treeWidget->findItems(elementName, Qt::MatchExactly, 0); | ||
849 | foreach (QTreeWidgetItem* item, items) | 775 | foreach (QTreeWidgetItem *item, items) { | ||
850 | { | | |||
851 | item->setSelected(true); | 776 | item->setSelected(true); | ||
852 | } | 777 | } | ||
853 | } | 778 | } | ||
854 | } | 779 | } | ||
855 | 780 | | |||
856 | void KGraphEditor::slotParsingModeExternalToggled(bool value) | 781 | void KGraphEditor::slotParsingModeExternalToggled(bool value) | ||
857 | { | 782 | { | ||
858 | if (value) | 783 | if (value) { | ||
859 | { | | |||
860 | KGraphEditorSettings::setParsingMode("external"); | 784 | KGraphEditorSettings::setParsingMode("external"); | ||
861 | } | 785 | } | ||
862 | // qCDebug(KGRAPHEDITOR_LOG) << "emiting"; | 786 | // qCDebug(KGRAPHEDITOR_LOG) << "emiting"; | ||
863 | // emit(settingsChanged()); | 787 | // emit(settingsChanged()); | ||
864 | KGraphEditorSettings::self()->save(); | 788 | KGraphEditorSettings::self()->save(); | ||
865 | } | 789 | } | ||
866 | 790 | | |||
867 | void KGraphEditor::slotParsingModeInternalToggled(bool value) | 791 | void KGraphEditor::slotParsingModeInternalToggled(bool value) | ||
868 | { | 792 | { | ||
869 | if (value) | 793 | if (value) { | ||
870 | { | | |||
871 | KGraphEditorSettings::setParsingMode("internal"); | 794 | KGraphEditorSettings::setParsingMode("internal"); | ||
872 | } | 795 | } | ||
873 | // qCDebug(KGRAPHEDITOR_LOG) << "emiting"; | 796 | // qCDebug(KGRAPHEDITOR_LOG) << "emiting"; | ||
874 | // emit(settingsChanged()); | 797 | // emit(settingsChanged()); | ||
875 | KGraphEditorSettings::self()->save(); | 798 | KGraphEditorSettings::self()->save(); | ||
876 | } | 799 | } | ||
877 | 800 | | |||
878 | void KGraphEditor::slotHoverEnter(const QString& id) | 801 | void KGraphEditor::slotHoverEnter(const QString &id) | ||
879 | { | 802 | { | ||
880 | qCDebug(KGRAPHEDITOR_LOG) << id; | 803 | qCDebug(KGRAPHEDITOR_LOG) << id; | ||
881 | statusBar()->showMessage(id); | 804 | statusBar()->showMessage(id); | ||
882 | } | 805 | } | ||
883 | 806 | | |||
884 | void KGraphEditor::slotHoverLeave(const QString& id) | 807 | void KGraphEditor::slotHoverLeave(const QString &id) | ||
885 | { | 808 | { | ||
886 | qCDebug(KGRAPHEDITOR_LOG) << id; | 809 | qCDebug(KGRAPHEDITOR_LOG) << id; | ||
887 | statusBar()->showMessage(""); | 810 | statusBar()->showMessage(""); | ||
888 | } | 811 | } |