summaryrefslogtreecommitdiff
path: root/noncore/securityplugins/notice
Unidiff
Diffstat (limited to 'noncore/securityplugins/notice') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/securityplugins/notice/.cvsignore3
-rw-r--r--noncore/securityplugins/notice/Makefile212
-rw-r--r--noncore/securityplugins/notice/config.in4
-rw-r--r--noncore/securityplugins/notice/notice.control11
-rw-r--r--noncore/securityplugins/notice/noticeConfigWidget.cpp81
-rw-r--r--noncore/securityplugins/notice/noticeConfigWidget.h71
-rw-r--r--noncore/securityplugins/notice/noticeplugin.cpp83
-rw-r--r--noncore/securityplugins/notice/noticeplugin.h62
-rw-r--r--noncore/securityplugins/notice/noticeplugin.pro17
-rw-r--r--noncore/securityplugins/notice/noticepluginimpl.cpp28
-rw-r--r--noncore/securityplugins/notice/noticepluginimpl.h61
11 files changed, 633 insertions, 0 deletions
diff --git a/noncore/securityplugins/notice/.cvsignore b/noncore/securityplugins/notice/.cvsignore
new file mode 100644
index 0000000..a4e0e29
--- a/dev/null
+++ b/noncore/securityplugins/notice/.cvsignore
@@ -0,0 +1,3 @@
1.moc
2.obj
3Makefile
diff --git a/noncore/securityplugins/notice/Makefile b/noncore/securityplugins/notice/Makefile
new file mode 100644
index 0000000..6303951
--- a/dev/null
+++ b/noncore/securityplugins/notice/Makefile
@@ -0,0 +1,212 @@
1#############################################################################
2# Makefile for building: libmultiauthnoticeplugin.so.1.0.0
3# Generated by qmake (1.05a) (Qt 3.1.2) on: Mon Jun 14 11:00:20 2004
4# Project: noticeplugin.pro
5# Template: lib
6# Command: $(QMAKE) -o Makefile noticeplugin.pro
7#############################################################################
8
9####### Compiler, tools and options
10
11CC = $(CCACHE) $(DISTCC) gcc
12CXX = $(CCACHE) $(DISTCC) g++
13LEX = flex
14YACC = yacc
15CFLAGS = -pipe $(CFLAGS_EXTRA) -Wall -W -g -fPIC -DQT_COMPONENT_DEBUG=2 -DQT_DEBUG -DOPIE_NO_BUILTIN_SHUTDOWN -DUSE_FILE_NOTIFICATION -DOPIE_SOUND_FRAGMENT_SHIFT=16
16CXXFLAGS = -pipe $(CFLAGS_EXTRA) -DQWS -fno-exceptions -fno-rtti $(CXXFLAGS_EXTRA) -Wall -W -g -fPIC -DQT_COMPONENT_DEBUG=2 -DQT_DEBUG -DOPIE_NO_BUILTIN_SHUTDOWN -DUSE_FILE_NOTIFICATION -DOPIE_SOUND_FRAGMENT_SHIFT=16
17LEXFLAGS =
18YACCFLAGS= -d
19INCPATH = -I/opt/opie/mkspecs/qws/linux-generic-g++ -I. -I$(OPIEDIR)/include -I$(QTDIR)/include -I.moc/$(PLATFORM)/
20LINK = g++
21LFLAGS = $(LFLAGS_EXTRA) -Wl,-rpath-link,$(OPIEDIR)/lib -shared -Wl,-soname,libmultiauthnoticeplugin.so.1 -Wl,-rpath,/opt/opie/plugins/security
22LIBS = $(SUBLIBS) -Wl,-rpath,$(QTDIR)/lib -L$(QTDIR)/lib $(LIBS_EXTRA) -lqpe -lopieui2 -L$(OPIEDIR)/lib -lqte
23AR = ar cqs
24RANLIB =
25MOC = $(QTDIR)/bin/moc
26UIC = $(QTDIR)/bin/uic
27QMAKE = qmake
28TAR = tar -cf
29GZIP = gzip -9f
30COPY = cp -f
31COPY_FILE= $(COPY) -p
32COPY_DIR = $(COPY) -pR
33DEL_FILE = rm -f
34SYMLINK = ln -sf
35DEL_DIR = rmdir
36MOVE = mv -f
37PRO = noticeplugin.pro
38CHK_DIR_EXISTS=
39MKDIR =
40
41####### Output directory
42
43OBJECTS_DIR = .obj/$(PLATFORM)/
44
45####### Files
46
47HEADERS = noticeplugin.h \
48 noticepluginimpl.h \
49 noticeConfigWidget.h
50SOURCES = noticeplugin.cpp \
51 noticepluginimpl.cpp \
52 noticeConfigWidget.cpp
53OBJECTS = .obj/$(PLATFORM)/noticeplugin.o \
54 .obj/$(PLATFORM)/noticepluginimpl.o \
55 .obj/$(PLATFORM)/noticeConfigWidget.o
56FORMS =
57UICDECLS =
58UICIMPLS =
59SRCMOC = .moc/$(PLATFORM)/moc_noticeConfigWidget.cpp
60OBJMOC = .obj/$(PLATFORM)/moc_noticeConfigWidget.o
61 DIST = ../../../gen.pro \
62 ../../../include.pro \
63 noticeplugin.pro
64QMAKE_TARGET = multiauthnoticeplugin
65DESTDIR = $(OPIEDIR)/plugins/security/
66TARGET = libmultiauthnoticeplugin.so.1.0.0
67 TARGETA= $(OPIEDIR)/plugins/security/libmultiauthnoticeplugin.a
68 TARGETD= libmultiauthnoticeplugin.so.1.0.0
69 TARGET0= libmultiauthnoticeplugin.so
70 TARGET1= libmultiauthnoticeplugin.so.1
71 TARGET2= libmultiauthnoticeplugin.so.1.0
72
73first: all
74####### Implicit rules
75
76.SUFFIXES: .c .cpp .cc .cxx .C
77
78.cpp.o:
79 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
80
81.cc.o:
82 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
83
84.cxx.o:
85 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
86
87.C.o:
88 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
89
90.c.o:
91 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
92
93####### Build rules
94
95all: Makefile $(OPIEDIR)/plugins/security/$(TARGET)
96
97$(OPIEDIR)/plugins/security/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
98 test -d $(OPIEDIR)/plugins/security/ || mkdir -p $(OPIEDIR)/plugins/security/
99 -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
100 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
101 -ln -s $(TARGET) $(TARGET0)
102 -ln -s $(TARGET) $(TARGET1)
103 -ln -s $(TARGET) $(TARGET2)
104 -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET)
105 -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET0)
106 -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET1)
107 -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET2)
108 -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(OPIEDIR)/plugins/security/
109
110
111
112staticlib: $(TARGETA)
113
114$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)
115 -$(DEL_FILE) $(TARGETA)
116 $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)
117
118mocables: $(SRCMOC)
119
120$(MOC):
121 ( cd $(QTDIR)/src/moc ; $(MAKE) )
122
123Makefile: noticeplugin.pro /opt/opie/mkspecs/qws/linux-generic-g++/qmake.conf ../../../gen.pro \
124 ../../../include.pro
125 $(QMAKE) -o Makefile noticeplugin.pro
126qmake:
127 @$(QMAKE) -o Makefile noticeplugin.pro
128
129dist:
130 @mkdir -p .obj/$(PLATFORM)/multiauthnoticeplugin && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .obj/$(PLATFORM)/multiauthnoticeplugin/ && ( cd `dirname .obj/$(PLATFORM)/multiauthnoticeplugin` && $(TAR) multiauthnoticeplugin.tar multiauthnoticeplugin && $(GZIP) multiauthnoticeplugin.tar ) && $(MOVE) `dirname .obj/$(PLATFORM)/multiauthnoticeplugin`/multiauthnoticeplugin.tar.gz . && $(DEL_FILE) -r .obj/$(PLATFORM)/multiauthnoticeplugin
131
132mocclean:
133 -$(DEL_FILE) $(OBJMOC)
134 -$(DEL_FILE) $(SRCMOC)
135
136uiclean:
137
138yaccclean:
139lexclean:
140clean: mocclean
141 -$(DEL_FILE) $(OBJECTS)
142 -$(DEL_FILE) *~ core *.core
143
144
145####### Sub-libraries
146
147distclean: clean
148 -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET) $(TARGET)
149 -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET0) $(OPIEDIR)/plugins/security/$(TARGET1) $(OPIEDIR)/plugins/security/$(TARGET2) $(TARGETA)
150
151
152lupdate:
153 lupdate -noobsolete $(PRO)
154
155lrelease:
156 lrelease $(PRO)
157
158ipk:
159 tmp=`mktemp -d /tmp/ipkg-opie.XXXXXXXXXX` && ( $(MAKE) INSTALL_ROOT="" install && ipkg-build ; rm -rf ; )
160
161opie-lupdate:
162 opie-lupdate $(PRO)
163
164opie-lrelease:
165 opie-lrelease $(PRO)
166
167messages:
168 xgettext -C -n -ktr -kQT_TRANSLATE_NOOP noticeplugin.h noticepluginimpl.h noticeConfigWidget.h noticeplugin.cpp noticepluginimpl.cpp noticeConfigWidget.cpp -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-tr.po' && xgettext -C -n -a noticeplugin.h noticepluginimpl.h noticeConfigWidget.h noticeplugin.cpp noticepluginimpl.cpp noticeConfigWidget.cpp -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-allstrings.po'
169
170FORCE:
171
172####### Compile
173
174.obj/$(PLATFORM)/noticeplugin.o: noticeplugin.cpp noticeplugin.h \
175 noticeConfigWidget.h
176 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/noticeplugin.o noticeplugin.cpp
177
178.obj/$(PLATFORM)/noticepluginimpl.o: noticepluginimpl.cpp noticepluginimpl.h \
179 noticeplugin.h \
180 noticeConfigWidget.h
181 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/noticepluginimpl.o noticepluginimpl.cpp
182
183.obj/$(PLATFORM)/noticeConfigWidget.o: noticeConfigWidget.cpp noticeConfigWidget.h
184 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/noticeConfigWidget.o noticeConfigWidget.cpp
185
186.obj/$(PLATFORM)/moc_noticeConfigWidget.o: .moc/$(PLATFORM)/moc_noticeConfigWidget.cpp noticeConfigWidget.h
187 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/moc_noticeConfigWidget.o .moc/$(PLATFORM)/moc_noticeConfigWidget.cpp
188
189.moc/x86-linux/moc_noticeConfigWidget.cpp: $(MOC) noticeConfigWidget.h
190 $(MOC) noticeConfigWidget.h -o .moc/x86-linux/moc_noticeConfigWidget.cpp
191
192####### Install
193
194install_target:
195 @$(CHK_DIR_EXISTS) "$(INSTALL_ROOT)$(OPIEDIR)/lib/" || $(MKDIR) "$(INSTALL_ROOT)$(OPIEDIR)/lib/"
196 -$(COPY) "$(OPIEDIR)/plugins/security/$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET)"
197 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET0)"
198 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET1)"
199 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET2)"
200
201uninstall_target:
202 -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET)"
203 -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET0)"
204 -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET1)"
205 -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET2)"
206 -$(DEL_DIR) "$(INSTALL_ROOT)$(OPIEDIR)/lib/"
207
208
209install: all install_target
210
211uninstall: uninstall_target
212
diff --git a/noncore/securityplugins/notice/config.in b/noncore/securityplugins/notice/config.in
new file mode 100644
index 0000000..bfc649e
--- a/dev/null
+++ b/noncore/securityplugins/notice/config.in
@@ -0,0 +1,4 @@
1 config MULTIAUTH_NOTICE
2 boolean "opie-multiauth-notice (Notice plugin for opie-multiauth)"
3 default "y"
4 depends SECURITY
diff --git a/noncore/securityplugins/notice/notice.control b/noncore/securityplugins/notice/notice.control
new file mode 100644
index 0000000..890e0c9
--- a/dev/null
+++ b/noncore/securityplugins/notice/notice.control
@@ -0,0 +1,11 @@
1Package: opie-multiauth-noticeplugin
2Files: plugins/security/libmultiauthnoticeplugin.so* pics/security/noticeplugin.png pics/security/noticeplugin_small.png
3Priority: optional
4Section: opie/settings
5Maintainer: Clement Seveillac <clement@nist.gov>
6Architecture: arm
7Version: 0.0.1.6
8Depends: opie-security
9Description: Notice plugin for opie-security authentication.
10 It allows you to display, for example, a notice from your legal departement.
11
diff --git a/noncore/securityplugins/notice/noticeConfigWidget.cpp b/noncore/securityplugins/notice/noticeConfigWidget.cpp
new file mode 100644
index 0000000..e2c2d83
--- a/dev/null
+++ b/noncore/securityplugins/notice/noticeConfigWidget.cpp
@@ -0,0 +1,81 @@
1#include "noticeConfigWidget.h"
2
3#include <opie2/odebug.h>
4
5#include <qwidget.h>
6#include <qlayout.h>
7#include <qlabel.h>
8#include <qregexp.h>
9#include <qgroupbox.h>
10
11/// constructs the widget, filling the noticeMLE QMultiLineEdit with the "noticeText" entry
12NoticeConfigWidget::NoticeConfigWidget(QWidget* parent = 0, const char* name = "Notice configuration widget") : MultiauthConfigWidget(parent, name)
13{
14 QVBoxLayout *baseLayout = new QVBoxLayout( this);
15 baseLayout->setSpacing(11);
16 baseLayout->setMargin(6);
17 baseLayout->setAlignment( Qt::AlignTop );
18
19 QGroupBox *configBox = new QGroupBox(0, Qt::Vertical, tr("Set the message the user must accept"), this);
20 baseLayout->addWidget(configBox);
21 QVBoxLayout *boxLayout = new QVBoxLayout( configBox->layout() );
22
23 QLabel * comment1 = new QLabel("<p><em>" + tr("You may want to consult your legal department for proper wording here.") + "</em></p>", configBox);
24 boxLayout->addWidget(comment1);
25
26 // Set the multilineedit box text to getNoticeText()
27 noticeMLE = new QMultiLineEdit(configBox, "notice text");
28 noticeMLE->setWordWrap(QMultiLineEdit::WidgetWidth);
29 noticeMLE->setFocus();
30 noticeMLE->setText(getNoticeText());
31 boxLayout->addWidget(noticeMLE);
32
33 resetNoticeButton = new QPushButton( tr("Reset notice to default"), configBox, "reset Notice Button" );
34 connect(resetNoticeButton, SIGNAL( clicked() ), this, SLOT( resetNotice() ));
35 boxLayout->addWidget(resetNoticeButton, 0, Qt::AlignHCenter);
36
37 QLabel * comment2 = new QLabel("<p>" + tr("Note: you can use HTML tags to improve its layout (example: text between &lt;em&gt; and &lt;/em&gt; will be <em>emphasized</em>)") + "</p>", configBox);
38 boxLayout->addWidget(comment2);
39
40}
41
42/// nothing to do
43NoticeConfigWidget::~NoticeConfigWidget()
44{}
45
46/// write the notice text in the multiauth.conf Config file
47void NoticeConfigWidget::writeConfig()
48{
49 if ( noticeMLE->edited() ) {
50 odebug << "writing new notice text in Security.conf" << oendl;
51 setNoticeText(noticeMLE->text());
52 }
53}
54
55/// reset the notice text to the hard-coded example defaultNoticeText
56void NoticeConfigWidget::resetNotice()
57{
58 noticeMLE->setText(defaultNoticeText);
59}
60
61/// get the notice text from the config file (with true new lines)
62/**
63 * if no text has been defined yet returns defaultNoticeText
64 */
65QString NoticeConfigWidget::getNoticeText() {
66 m_config = new Config("Security");
67 m_config->setGroup("NoticePlugin");
68 // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp
69 QString noticeText = m_config->readEntry("noticeText", defaultNoticeText).replace( QRegExp("\\\\n"), "\n" );
70 delete m_config;
71 return noticeText;
72}
73
74/// set the notice text in our m_config config file (escaping new lines)
75void NoticeConfigWidget::setNoticeText(QString noticeText) {
76 m_config = new Config("Security");
77 m_config->setGroup("NoticePlugin");
78 // since Config files do not allow true newlines, we replace them with litteral "\n"
79 m_config->writeEntry("noticeText", noticeText.replace( QRegExp("\n"), "\\n" ));
80 delete m_config;
81}
diff --git a/noncore/securityplugins/notice/noticeConfigWidget.h b/noncore/securityplugins/notice/noticeConfigWidget.h
new file mode 100644
index 0000000..69f15bf
--- a/dev/null
+++ b/noncore/securityplugins/notice/noticeConfigWidget.h
@@ -0,0 +1,71 @@
1/**
2 * \file noticeConfigWidget.h
3 * \brief Notice plugin configuration widget
4 * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr)
5 */
6/*
7 =. This file is part of the Opie Project
8 .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org>
9 .>+-=
10 _;:, .> :=|. This library is free software; you can
11.> <`_, > . <= redistribute it and/or modify it under
12:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
13.="- .-=="i, .._ License as published by the Free Software
14 - . .-<_> .<> Foundation; either version 2 of the License,
15 ._= =} : or (at your option) any later version.
16 .%`+i> _;_.
17 .i_,=:_. -<s. This library is distributed in the hope that
18 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
19 : .. .:, . . . without even the implied warranty of
20 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
21 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.= = ; Library General Public License for more
23++= -. .` .: details.
24 : = ...= . :.=-
25 -. .:....=;==+<; You should have received a copy of the GNU
26 -_. . . )=. = Library General Public License along with
27 -- :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
33
34#ifndef NOTICECONFIGWIDGET_H
35#define NOTICECONFIGWIDGET_H
36
37#include <qpushbutton.h>
38#include <qmultilineedit.h>
39#include <qpe/config.h>
40
41#include <opie2/multiauthconfigwidget.h>
42
43static char defaultNoticeText [] = "<h2>NOTICE TO USERS</h2>\n"
44 "<p>This is a private computer system and is the property of "
45 "the company XXX / Mr or Ms X. It is for authorized "
46 "use only. Users have no expectation of privacy.</p>\n"
47 "<p><strong>Unauthorized or improper use of this system may result in "
48 "disciplinary action and civil and criminal penalties. <em>By continuing to use "
49 "this system you indicate your awareness of and consent to these "
50 "terms. LOG OFF IMMEDIATELY if you do not agree to them.</em></strong></p>";
51
52class NoticeConfigWidget : public MultiauthConfigWidget {
53
54 Q_OBJECT
55
56public:
57 NoticeConfigWidget(QWidget* parent, const char* name);
58 virtual ~NoticeConfigWidget();
59 virtual void writeConfig();
60private:
61 QMultiLineEdit * noticeMLE;
62 QPushButton * resetNoticeButton;
63private slots:
64 void resetNotice();
65private:
66 Config * m_config;
67 QString getNoticeText();
68 void setNoticeText(QString noticeText);
69};
70
71#endif // NOTICECONFIGWIDGET_H
diff --git a/noncore/securityplugins/notice/noticeplugin.cpp b/noncore/securityplugins/notice/noticeplugin.cpp
new file mode 100644
index 0000000..f7d41ab
--- a/dev/null
+++ b/noncore/securityplugins/notice/noticeplugin.cpp
@@ -0,0 +1,83 @@
1#include "noticeplugin.h"
2
3#include <opie2/oapplication.h>
4
5#include <qmessagebox.h>
6#include <qregexp.h>
7
8/// creates and initializes the m_config Config object
9NoticePlugin::NoticePlugin() : MultiauthPluginObject(), noticeW(0) {
10 m_config = new Config("Security");
11 m_config->setGroup("NoticePlugin");
12}
13
14/// deletes the m_config Config object and noticeW if necessary
15NoticePlugin::~NoticePlugin() {
16 delete m_config;
17 if (noticeW != 0)
18 delete noticeW;
19}
20
21/// Simply return its name (Notice plugin)
22QString NoticePlugin::pluginName() const {
23 return "Notice plugin";
24}
25
26/// return the Notice widget configuration widget
27/**
28 * \return noticeW, the NoticeConfigWidget
29 */
30MultiauthConfigWidget * NoticePlugin::configWidget(QWidget * parent) {
31 if (noticeW == 0)
32 noticeW = new NoticeConfigWidget(parent, "Notice configuration widget");
33 return noticeW;
34}
35
36/// return the path of the small tab icon
37QString NoticePlugin::pixmapNameConfig() const {
38 return "security/noticeplugin_small";
39}
40
41/// return the path of the big icon for the active/order checklist
42QString NoticePlugin::pixmapNameWidget() const {
43 return "security/noticeplugin";
44}
45
46/// Displays the configured message and an 'Accept' button
47/**
48 * \return the outcome code of this authentication (can be only success)
49 */
50int NoticePlugin::authenticate() {
51 QMessageBox noticeDialog("Notice plugin",
52 getNoticeText(),
53 QMessageBox::Warning,
54 QMessageBox::Yes,
55 0,
56 0,
57 0,
58 "notice plugin dialog",
59 true,
60 Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop);
61
62 noticeDialog.setButtonText(QMessageBox::Yes, "I accept");
63
64 QRect desk = oApp->desktop()->geometry();
65 noticeDialog.setGeometry( 0, 0, desk.width(), desk.height() );
66
67 switch (noticeDialog.exec())
68 {
69 case QMessageBox::Yes:
70 return MultiauthPluginObject::Success;
71 }
72 return 255; //should not be returned anyway
73}
74
75/// get the notice text from our m_config config file (with true new lines)
76/**
77 * if no text has been defined yet returns defaultNoticeText
78 */
79QString NoticePlugin::getNoticeText() {
80 // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp
81 return m_config->readEntry("noticeText", defaultNoticeText).replace( QRegExp("\\\\n"), "\n" );
82}
83
diff --git a/noncore/securityplugins/notice/noticeplugin.h b/noncore/securityplugins/notice/noticeplugin.h
new file mode 100644
index 0000000..e01cb93
--- a/dev/null
+++ b/noncore/securityplugins/notice/noticeplugin.h
@@ -0,0 +1,62 @@
1/**
2 * \file noticeplugin.h
3 * \brief Standard Opie multiauth plugin definition
4 * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr)
5 */
6/*
7 =. This file is part of the Opie Project
8 .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org>
9 .>+-=
10 _;:, .> :=|. This library is free software; you can
11.> <`_, > . <= redistribute it and/or modify it under
12:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
13.="- .-=="i, .._ License as published by the Free Software
14 - . .-<_> .<> Foundation; either version 2 of the License,
15 ._= =} : or (at your option) any later version.
16 .%`+i> _;_.
17 .i_,=:_. -<s. This library is distributed in the hope that
18 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
19 : .. .:, . . . without even the implied warranty of
20 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
21 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.= = ; Library General Public License for more
23++= -. .` .: details.
24 : = ...= . :.=-
25 -. .:....=;==+<; You should have received a copy of the GNU
26 -_. . . )=. = Library General Public License along with
27 -- :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
33
34#ifndef NOTICE_PLUGIN_H
35#define NOTICE_PLUGIN_H
36
37#include <qstring.h>
38#include <qpe/config.h>
39#include <opie2/multiauthplugininterface.h>
40#include "noticeConfigWidget.h"
41
42/// Multi-authentication plugin, having the user accept a (legal, etc.) notice text.
43/**
44 * The plugin itself, implementing the main authenticate() function.
45 */
46class NoticePlugin : public MultiauthPluginObject {
47
48public:
49 NoticePlugin();
50 virtual ~NoticePlugin();
51 int authenticate();
52 MultiauthConfigWidget * configWidget(QWidget * parent);
53 QString pixmapNameConfig() const;
54 QString pixmapNameWidget() const;
55 QString pluginName() const;
56private:
57 NoticeConfigWidget * noticeW;
58 Config * m_config;
59 QString getNoticeText();
60};
61
62#endif
diff --git a/noncore/securityplugins/notice/noticeplugin.pro b/noncore/securityplugins/notice/noticeplugin.pro
new file mode 100644
index 0000000..51532a2
--- a/dev/null
+++ b/noncore/securityplugins/notice/noticeplugin.pro
@@ -0,0 +1,17 @@
1TEMPLATE = lib
2CONFIG += qt warn_on
3
4 HEADERS = noticeplugin.h noticepluginimpl.h noticeConfigWidget.h
5
6 SOURCES = noticeplugin.cpp noticepluginimpl.cpp noticeConfigWidget.cpp
7
8
9 INCLUDEPATH+= $(OPIEDIR)/include
10 DEPENDPATH+=
11
12 LIBS += -lqpe -lopieui2
13
14DESTDIR = $(OPIEDIR)/plugins/security
15TARGET = multiauthnoticeplugin
16
17include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/securityplugins/notice/noticepluginimpl.cpp b/noncore/securityplugins/notice/noticepluginimpl.cpp
new file mode 100644
index 0000000..34e3cfc
--- a/dev/null
+++ b/noncore/securityplugins/notice/noticepluginimpl.cpp
@@ -0,0 +1,28 @@
1#include "noticepluginimpl.h"
2
3NoticePluginImpl::NoticePluginImpl() {
4 noticePlugin = new NoticePlugin();
5}
6
7NoticePluginImpl::~NoticePluginImpl() {
8 delete noticePlugin;
9}
10
11MultiauthPluginObject* NoticePluginImpl::plugin() {
12 return noticePlugin;
13}
14
15 Q_EXPORT_INTERFACE() {
16 Q_CREATE_INSTANCE( NoticePluginImpl )
17 }
18
19QRESULT NoticePluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) {
20 *iface = 0;
21 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MultiauthPluginInterface ) ) {
22 *iface = this, (*iface)->addRef();
23 } else {
24 return QE_NOINTERFACE;
25 }
26 return QS_OK;
27
28}
diff --git a/noncore/securityplugins/notice/noticepluginimpl.h b/noncore/securityplugins/notice/noticepluginimpl.h
new file mode 100644
index 0000000..b2a1140
--- a/dev/null
+++ b/noncore/securityplugins/notice/noticepluginimpl.h
@@ -0,0 +1,61 @@
1/**
2 * \file noticepluginimpl.h
3 * \brief Standard Opie multiauth plugin definition
4 * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr)
5 */
6/*
7 =. This file is part of the Opie Project
8 .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org>
9 .>+-=
10 _;:, .> :=|. This library is free software; you can
11.> <`_, > . <= redistribute it and/or modify it under
12:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
13.="- .-=="i, .._ License as published by the Free Software
14 - . .-<_> .<> Foundation; either version 2 of the License,
15 ._= =} : or (at your option) any later version.
16 .%`+i> _;_.
17 .i_,=:_. -<s. This library is distributed in the hope that
18 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
19 : .. .:, . . . without even the implied warranty of
20 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
21 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.= = ; Library General Public License for more
23++= -. .` .: details.
24 : = ...= . :.=-
25 -. .:....=;==+<; You should have received a copy of the GNU
26 -_. . . )=. = Library General Public License along with
27 -- :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
33
34#ifndef NOTICE_PLUGIN_IMPL
35#define NOTICE_PLUGIN_IMPL
36
37#include "noticeplugin.h"
38
39/**
40 * \brief Standard multiauth plugin class
41 */
42class NoticePluginImpl : public MultiauthPluginInterface{
43
44 public:
45 NoticePluginImpl();
46 virtual ~NoticePluginImpl();
47
48 QRESULT queryInterface( const QUuid &, QUnknownInterface** );
49 /// defines standard addRef() and release() functions
50 Q_REFCOUNT;
51
52 virtual MultiauthPluginObject *plugin();
53
54 private:
55 /// the plugin itself
56 NoticePlugin *noticePlugin;
57 ulong ref;
58};
59
60#endif
61