summaryrefslogtreecommitdiffstats
path: root/pokemodr/models/SoundModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemodr/models/SoundModel.cpp')
-rw-r--r--pokemodr/models/SoundModel.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/pokemodr/models/SoundModel.cpp b/pokemodr/models/SoundModel.cpp
index 739ac34c..e0647526 100644
--- a/pokemodr/models/SoundModel.cpp
+++ b/pokemodr/models/SoundModel.cpp
@@ -18,6 +18,9 @@
// Header include
#include "SoundModel.h"
+// Model includes
+#include "GroupModel.h"
+
// PokeModr includes
#include "../SoundUI.h"
@@ -28,6 +31,9 @@
// Qt includes
#include <QFile>
+// KDE includes
+#include <KMenu>
+
SoundModel::SoundModel(BaseModel* parent, Sound* sound) :
ObjectModel(parent, sound)
{
@@ -52,6 +58,12 @@ QVariant SoundModel::data(int role) const
QWidget* widget = new SoundUI(static_cast<Sound*>(m_object), NULL);
return QVariant::fromValue(widget);
}
+ else if (role == BaseModel::ContextMenuRole)
+ {
+ KMenu* menu = new KMenu;
+ menu->addAction("Delete Sound", this, SLOT(deleteSelf()));
+ return QVariant::fromValue(static_cast<void*>(menu));
+ }
return ObjectModel::data(role);
}
@@ -76,3 +88,8 @@ bool SoundModel::setData(const QVariant& value, int role)
}
return false;
}
+
+void SoundModel::deleteSelf()
+{
+// static_cast<GroupModel*>(m_parent)->deleteObject(this);
+}