Changeset View
Changeset View
Standalone View
Standalone View
stage/part/KPrSlidesSorterDocumentModel.cpp
Show All 40 Lines | |||||
41 | #include <QApplication> | 41 | #include <QApplication> | ||
42 | #include <QMenu> | 42 | #include <QMenu> | ||
43 | 43 | | |||
44 | KPrSlidesSorterDocumentModel::KPrSlidesSorterDocumentModel(KPrViewModeSlidesSorter *viewModeSlidesSorter, QWidget *parent, KoPADocument *document) | 44 | KPrSlidesSorterDocumentModel::KPrSlidesSorterDocumentModel(KPrViewModeSlidesSorter *viewModeSlidesSorter, QWidget *parent, KoPADocument *document) | ||
45 | : QAbstractListModel(parent) | 45 | : QAbstractListModel(parent) | ||
46 | , m_viewModeSlidesSorter(viewModeSlidesSorter) | 46 | , m_viewModeSlidesSorter(viewModeSlidesSorter) | ||
47 | { | 47 | { | ||
48 | setDocument(document); | 48 | setDocument(document); | ||
49 | setSupportedDragActions(Qt::MoveAction); | 49 | } | ||
50 | | ||||
51 | Qt::DropActions KPrSlidesSorterDocumentModel::supportedDragActions() const | ||||
52 | { | ||||
53 | return Qt::MoveAction; | ||||
50 | } | 54 | } | ||
51 | 55 | | |||
52 | KPrSlidesSorterDocumentModel::~KPrSlidesSorterDocumentModel() | 56 | KPrSlidesSorterDocumentModel::~KPrSlidesSorterDocumentModel() | ||
53 | { | 57 | { | ||
54 | } | 58 | } | ||
55 | 59 | | |||
56 | void KPrSlidesSorterDocumentModel::setDocument(KoPADocument *document) | 60 | void KPrSlidesSorterDocumentModel::setDocument(KoPADocument *document) | ||
57 | { | 61 | { | ||
62 | beginResetModel(); | ||||
58 | m_document = document; | 63 | m_document = document; | ||
64 | endResetModel(); | ||||
59 | if (m_document) { | 65 | if (m_document) { | ||
60 | connect(m_document, SIGNAL(pageAdded(KoPAPageBase*)), this, SLOT(update())); | 66 | connect(m_document, SIGNAL(pageAdded(KoPAPageBase*)), this, SLOT(update())); | ||
61 | connect(m_document, SIGNAL(pageRemoved(KoPAPageBase*)), this, SLOT(update())); | 67 | connect(m_document, SIGNAL(pageRemoved(KoPAPageBase*)), this, SLOT(update())); | ||
62 | connect(m_document, SIGNAL(update(KoPAPageBase*)), this, SLOT(update())); | 68 | connect(m_document, SIGNAL(update(KoPAPageBase*)), this, SLOT(update())); | ||
63 | } | 69 | } | ||
64 | | ||||
65 | reset(); | | |||
66 | } | 70 | } | ||
67 | 71 | | |||
68 | QModelIndex KPrSlidesSorterDocumentModel::index(int row, int column, const QModelIndex &parent) const | 72 | QModelIndex KPrSlidesSorterDocumentModel::index(int row, int column, const QModelIndex &parent) const | ||
69 | { | 73 | { | ||
70 | if(!m_document) { | 74 | if(!m_document) { | ||
71 | return QModelIndex(); | 75 | return QModelIndex(); | ||
72 | } | 76 | } | ||
73 | 77 | | |||
▲ Show 20 Lines • Show All 358 Lines • Show Last 20 Lines |