diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/pluginlistsortproxy.cpp | 53 | ||||
| -rw-r--r-- | src/pluginlistsortproxy.h | 3 |
2 files changed, 13 insertions, 43 deletions
diff --git a/src/pluginlistsortproxy.cpp b/src/pluginlistsortproxy.cpp index 02d99b36..4f840f52 100644 --- a/src/pluginlistsortproxy.cpp +++ b/src/pluginlistsortproxy.cpp @@ -19,9 +19,12 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "pluginlistsortproxy.h"
#include "pluginlist.h"
+#include "messagedialog.h"
#include <QMenu>
#include <QCheckBox>
+#include <QApplication>
#include <QWidgetAction>
+#include <QTreeView>
PluginListSortProxy::PluginListSortProxy(QObject *parent)
@@ -35,16 +38,7 @@ PluginListSortProxy::PluginListSortProxy(QObject *parent) }
-unsigned int PluginListSortProxy::getEnabledColumns() const
-{
- unsigned int result = 0;
- for (int i = 0; i <= PluginList::COL_LASTCOLUMN; ++i) {
- if (m_EnabledColumns.test(i)) {
- result |= 1 << i;
- }
- }
- return result;
-}
+
void PluginListSortProxy::setEnabledColumns(unsigned int columns)
@@ -60,42 +54,14 @@ void PluginListSortProxy::setEnabledColumns(unsigned int columns) Qt::ItemFlags PluginListSortProxy::flags(const QModelIndex &modelIndex) const
{
Qt::ItemFlags flags = sourceModel()->flags(mapToSource(modelIndex));
- if (sortColumn() == PluginList::COL_NAME) {
+/* if (sortColumn() == PluginList::COL_NAME) {
flags &= ~Qt::ItemIsDragEnabled;
- }
+ }*/
return flags;
}
-void PluginListSortProxy::displayColumnSelection(const QPoint &pos)
-{
- QMenu menu;
-
- for (int i = 0; i <= PluginList::COL_LASTCOLUMN; ++i) {
- QCheckBox *checkBox = new QCheckBox(&menu);
- checkBox->setText(PluginList::getColumnName(i));
- checkBox->setChecked(m_EnabledColumns.test(i) ? Qt::Checked : Qt::Unchecked);
- QWidgetAction *checkableAction = new QWidgetAction(&menu);
- checkableAction->setDefaultWidget(checkBox);
- menu.addAction(checkableAction);
- }
- menu.exec(pos);
- int i = 0;
- emit layoutAboutToBeChanged();
- m_EnabledColumns.reset();
- foreach (const QAction *action, menu.actions()) {
- const QWidgetAction *widgetAction = qobject_cast<const QWidgetAction*>(action);
- if (widgetAction != NULL) {
- const QCheckBox *checkBox = qobject_cast<const QCheckBox*>(widgetAction->defaultWidget());
- if (checkBox != NULL) {
- m_EnabledColumns.set(i, checkBox->checkState() == Qt::Checked);
- }
- }
- ++i;
- }
- emit layoutChanged();
-}
void PluginListSortProxy::updateFilter(const QString &filter)
@@ -134,6 +100,13 @@ bool PluginListSortProxy::lessThan(const QModelIndex &left, bool PluginListSortProxy::dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent)
{
+ if ((sortColumn() != PluginList::COL_PRIORITY)
+ && (sortColumn() != PluginList::COL_MODINDEX)) {
+ QWidget *wid = qApp->activeWindow()->findChild<QTreeView*>("espList");
+ MessageDialog::showMessage(tr("Drag&Drop is only supported when sorting by priority or mod index"), wid);
+ return false;
+ }
+
if ((row == -1) && (column == -1)) {
return this->sourceModel()->dropMimeData(data, action, -1, -1, mapToSource(parent));
}
diff --git a/src/pluginlistsortproxy.h b/src/pluginlistsortproxy.h index bc8a005b..89f60e70 100644 --- a/src/pluginlistsortproxy.h +++ b/src/pluginlistsortproxy.h @@ -40,8 +40,6 @@ public: explicit PluginListSortProxy(QObject *parent = 0);
- unsigned int getEnabledColumns() const;
-
void setEnabledColumns(unsigned int columns);
virtual Qt::ItemFlags flags(const QModelIndex &modelIndex) const;
@@ -50,7 +48,6 @@ public: public slots:
- void displayColumnSelection(const QPoint &pos);
void updateFilter(const QString &filter);
protected:
|
