[Kst] [Bug 124090] Add plot manager to Kst
Andrew Walker
arwalker at sumusltd.com
Mon May 8 20:41:42 CEST 2006
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=124090
------- Additional Comments From arwalker sumusltd com 2006-05-08 20:41 -------
SVN commit 538741 by arwalker:
CCBUG:124090 Add context menu for expanding and collapsing listview items
M +70 -2 kstviewmanager_i.cpp
M +10 -3 kstviewmanager_i.h
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewmanager_i.cpp #538740:538741
@ -352,6 +352,15 @
_vm->Delete->setEnabled(true);
}
+void KstViewObjectItem::openChildren(bool open) {
+ for (QListViewItem *qi = firstChild(); qi; qi = qi->nextSibling()) {
+ KstViewObjectItem *oi = static_cast<KstViewObjectItem*>(qi);
+
+ oi->openChildren(open);
+ qi->setOpen(open);
+ }
+}
+
// ==============================================
KstViewManagerI::KstViewManagerI(KstDoc *in_doc, QWidget* parent, const char* name, bool modal, WFlags fl)
@ -569,7 +578,6 @
}
}
-
void KstViewManagerI::cleanupCustom_I() {
QListViewItem *qi = ViewView->selectedItem();
KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
@ -584,7 +592,6 @
}
}
-
void KstViewManagerI::select_I() {
QListViewItem *qi = ViewView->selectedItem();
KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
@ -621,6 +628,47 @
}
}
+void KstViewManagerI::open() {
+ QListViewItem *qi = ViewView->selectedItem();
+
+ if (qi) {
+ qi->setOpen(true);
+ }
+}
+
+void KstViewManagerI::close() {
+ QListViewItem *qi = ViewView->selectedItem();
+
+ if (qi) {
+ qi->setOpen(false);
+ }
+}
+
+void KstViewManagerI::open(bool open) {
+ QListViewItem *qi = ViewView->selectedItem();
+ KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
+
+ if (koi) {
+ koi->openChildren(open);
+ qi->setOpen(open);
+ } else {
+ for (qi = ViewView->firstChild(); qi; qi = qi->nextSibling()) {
+ koi = static_cast<KstViewObjectItem*>(qi);
+
+ koi->openChildren(open);
+ qi->setOpen(open);
+ }
+ }
+}
+
+void KstViewManagerI::openAll() {
+ open(true);
+}
+
+void KstViewManagerI::closeAll() {
+ open(false);
+}
+
void KstViewManagerI::contextMenu(QListViewItem *i, const QPoint& p, int col) {
Q_UNUSED(col)
@ -655,7 +703,27 @
id = menu->insertItem(i18n("&Remove"), this, SLOT(delete_I()));
}
+ menu->insertSeparator();
+ id = menu->insertItem(i18n("Expand"), this, SLOT(open()));
+ menu->setItemEnabled(id, !koi->isOpen());
+ id = menu->insertItem(i18n("Collapse"), this, SLOT(close()));
+ menu->setItemEnabled(id, koi->isOpen());
+ id = menu->insertItem(i18n("Expand All"), this, SLOT(openAll()));
+ menu->setItemEnabled(id, koi->firstChild());
+ id = menu->insertItem(i18n("Collapse All"), this, SLOT(closeAll()));
+ menu->setItemEnabled(id, koi->firstChild());
+
menu->popup(p);
+ } else {
+ KPopupMenu *menu = new KPopupMenu(this);
+ int id;
+
+ id = menu->insertItem(i18n("Expand All"), this, SLOT(openAll()));
+ menu->setItemEnabled(id, ViewView->firstChild());
+ id = menu->insertItem(i18n("Collapse All"), this, SLOT(closeAll()));
+ menu->setItemEnabled(id, ViewView->firstChild());
+
+ menu->popup(p);
}
}
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewmanager_i.h #538740:538741
@ -51,7 +51,8 @
KstViewObjectPtr viewObject(KstViewWindow **win) const;
bool removable() const { return _removable; }
void updateButtons();
-
+ void openChildren(bool open);
+
private:
int _rtti;
QString _name;
@ -66,7 +67,7 @
KstViewManagerI(KstDoc *doc, QWidget* parent = 0, const char *name = 0,
bool modal = false, WFlags fl = 0);
virtual ~KstViewManagerI();
-
+
public slots:
void update();
void updateContents();
@ -78,13 +79,19 @
void cleanupCustom_I();
void select_I();
void deselect_I();
+ void open();
+ void close();
+ void openAll();
+ void closeAll();
private slots:
void doUpdates();
void contextMenu(QListViewItem *i, const QPoint& p, int c);
void currentChanged(QListViewItem *);
+
+ private:
+ void open(bool open);
- private:
KstDoc *doc;
protected:
More information about the Kst
mailing list