From 37333bf25ad9a4c538250f5af2f9f1d666362883 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kpackage/kplview.h | 191 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 kpackage/kplview.h (limited to 'kpackage/kplview.h') diff --git a/kpackage/kplview.h b/kpackage/kplview.h new file mode 100644 index 0000000..7931c99 --- /dev/null +++ b/kpackage/kplview.h @@ -0,0 +1,191 @@ +/* +** Copyright (C) 1999,2000 Toivo Pedaste +** +*/ + +/* +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program in a file called COPYING; if not, write to +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +** MA 02110-1301, USA. +*/ + +/* +** Bug reports and questions can be sent to kde-devel@kde.org +*/ + + +#ifndef KPLVITEM_H +#define KPLVITEM_H + +#include "../config.h" +// Standard Headers + +// Qt Headers +#include +#include +#include +#include +#include + +// KDE headers +#include "klistview.h" + +// ksetup headers +#include "packageInfo.h" + +class packageDisplayWidget; + +//////////////////////////////////////////////////////////////////////// +class KpTreeList: public KListView +{ + Q_OBJECT + +public: + KpTreeList ( QWidget * parent = 0); + + void contentsMousePressEvent ( QMouseEvent * e ); + + bool inMark(int x); + + KpTreeListItem *firstChild(); + KpTreeListItem *currentItem(); + void clear(); + + KpTreeListItem *markPkg; + + QPtrList stack; + // Stack of jumped to packages + + void sweep(bool init); + // sweep tree adjusting visibility + void expand(); + // sweep tree expanding everything + + void findMarked(KpTreeListItem *item, QPtrList &selList); + // generate list of marked tree items + void clearMarked(KpTreeListItem *item); + // unmark marked tree items + + // mark all packages in the selected view + void markAll(KpTreeListItem *item) ; + + void expandTree(KpTreeList *list); + // expand package tree + + void expandTree(KpTreeListItem *item); + // expand package sub-tree + + void collapseTree(KpTreeList *list); + // semi-collapse package tree + + void collapseTree(KpTreeListItem *item); + // semi-collapse package sub-tree + + void countMarked(KpTreeListItem *, int &cntInstall, int &cntUnInstall); + // Count marked packages that can be installed/uninstalled + + void packageHighlighted(QListViewItem *item, packageDisplayWidget *packageDisplay); + // A package has been highlighted in the list tree + + KpTreeListItem *search(const QString &str, const QString &head, + KpTreeListItem *start = 0); + KpTreeListItem *search(const QString &str, bool subStr, bool wrap, bool start); + // search for a package in tree + KpTreeListItem *changePack(KpTreeListItem *searchResult, bool push = true); + // Change to other package + + void stackRemove(KpTreeListItem *pack); + // Remove entry from package stack + + void readTreeType(); + void writeTreeType(); + // config: Tree display type + + void writeTreeConfig(); + void readTreeConfig(); + // save and restore column positions + + int treeType; + +public slots: + void next(); + // Package stack forward + + void previous(); + // Package stack back + +private: + int sweepChild(KpTreeListItem *it); + void expandChild(KpTreeListItem *it); + + bool searchChild(KpTreeListItem *it); + // recurse thru the display tree looking for 'str' + + bool notPress; + // flag to packageHighlighted + + KpTreeListItem *searchCitem; + bool searchSkip, searchSubstr; + QString searchStr; + KpTreeListItem *searchResult; + // globals used by searchChild for start from current position, + // skip to current item before search flag, substring search flag, + // search string, result item (if found) + + // flag skipping in searchChild + + +signals: + void updateMarked(); + void cleared(); +}; + +//////////////////////////////////////////////////////////////////////// +class KpTreeListItem : public QListViewItem +{ +public: + KpTreeListItem( QListViewItem *parent, packageInfo* pinfo, + const QPixmap& thePixmap, + QString label1 = 0, QString label2 = 0, + QString label3 = 0, QString label4 = 0, + QString label5 = 0, QString label6 = 0, + QString label7 = 0, QString label8 = 0); + + + KpTreeListItem( KListView *parent, packageInfo* pinfo, + const QPixmap& thePixmap, + QString label1 = 0, QString label2 = 0, + QString label3 = 0, QString label4 = 0, + QString label5 = 0, QString label6 = 0, + QString label7 = 0, QString label8 = 0); + + + KpTreeListItem *firstChild(); + KpTreeListItem *nextSibling(); + + void toggleMark(); + void setMark(bool mark); + // flag for install/uninstall + + void hide(); + void show(); + + virtual int compare( QListViewItem *i, int col, bool ascending ) const; + + packageInfo *info; + bool marked; +}; + + +#endif -- cgit v1.2.1