Diffstat (limited to 'kaddressbook/details/look_details.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/details/look_details.h | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/kaddressbook/details/look_details.h b/kaddressbook/details/look_details.h new file mode 100644 index 0000000..e8d50a9 --- a/dev/null +++ b/kaddressbook/details/look_details.h | |||
@@ -0,0 +1,157 @@ | |||
1 | /* | ||
2 | This file is part of KAddressBook. | ||
3 | Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | |||
24 | #ifndef LOOK_DETAILS_H | ||
25 | #define LOOK_DETAILS_H | ||
26 | |||
27 | #include <kabc/addressbook.h> | ||
28 | #include <kaction.h> | ||
29 | #include <klocale.h> | ||
30 | |||
31 | #include <qmap.h> | ||
32 | #include <qpixmap.h> | ||
33 | #include <qptrlist.h> | ||
34 | #include <qrect.h> | ||
35 | |||
36 | #include "look_basic.h" | ||
37 | |||
38 | class KABEntryPainter; | ||
39 | class QComboBox; | ||
40 | |||
41 | /** | ||
42 | This class implements the detailed view. | ||
43 | Currently, there is no possibility to change the entry in this | ||
44 | view. | ||
45 | */ | ||
46 | |||
47 | class KABDetailedView : public KABBasicLook | ||
48 | { | ||
49 | Q_OBJECT | ||
50 | |||
51 | public: | ||
52 | /** | ||
53 | Enum to select how the background is drawn. | ||
54 | */ | ||
55 | enum BackgroundStyle | ||
56 | { | ||
57 | None, | ||
58 | Tiled, | ||
59 | Bordered | ||
60 | }; | ||
61 | |||
62 | /** | ||
63 | The constructor. | ||
64 | */ | ||
65 | KABDetailedView( QWidget *parent = 0, const char* name = 0 ); | ||
66 | |||
67 | /** | ||
68 | The virtual destructor. | ||
69 | */ | ||
70 | virtual ~KABDetailedView(); | ||
71 | |||
72 | /** | ||
73 | Set the addressee. | ||
74 | */ | ||
75 | void setAddressee( const KABC::Addressee& ); | ||
76 | |||
77 | /** | ||
78 | Overloaded from KABBasicLook. | ||
79 | */ | ||
80 | void setReadOnly( bool ); | ||
81 | |||
82 | /** | ||
83 | Overloaded from KABBasicLook. | ||
84 | */ | ||
85 | void restoreSettings( KConfig* ); | ||
86 | |||
87 | public slots: | ||
88 | void slotBorderedBGSelected( int index ); | ||
89 | void slotTiledBGSelected( int index ); | ||
90 | |||
91 | protected: | ||
92 | void paintEvent( QPaintEvent* ); | ||
93 | void mousePressEvent( QMouseEvent* ); | ||
94 | void mouseMoveEvent( QMouseEvent* ); | ||
95 | |||
96 | /** | ||
97 | A method to retrieve a background image according to the path | ||
98 | stored in the entry. It is either loaded | ||
99 | from backgrounds, that acts as a cache, or from the file | ||
100 | and added to @see backgrounds. | ||
101 | */ | ||
102 | bool getBackground( QString path, QPixmap& image ); | ||
103 | |||
104 | private: | ||
105 | QPtrList<QRect> mURLRects; | ||
106 | QPtrList<QRect> mEmailRects; | ||
107 | QPtrList<QRect> mPhoneRects; | ||
108 | KABEntryPainter *mPainter; | ||
109 | |||
110 | QMap<QString, QPixmap> mBackgroundMap; | ||
111 | QPixmap mCurrentBackground; | ||
112 | |||
113 | BackgroundStyle mBackgroundStyle; | ||
114 | |||
115 | bool mUseDefaultBGImage; | ||
116 | bool mUseHeadLineBGColor; | ||
117 | |||
118 | QColor mDefaultBGColor; | ||
119 | QColor mHeadLineBGColor; | ||
120 | QColor mHeadLineTextColor; | ||
121 | |||
122 | QPixmap mDefaultBGImage; | ||
123 | |||
124 | KToggleAction *mActionShowAddresses; | ||
125 | KToggleAction *mActionShowEmails; | ||
126 | KToggleAction *mActionShowPhones; | ||
127 | KToggleAction *mActionShowURLs; | ||
128 | |||
129 | const int mGrid; | ||
130 | QStringList mBorders; | ||
131 | QStringList mTiles; | ||
132 | |||
133 | QPopupMenu *mMenuBorderedBG; | ||
134 | QPopupMenu *mMenuTiledBG; | ||
135 | |||
136 | static const QString mBorderedBGDir; | ||
137 | static const QString mTiledBGDir; | ||
138 | }; | ||
139 | |||
140 | class KABDetailedViewFactory : public KABLookFactory | ||
141 | { | ||
142 | public: | ||
143 | KABDetailedViewFactory( QWidget *parent = 0, const char *name = 0 ) | ||
144 | : KABLookFactory( parent, name ) {} | ||
145 | |||
146 | KABBasicLook *create() | ||
147 | { | ||
148 | return new KABDetailedView( mParent, mName ); | ||
149 | } | ||
150 | |||
151 | QString description() | ||
152 | { | ||
153 | return i18n( "Detailed Style: Display all details, no modifications." ); | ||
154 | } | ||
155 | }; | ||
156 | |||
157 | #endif | ||