author | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
commit | b9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff) | |
tree | 2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /kaddressbook/viewconfigurewidget.cpp | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
Diffstat (limited to 'kaddressbook/viewconfigurewidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/viewconfigurewidget.cpp | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/kaddressbook/viewconfigurewidget.cpp b/kaddressbook/viewconfigurewidget.cpp new file mode 100644 index 0000000..666e188 --- a/dev/null +++ b/kaddressbook/viewconfigurewidget.cpp | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | This file is part of KAddressBook. | ||
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | ||
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 | |||
25 | #ifndef KAB_EMBEDDED | ||
26 | |||
27 | #include <qvbox.h> | ||
28 | |||
29 | #include <kapplication.h> | ||
30 | #include <kconfig.h> | ||
31 | #include <kdebug.h> | ||
32 | #include <kiconloader.h> | ||
33 | |||
34 | #include "viewmanager.h" | ||
35 | |||
36 | #endif //KAB_EMBEDDED | ||
37 | |||
38 | |||
39 | #include <qlayout.h> | ||
40 | |||
41 | #include <kjanuswidget.h> | ||
42 | #include <kglobal.h> | ||
43 | #include <klocale.h> | ||
44 | |||
45 | #include "viewconfigurewidget.h" | ||
46 | #include "viewconfigurefieldspage.h" | ||
47 | #include "viewconfigurefilterpage.h" | ||
48 | |||
49 | ViewConfigureWidget::ViewConfigureWidget( KABC::AddressBook *ab, QWidget *parent, | ||
50 | const char *name ) | ||
51 | : ConfigureWidget( ab, parent, name ) | ||
52 | { | ||
53 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | ||
54 | |||
55 | mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); | ||
56 | |||
57 | topLayout->addWidget( mMainWidget ); | ||
58 | |||
59 | // Add the first page, the attributes | ||
60 | QVBox *page = addPage( i18n( "Fields" ), QString::null, | ||
61 | KGlobal::iconLoader()->loadIcon( "view_detailed", | ||
62 | KIcon::Panel, 16 ) ); | ||
63 | |||
64 | |||
65 | // Add the select fields page | ||
66 | mFieldsPage = new ViewConfigureFieldsPage( addressBook(), (QWidget*)page ); | ||
67 | |||
68 | //US mFieldsPage->setMinimumSize(300,300); | ||
69 | |||
70 | // Add the second page, the filter selection | ||
71 | page = addPage( i18n( "Default Filter" ), QString::null, | ||
72 | KGlobal::iconLoader()->loadIcon( "filter", | ||
73 | KIcon::Panel, 16 ) ); | ||
74 | |||
75 | mFilterPage = new ViewConfigureFilterPage( (QWidget*)page ); | ||
76 | //qDebug("+++++ViewConfigureWidget::ViewConfigureWidget "); | ||
77 | } | ||
78 | |||
79 | ViewConfigureWidget::~ViewConfigureWidget() | ||
80 | { | ||
81 | //qDebug("-----ViewConfigureWidget::~ViewConfigureWidget() "); | ||
82 | } | ||
83 | |||
84 | void ViewConfigureWidget::restoreSettings( KConfig *config ) | ||
85 | { | ||
86 | mFieldsPage->restoreSettings( config ); | ||
87 | mFilterPage->restoreSettings( config ); | ||
88 | } | ||
89 | |||
90 | void ViewConfigureWidget::saveSettings( KConfig *config ) | ||
91 | { | ||
92 | mFieldsPage->saveSettings( config ); | ||
93 | mFilterPage->saveSettings( config ); | ||
94 | } | ||
95 | |||
96 | QVBox *ViewConfigureWidget::addPage( const QString &item, const QString &header, | ||
97 | const QPixmap &pixmap ) | ||
98 | { | ||
99 | return mMainWidget->addVBoxPage( item, header, pixmap ); | ||
100 | } | ||
101 | |||
102 | #include <qframe.h> | ||
103 | #include <qlabel.h> | ||
104 | #include <qlayout.h> | ||
105 | #include <stdlib.h> | ||
106 | |||
107 | ViewConfigureDialog::ViewConfigureDialog( ViewConfigureWidget *wdg, const QString &viewName, | ||
108 | QWidget *parent, const char *name ) | ||
109 | : KDialogBase( Swallow, i18n( "Modify View: " ) + viewName, Help | Ok | Cancel, | ||
110 | Ok, parent, name, true, true ), mConfigWidget( wdg ) | ||
111 | { | ||
112 | //US, I have to change the way, how to connect the ViewConfigureWidget. It looks | ||
113 | // like it has changed. | ||
114 | //QFrame *topFrame = plainPage(); | ||
115 | if ( mConfigWidget ) { | ||
116 | mConfigWidget->reparent(this, QPoint(0,0), true); | ||
117 | // QVBoxLayout * layout = new QVBoxLayout( this ); | ||
118 | //layout->addWidget(mConfigWidget ); | ||
119 | //mConfigWidget->reparent(topFrame, QPoint(1,1), true); | ||
120 | |||
121 | setMainWidget( mConfigWidget ); | ||
122 | } | ||
123 | |||
124 | } | ||
125 | |||
126 | ViewConfigureDialog::~ViewConfigureDialog() | ||
127 | { | ||
128 | } | ||
129 | void ViewConfigureDialog::setWidget( ViewConfigureWidget *wdg ) | ||
130 | { | ||
131 | mConfigWidget = wdg ; | ||
132 | setMainWidget( mConfigWidget ); | ||
133 | |||
134 | } | ||
135 | |||
136 | void ViewConfigureDialog::restoreSettings( KConfig *config ) | ||
137 | { | ||
138 | mConfigWidget->restoreSettings( config ); | ||
139 | } | ||
140 | |||
141 | void ViewConfigureDialog::saveSettings( KConfig *config ) | ||
142 | { | ||
143 | mConfigWidget->saveSettings( config ); | ||
144 | } | ||
145 | |||
146 | void ViewConfigureDialog::slotHelp() | ||
147 | { | ||
148 | #ifndef KAB_EMBEDDED | ||
149 | kapp->invokeHelp( "using-views" ); | ||
150 | #else //KAB_EMBEDDED | ||
151 | qDebug("ViewConfigureDialog::slotHelp not yet implemented"); | ||
152 | #endif //KAB_EMBEDDED | ||
153 | } | ||
154 | |||
155 | #ifndef KAB_EMBEDDED | ||
156 | #include "viewconfigurewidget.moc" | ||
157 | #endif //KAB_EMBEDDED | ||
158 | |||
159 | |||