diff options
| author | 2016-04-19 12:31:56 -0400 | |
|---|---|---|
| committer | 2016-04-19 12:31:56 -0400 | |
| commit | 056c250519a569339892c0b06e4a0600036baf42 (patch) | |
| tree | 8da6d85f7fb878545c510f0e286d58fd6617976d /src/modules/popupeditor/PopupEditorWindow.cpp | |
| parent | libkviproxydb: I still hate macros (diff) | |
| download | KVIrc-056c250519a569339892c0b06e4a0600036baf42.tar.gz KVIrc-056c250519a569339892c0b06e4a0600036baf42.tar.bz2 KVIrc-056c250519a569339892c0b06e4a0600036baf42.zip | |
PopupEditorWindow: Additional cleanup
Diffstat (limited to 'src/modules/popupeditor/PopupEditorWindow.cpp')
| -rw-r--r-- | src/modules/popupeditor/PopupEditorWindow.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/modules/popupeditor/PopupEditorWindow.cpp b/src/modules/popupeditor/PopupEditorWindow.cpp index 0a936c91c..5f20c64df 100644 --- a/src/modules/popupeditor/PopupEditorWindow.cpp +++ b/src/modules/popupeditor/PopupEditorWindow.cpp @@ -275,8 +275,8 @@ SinglePopupEditor::SinglePopupEditor(QWidget * par) SinglePopupEditor::~SinglePopupEditor() { - if(m_pClipboard)delete m_pClipboard; - if(m_pTestPopup)delete m_pTestPopup; + delete m_pClipboard; + delete m_pTestPopup; KviScriptEditor::destroyInstance(m_pEditor); } @@ -370,7 +370,7 @@ void SinglePopupEditor::customContextMenuRequested(const QPoint &pos) m_pContextPopup->clear(); - //PopupTreeWidgetItem * parentMenu = 0; + //PopupTreeWidgetItem * parentMenu = nullptr; bool bIsMenu = false; if(it) @@ -627,19 +627,17 @@ void SinglePopupEditor::contextCut() if(!m_pLastSelectedItem)return; contextCopy(); - PopupTreeWidgetItem * it = m_pLastSelectedItem; + delete m_pLastSelectedItem; m_pLastSelectedItem = nullptr; - delete it; - if(!m_pLastSelectedItem)selectionChanged(); + selectionChanged(); } void SinglePopupEditor::contextRemove() { if(!m_pLastSelectedItem)return; - PopupTreeWidgetItem * it = m_pLastSelectedItem; + delete m_pLastSelectedItem; m_pLastSelectedItem = nullptr; - delete it; selectionChanged(); } @@ -1065,8 +1063,8 @@ PopupEditorWidget::PopupEditorWidget(QWidget * par) m_pContextPopup = new QMenu(this); m_pEmptyContextPopup = new QMenu(this); - spl->setStretchFactor (0,20); - spl->setStretchFactor (1,80); + spl->setStretchFactor(0,20); + spl->setStretchFactor(1,80); currentItemChanged(0,0); } @@ -1226,7 +1224,7 @@ void PopupEditorWidget::exportPopups(bool bSelectedOnly) for(int i=0; i<topcount;i++) { MenuTreeWidgetItem * it = (MenuTreeWidgetItem *)m_pTreeWidget->topLevelItem(i); - if ( (it->isSelected()) || (bSelectedOnly == true) ) + if((it->isSelected()) || (bSelectedOnly == true) ) { count++; QString tmp; @@ -1235,7 +1233,7 @@ void PopupEditorWidget::exportPopups(bool bSelectedOnly) out += "\n"; } } - if (!count && !bSelectedOnly) + if(!count && !bSelectedOnly) return; QString szName = QDir::homePath(); @@ -1256,10 +1254,9 @@ void PopupEditorWidget::removeCurrentPopup() { if(m_pLastEditedItem) { - MenuTreeWidgetItem * it = m_pLastEditedItem; + delete m_pLastEditedItem; m_pLastEditedItem = nullptr; - delete it; - if(!m_pLastEditedItem)currentItemChanged(0,0); + currentItemChanged(0,0); } } @@ -1273,7 +1270,7 @@ void PopupEditorWidget::newPopup() void PopupEditorWidget::saveLastEditedItem() { - if(m_pLastEditedItem == 0)return; + if(!m_pLastEditedItem)return; KviKvsPopupMenu * m = m_pEditor->getMenu(); QString tmp = m->popupName(); |
