summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwmviewstyle_1.h
blob: 4f7a2564c1945bc80327445a02d38554952f2734 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/***************************************************************************
 *                                                                         *
 *   copyright (C) 2004 by Michael Buesch                                  *
 *   email: mbuesch@freenet.de                                             *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License version 2        *
 *   as published by the Free Software Foundation.                         *
 *                                                                         *
 ***************************************************************************/

/***************************************************************************
 * copyright (C) 2004 by Ulf Schenk
 * This file is originaly based on version 1.0.1 of pwmanager
 * and was modified to run on embedded devices that run microkde
 *
 * $Id$
 **************************************************************************/  

#ifndef PWMVIEWSTYLE_1_H
#define PWMVIEWSTYLE_1_H

#include <qvbox.h>

#ifndef PWM_EMBEDDED
#include <qtextedit.h>
#include <qsplitter.h>
#else
#include <qmultilineedit.h>
#include <KDGanttMinimizeSplitter.h>
#endif

#include <qlabel.h>
#include <qlistbox.h>
#include <qpopupmenu.h>

class PwMView;
class ListViewPwM;
class CommentBox;
class PWMPrefs;

class PwMViewStyle_1 : public QObject
{
	Q_OBJECT
public:
	PwMViewStyle_1(PwMView *view);
	~PwMViewStyle_1();

	ListViewPwM * getLv()
			{ return lv; }
	CommentBox * getCommentBox()
			{ return commentBox; }

	/** returns the currently selected category */
	QString getCurrentCategory()
			{ return categoriesList->currentText(); }
	/** add Category to the view */
	void addCategory(const QString &cat)
			{ categoriesList->insertItem(cat); }
	/** delete Category from view */
	void delCategory(const QString &cat);
	/** delete all categories from view */
	void delAllCategories()
			{ categoriesList->clear(); }
	/** select the specified category */
	void selectCategory(const QString &cat);
	/** returns the number of categories in this view.
	  * This value dosn't say anything about the number of
	  * categories in the document.
	  */
	int numCategories()
			{ return categoriesList->count(); }
	/** resize the view */
	void resize(const QSize &size)
			{ splitter->resize(size); }

	//US ENH: I need a place to load the view dependend settings. Eg. splittersize
	void restoreSettings(PWMPrefs* prefs);
	void saveSettings(PWMPrefs* prefs);

public slots:
    void toggleSplitter();
protected slots:
	/** user clicked right button in category list */
	void catRightClick(QListBoxItem *item, const QPoint &point);

protected:
	/** main list view */
	ListViewPwM *lv;
#ifndef PWM_EMBEDDED
	/** main splitter widget */
	QSplitter *splitter;
	/** commentTextEdit splitter */
	QSplitter *splitter2;
#else
	/** main splitter widget */
	KDGanttMinimizeSplitter *splitter;
	/** commentTextEdit splitter */
	KDGanttMinimizeSplitter *splitter2;
#endif

	/** categories list-box */
	QListBox *categoriesList;
	/** title string for the categories combo or list box */
	QLabel *categoriesTitle;
	/** hbox1 for widget style */
	QVBox *vbox1;
	/** text-edit to display the comment */
	CommentBox *commentBox;
	/** category list context menu */
	QPopupMenu *catCtxMenu;
};

#endif