Changeset View
Changeset View
Standalone View
Standalone View
plugins/externalscript/externalscriptview.cpp
Show All 21 Lines | |||||
22 | 22 | | |||
23 | #include "externalscriptplugin.h" | 23 | #include "externalscriptplugin.h" | ||
24 | #include "externalscriptitem.h" | 24 | #include "externalscriptitem.h" | ||
25 | #include "editexternalscript.h" | 25 | #include "editexternalscript.h" | ||
26 | 26 | | |||
27 | #include <QAction> | 27 | #include <QAction> | ||
28 | #include <QMenu> | 28 | #include <QMenu> | ||
29 | #include <QMouseEvent> | 29 | #include <QMouseEvent> | ||
30 | #include <QPointer> | ||||
30 | #include <QSortFilterProxyModel> | 31 | #include <QSortFilterProxyModel> | ||
31 | 32 | | |||
32 | #include <KLocalizedString> | 33 | #include <KLocalizedString> | ||
33 | #include <KMessageBox> | 34 | #include <KMessageBox> | ||
34 | 35 | | |||
35 | 36 | | |||
36 | ExternalScriptView::ExternalScriptView( ExternalScriptPlugin* plugin, QWidget* parent ) | 37 | ExternalScriptView::ExternalScriptView( ExternalScriptPlugin* plugin, QWidget* parent ) | ||
37 | : QWidget( parent ), m_plugin( plugin ) | 38 | : QWidget( parent ), m_plugin( plugin ) | ||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 120 | // const bool singleClick = KGlobalSettings::singleClick(); | |||
130 | } | 131 | } | ||
131 | } | 132 | } | ||
132 | return QObject::eventFilter( obj, e ); | 133 | return QObject::eventFilter( obj, e ); | ||
133 | } | 134 | } | ||
134 | 135 | | |||
135 | void ExternalScriptView::addScript() | 136 | void ExternalScriptView::addScript() | ||
136 | { | 137 | { | ||
137 | ExternalScriptItem* item = new ExternalScriptItem; | 138 | ExternalScriptItem* item = new ExternalScriptItem; | ||
138 | EditExternalScript dlg( item, this ); | 139 | QPointer<EditExternalScript> dlg = new EditExternalScript( item, this ); | ||
139 | int ret = dlg.exec(); | 140 | if ( dlg->exec() == QDialog::Accepted) { | ||
140 | if ( ret == QDialog::Accepted) { | | |||
141 | m_plugin->model()->appendRow( item ); | 141 | m_plugin->model()->appendRow( item ); | ||
142 | } else { | 142 | } else { | ||
143 | delete item; | 143 | delete item; | ||
144 | } | 144 | } | ||
145 | | ||||
146 | delete dlg; | ||||
145 | } | 147 | } | ||
146 | 148 | | |||
147 | void ExternalScriptView::removeScript() | 149 | void ExternalScriptView::removeScript() | ||
148 | { | 150 | { | ||
149 | ExternalScriptItem* item = currentItem(); | 151 | ExternalScriptItem* item = currentItem(); | ||
150 | if ( !item ) { | 152 | if ( !item ) { | ||
151 | return; | 153 | return; | ||
152 | } | 154 | } | ||
Show All 12 Lines | |||||
165 | 167 | | |||
166 | void ExternalScriptView::editScript() | 168 | void ExternalScriptView::editScript() | ||
167 | { | 169 | { | ||
168 | ExternalScriptItem* item = currentItem(); | 170 | ExternalScriptItem* item = currentItem(); | ||
169 | if ( !item ) { | 171 | if ( !item ) { | ||
170 | return; | 172 | return; | ||
171 | } | 173 | } | ||
172 | 174 | | |||
173 | EditExternalScript dlg( item, this ); | 175 | QPointer<EditExternalScript> dlg = new EditExternalScript( item, this ); | ||
174 | int ret = dlg.exec(); | 176 | if (dlg->exec() == QDialog::Accepted) { | ||
175 | if (ret == QDialog::Accepted) { | | |||
176 | item->save(); | 177 | item->save(); | ||
177 | } | 178 | } | ||
179 | | ||||
180 | delete dlg; | ||||
178 | } | 181 | } | ||
179 | 182 | | |||
180 | 183 | | |||
181 | // kate: indent-mode cstyle; space-indent on; indent-width 2; replace-tabs on; | 184 | // kate: indent-mode cstyle; space-indent on; indent-width 2; replace-tabs on; |