From 5431072f0ea1cbc8ca37914b6349e66079f1acff Mon Sep 17 00:00:00 2001 From: clem Date: Tue, 15 Jun 2004 13:49:36 +0000 Subject: First revision of securityplugins, called by libopiesecurity2 authentication framework (see http://dudu.dyn.2-h.org/nist/OMAF.php). --- (limited to 'noncore/securityplugins/notice') 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 @@ +.moc +.obj +Makefile 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 @@ +############################################################################# +# Makefile for building: libmultiauthnoticeplugin.so.1.0.0 +# Generated by qmake (1.05a) (Qt 3.1.2) on: Mon Jun 14 11:00:20 2004 +# Project: noticeplugin.pro +# Template: lib +# Command: $(QMAKE) -o Makefile noticeplugin.pro +############################################################################# + +####### Compiler, tools and options + +CC = $(CCACHE) $(DISTCC) gcc +CXX = $(CCACHE) $(DISTCC) g++ +LEX = flex +YACC = yacc +CFLAGS = -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 +CXXFLAGS = -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 +LEXFLAGS = +YACCFLAGS= -d +INCPATH = -I/opt/opie/mkspecs/qws/linux-generic-g++ -I. -I$(OPIEDIR)/include -I$(QTDIR)/include -I.moc/$(PLATFORM)/ +LINK = g++ +LFLAGS = $(LFLAGS_EXTRA) -Wl,-rpath-link,$(OPIEDIR)/lib -shared -Wl,-soname,libmultiauthnoticeplugin.so.1 -Wl,-rpath,/opt/opie/plugins/security +LIBS = $(SUBLIBS) -Wl,-rpath,$(QTDIR)/lib -L$(QTDIR)/lib $(LIBS_EXTRA) -lqpe -lopieui2 -L$(OPIEDIR)/lib -lqte +AR = ar cqs +RANLIB = +MOC = $(QTDIR)/bin/moc +UIC = $(QTDIR)/bin/uic +QMAKE = qmake +TAR = tar -cf +GZIP = gzip -9f +COPY = cp -f +COPY_FILE= $(COPY) -p +COPY_DIR = $(COPY) -pR +DEL_FILE = rm -f +SYMLINK = ln -sf +DEL_DIR = rmdir +MOVE = mv -f +PRO = noticeplugin.pro +CHK_DIR_EXISTS= +MKDIR = + +####### Output directory + +OBJECTS_DIR = .obj/$(PLATFORM)/ + +####### Files + +HEADERS = noticeplugin.h \ + noticepluginimpl.h \ + noticeConfigWidget.h +SOURCES = noticeplugin.cpp \ + noticepluginimpl.cpp \ + noticeConfigWidget.cpp +OBJECTS = .obj/$(PLATFORM)/noticeplugin.o \ + .obj/$(PLATFORM)/noticepluginimpl.o \ + .obj/$(PLATFORM)/noticeConfigWidget.o +FORMS = +UICDECLS = +UICIMPLS = +SRCMOC = .moc/$(PLATFORM)/moc_noticeConfigWidget.cpp +OBJMOC = .obj/$(PLATFORM)/moc_noticeConfigWidget.o +DIST = ../../../gen.pro \ + ../../../include.pro \ + noticeplugin.pro +QMAKE_TARGET = multiauthnoticeplugin +DESTDIR = $(OPIEDIR)/plugins/security/ +TARGET = libmultiauthnoticeplugin.so.1.0.0 +TARGETA = $(OPIEDIR)/plugins/security/libmultiauthnoticeplugin.a +TARGETD = libmultiauthnoticeplugin.so.1.0.0 +TARGET0 = libmultiauthnoticeplugin.so +TARGET1 = libmultiauthnoticeplugin.so.1 +TARGET2 = libmultiauthnoticeplugin.so.1.0 + +first: all +####### Implicit rules + +.SUFFIXES: .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< + +####### Build rules + +all: Makefile $(OPIEDIR)/plugins/security/$(TARGET) + +$(OPIEDIR)/plugins/security/$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) + test -d $(OPIEDIR)/plugins/security/ || mkdir -p $(OPIEDIR)/plugins/security/ + -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) + -ln -s $(TARGET) $(TARGET0) + -ln -s $(TARGET) $(TARGET1) + -ln -s $(TARGET) $(TARGET2) + -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET) + -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET0) + -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET1) + -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET2) + -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) $(OPIEDIR)/plugins/security/ + + + +staticlib: $(TARGETA) + +$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) + -$(DEL_FILE) $(TARGETA) + $(AR) $(TARGETA) $(OBJECTS) $(OBJMOC) + +mocables: $(SRCMOC) + +$(MOC): + ( cd $(QTDIR)/src/moc ; $(MAKE) ) + +Makefile: noticeplugin.pro /opt/opie/mkspecs/qws/linux-generic-g++/qmake.conf ../../../gen.pro \ + ../../../include.pro + $(QMAKE) -o Makefile noticeplugin.pro +qmake: + @$(QMAKE) -o Makefile noticeplugin.pro + +dist: + @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 + +mocclean: + -$(DEL_FILE) $(OBJMOC) + -$(DEL_FILE) $(SRCMOC) + +uiclean: + +yaccclean: +lexclean: +clean: mocclean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET) $(TARGET) + -$(DEL_FILE) $(OPIEDIR)/plugins/security/$(TARGET0) $(OPIEDIR)/plugins/security/$(TARGET1) $(OPIEDIR)/plugins/security/$(TARGET2) $(TARGETA) + + +lupdate: + lupdate -noobsolete $(PRO) + +lrelease: + lrelease $(PRO) + +ipk: + tmp=`mktemp -d /tmp/ipkg-opie.XXXXXXXXXX` && ( $(MAKE) INSTALL_ROOT="" install && ipkg-build ; rm -rf ; ) + +opie-lupdate: + opie-lupdate $(PRO) + +opie-lrelease: + opie-lrelease $(PRO) + +messages: + 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' + +FORCE: + +####### Compile + +.obj/$(PLATFORM)/noticeplugin.o: noticeplugin.cpp noticeplugin.h \ + noticeConfigWidget.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/noticeplugin.o noticeplugin.cpp + +.obj/$(PLATFORM)/noticepluginimpl.o: noticepluginimpl.cpp noticepluginimpl.h \ + noticeplugin.h \ + noticeConfigWidget.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/noticepluginimpl.o noticepluginimpl.cpp + +.obj/$(PLATFORM)/noticeConfigWidget.o: noticeConfigWidget.cpp noticeConfigWidget.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/noticeConfigWidget.o noticeConfigWidget.cpp + +.obj/$(PLATFORM)/moc_noticeConfigWidget.o: .moc/$(PLATFORM)/moc_noticeConfigWidget.cpp noticeConfigWidget.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/$(PLATFORM)/moc_noticeConfigWidget.o .moc/$(PLATFORM)/moc_noticeConfigWidget.cpp + +.moc/x86-linux/moc_noticeConfigWidget.cpp: $(MOC) noticeConfigWidget.h + $(MOC) noticeConfigWidget.h -o .moc/x86-linux/moc_noticeConfigWidget.cpp + +####### Install + +install_target: + @$(CHK_DIR_EXISTS) "$(INSTALL_ROOT)$(OPIEDIR)/lib/" || $(MKDIR) "$(INSTALL_ROOT)$(OPIEDIR)/lib/" + -$(COPY) "$(OPIEDIR)/plugins/security/$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET)" + -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET0)" + -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET1)" + -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET2)" + +uninstall_target: + -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET)" + -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET0)" + -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET1)" + -$(DEL_FILE) "$(INSTALL_ROOT)$(OPIEDIR)/lib/$(TARGET2)" + -$(DEL_DIR) "$(INSTALL_ROOT)$(OPIEDIR)/lib/" + + +install: all install_target + +uninstall: uninstall_target + 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 @@ + config MULTIAUTH_NOTICE + boolean "opie-multiauth-notice (Notice plugin for opie-multiauth)" + default "y" + 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 @@ +Package: opie-multiauth-noticeplugin +Files: plugins/security/libmultiauthnoticeplugin.so* pics/security/noticeplugin.png pics/security/noticeplugin_small.png +Priority: optional +Section: opie/settings +Maintainer: Clement Seveillac +Architecture: arm +Version: 0.0.1.6 +Depends: opie-security +Description: Notice plugin for opie-security authentication. + It allows you to display, for example, a notice from your legal departement. + 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 @@ +#include "noticeConfigWidget.h" + +#include + +#include +#include +#include +#include +#include + +/// constructs the widget, filling the noticeMLE QMultiLineEdit with the "noticeText" entry +NoticeConfigWidget::NoticeConfigWidget(QWidget* parent = 0, const char* name = "Notice configuration widget") : MultiauthConfigWidget(parent, name) +{ + QVBoxLayout *baseLayout = new QVBoxLayout( this); + baseLayout->setSpacing(11); + baseLayout->setMargin(6); + baseLayout->setAlignment( Qt::AlignTop ); + + QGroupBox *configBox = new QGroupBox(0, Qt::Vertical, tr("Set the message the user must accept"), this); + baseLayout->addWidget(configBox); + QVBoxLayout *boxLayout = new QVBoxLayout( configBox->layout() ); + + QLabel * comment1 = new QLabel("

" + tr("You may want to consult your legal department for proper wording here.") + "

", configBox); + boxLayout->addWidget(comment1); + + // Set the multilineedit box text to getNoticeText() + noticeMLE = new QMultiLineEdit(configBox, "notice text"); + noticeMLE->setWordWrap(QMultiLineEdit::WidgetWidth); + noticeMLE->setFocus(); + noticeMLE->setText(getNoticeText()); + boxLayout->addWidget(noticeMLE); + + resetNoticeButton = new QPushButton( tr("Reset notice to default"), configBox, "reset Notice Button" ); + connect(resetNoticeButton, SIGNAL( clicked() ), this, SLOT( resetNotice() )); + boxLayout->addWidget(resetNoticeButton, 0, Qt::AlignHCenter); + + QLabel * comment2 = new QLabel("

" + tr("Note: you can use HTML tags to improve its layout (example: text between <em> and </em> will be emphasized)") + "

", configBox); + boxLayout->addWidget(comment2); + +} + +/// nothing to do +NoticeConfigWidget::~NoticeConfigWidget() +{} + +/// write the notice text in the multiauth.conf Config file +void NoticeConfigWidget::writeConfig() +{ + if ( noticeMLE->edited() ) { + odebug << "writing new notice text in Security.conf" << oendl; + setNoticeText(noticeMLE->text()); + } +} + +/// reset the notice text to the hard-coded example defaultNoticeText +void NoticeConfigWidget::resetNotice() +{ + noticeMLE->setText(defaultNoticeText); +} + +/// get the notice text from the config file (with true new lines) +/** + * if no text has been defined yet returns defaultNoticeText + */ +QString NoticeConfigWidget::getNoticeText() { + m_config = new Config("Security"); + m_config->setGroup("NoticePlugin"); + // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp + QString noticeText = m_config->readEntry("noticeText", defaultNoticeText).replace( QRegExp("\\\\n"), "\n" ); + delete m_config; + return noticeText; +} + +/// set the notice text in our m_config config file (escaping new lines) +void NoticeConfigWidget::setNoticeText(QString noticeText) { + m_config = new Config("Security"); + m_config->setGroup("NoticePlugin"); + // since Config files do not allow true newlines, we replace them with litteral "\n" + m_config->writeEntry("noticeText", noticeText.replace( QRegExp("\n"), "\\n" )); + delete m_config; +} 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 @@ +/** + * \file noticeConfigWidget.h + * \brief Notice plugin configuration widget + * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) + */ +/* + =. This file is part of the Opie Project + .=l. Copyright (C) 2004 Opie Developer Team + .>+-= + _;:, .> :=|. This library is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#ifndef NOTICECONFIGWIDGET_H +#define NOTICECONFIGWIDGET_H + +#include +#include +#include + +#include + +static char defaultNoticeText [] = "

NOTICE TO USERS

\n" + "

This is a private computer system and is the property of " + "the company XXX / Mr or Ms X. It is for authorized " + "use only. Users have no expectation of privacy.

\n" + "

Unauthorized or improper use of this system may result in " + "disciplinary action and civil and criminal penalties. By continuing to use " + "this system you indicate your awareness of and consent to these " + "terms. LOG OFF IMMEDIATELY if you do not agree to them.

"; + +class NoticeConfigWidget : public MultiauthConfigWidget { + + Q_OBJECT + +public: + NoticeConfigWidget(QWidget* parent, const char* name); + virtual ~NoticeConfigWidget(); + virtual void writeConfig(); +private: + QMultiLineEdit * noticeMLE; + QPushButton * resetNoticeButton; +private slots: + void resetNotice(); +private: + Config * m_config; + QString getNoticeText(); + void setNoticeText(QString noticeText); +}; + +#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 @@ +#include "noticeplugin.h" + +#include + +#include +#include + +/// creates and initializes the m_config Config object +NoticePlugin::NoticePlugin() : MultiauthPluginObject(), noticeW(0) { + m_config = new Config("Security"); + m_config->setGroup("NoticePlugin"); +} + +/// deletes the m_config Config object and noticeW if necessary +NoticePlugin::~NoticePlugin() { + delete m_config; + if (noticeW != 0) + delete noticeW; +} + +/// Simply return its name (Notice plugin) +QString NoticePlugin::pluginName() const { + return "Notice plugin"; +} + +/// return the Notice widget configuration widget +/** + * \return noticeW, the NoticeConfigWidget + */ +MultiauthConfigWidget * NoticePlugin::configWidget(QWidget * parent) { + if (noticeW == 0) + noticeW = new NoticeConfigWidget(parent, "Notice configuration widget"); + return noticeW; +} + +/// return the path of the small tab icon +QString NoticePlugin::pixmapNameConfig() const { + return "security/noticeplugin_small"; +} + +/// return the path of the big icon for the active/order checklist +QString NoticePlugin::pixmapNameWidget() const { + return "security/noticeplugin"; +} + +/// Displays the configured message and an 'Accept' button +/** + * \return the outcome code of this authentication (can be only success) + */ +int NoticePlugin::authenticate() { + QMessageBox noticeDialog("Notice plugin", + getNoticeText(), + QMessageBox::Warning, + QMessageBox::Yes, + 0, + 0, + 0, + "notice plugin dialog", + true, + Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop); + + noticeDialog.setButtonText(QMessageBox::Yes, "I accept"); + + QRect desk = oApp->desktop()->geometry(); + noticeDialog.setGeometry( 0, 0, desk.width(), desk.height() ); + + switch (noticeDialog.exec()) + { + case QMessageBox::Yes: + return MultiauthPluginObject::Success; + } + return 255; //should not be returned anyway +} + +/// get the notice text from our m_config config file (with true new lines) +/** + * if no text has been defined yet returns defaultNoticeText + */ +QString NoticePlugin::getNoticeText() { + // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp + return m_config->readEntry("noticeText", defaultNoticeText).replace( QRegExp("\\\\n"), "\n" ); +} + 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 @@ +/** + * \file noticeplugin.h + * \brief Standard Opie multiauth plugin definition + * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) + */ +/* + =. This file is part of the Opie Project + .=l. Copyright (C) 2004 Opie Developer Team + .>+-= + _;:, .> :=|. This library is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#ifndef NOTICE_PLUGIN_H +#define NOTICE_PLUGIN_H + +#include +#include +#include +#include "noticeConfigWidget.h" + +/// Multi-authentication plugin, having the user accept a (legal, etc.) notice text. +/** + * The plugin itself, implementing the main authenticate() function. + */ +class NoticePlugin : public MultiauthPluginObject { + +public: + NoticePlugin(); + virtual ~NoticePlugin(); + int authenticate(); + MultiauthConfigWidget * configWidget(QWidget * parent); + QString pixmapNameConfig() const; + QString pixmapNameWidget() const; + QString pluginName() const; +private: + NoticeConfigWidget * noticeW; + Config * m_config; + QString getNoticeText(); +}; + +#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 @@ +TEMPLATE = lib +CONFIG += qt warn_on + +HEADERS = noticeplugin.h noticepluginimpl.h noticeConfigWidget.h + +SOURCES = noticeplugin.cpp noticepluginimpl.cpp noticeConfigWidget.cpp + + +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += + +LIBS += -lqpe -lopieui2 + +DESTDIR = $(OPIEDIR)/plugins/security +TARGET = multiauthnoticeplugin + +include ( $(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 @@ +#include "noticepluginimpl.h" + +NoticePluginImpl::NoticePluginImpl() { + noticePlugin = new NoticePlugin(); +} + +NoticePluginImpl::~NoticePluginImpl() { + delete noticePlugin; +} + +MultiauthPluginObject* NoticePluginImpl::plugin() { + return noticePlugin; +} + + Q_EXPORT_INTERFACE() { + Q_CREATE_INSTANCE( NoticePluginImpl ) + } + +QRESULT NoticePluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { + *iface = 0; + if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MultiauthPluginInterface ) ) { + *iface = this, (*iface)->addRef(); + } else { + return QE_NOINTERFACE; + } + return QS_OK; + +} 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 @@ +/** + * \file noticepluginimpl.h + * \brief Standard Opie multiauth plugin definition + * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) + */ +/* + =. This file is part of the Opie Project + .=l. Copyright (C) 2004 Opie Developer Team + .>+-= + _;:, .> :=|. This library is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#ifndef NOTICE_PLUGIN_IMPL +#define NOTICE_PLUGIN_IMPL + +#include "noticeplugin.h" + +/** + * \brief Standard multiauth plugin class + */ +class NoticePluginImpl : public MultiauthPluginInterface{ + + public: + NoticePluginImpl(); + virtual ~NoticePluginImpl(); + + QRESULT queryInterface( const QUuid &, QUnknownInterface** ); + /// defines standard addRef() and release() functions + Q_REFCOUNT; + + virtual MultiauthPluginObject *plugin(); + + private: + /// the plugin itself + NoticePlugin *noticePlugin; + ulong ref; +}; + +#endif + -- cgit v0.9.0.2