You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
250 lines
6.4 KiB
250 lines
6.4 KiB
15 years ago
|
/*
|
||
|
|
||
13 years ago
|
Shell for tdm conversation plugins
|
||
15 years ago
|
|
||
|
Copyright (C) 1997, 1998 Steffen Hansen <hansen@kde.org>
|
||
|
Copyright (C) 2000-2004 Oswald Buddenhagen <ossi@kde.org>
|
||
|
|
||
|
|
||
|
This program is free software; you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License as published by
|
||
|
the Free Software Foundation; either version 2 of the License, or
|
||
|
(at your option) any later version.
|
||
|
|
||
|
This program is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with this program; if not, write to the Free Software
|
||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
|
||
|
*/
|
||
|
|
||
|
|
||
|
#ifndef KGVERIFY_H
|
||
|
#define KGVERIFY_H
|
||
|
|
||
|
#include "kgreeterplugin.h"
|
||
|
#include "kfdialog.h"
|
||
|
|
||
13 years ago
|
#include <tqlayout.h>
|
||
15 years ago
|
#include <tqtimer.h>
|
||
|
#include <tqvaluevector.h>
|
||
15 years ago
|
|
||
|
#include <sys/time.h>
|
||
|
#include <time.h>
|
||
|
|
||
|
// helper class, nuke when qt supports suspend()/resume()
|
||
15 years ago
|
class QXTimer : public TQObject {
|
||
15 years ago
|
Q_OBJECT
|
||
15 years ago
|
typedef TQObject inherited;
|
||
15 years ago
|
|
||
|
public:
|
||
|
QXTimer();
|
||
|
void start( int msec );
|
||
|
void stop();
|
||
|
void suspend();
|
||
|
void resume();
|
||
|
|
||
|
signals:
|
||
|
void timeout();
|
||
|
|
||
|
private slots:
|
||
|
void slotTimeout();
|
||
|
|
||
|
private:
|
||
15 years ago
|
TQTimer timer;
|
||
15 years ago
|
struct timeval stv;
|
||
|
long left;
|
||
|
};
|
||
|
|
||
|
class KGVerifyHandler {
|
||
|
public:
|
||
|
virtual void verifyPluginChanged( int id ) = 0;
|
||
|
virtual void verifyClear();
|
||
|
virtual void verifyOk() = 0;
|
||
|
virtual void verifyFailed() = 0;
|
||
|
virtual void verifyRetry() = 0;
|
||
15 years ago
|
virtual void verifySetUser( const TQString &user ) = 0;
|
||
14 years ago
|
virtual void updateStatus( bool fail, bool caps, int left ); // for themed only
|
||
15 years ago
|
};
|
||
|
|
||
15 years ago
|
class TQWidget;
|
||
|
class TQLabel;
|
||
|
class TQPopupMenu;
|
||
|
class TQTimer;
|
||
15 years ago
|
class KPushButton;
|
||
|
class KLibrary;
|
||
|
|
||
|
struct GreeterPluginHandle {
|
||
|
KLibrary *library;
|
||
|
kgreeterplugin_info *info;
|
||
|
};
|
||
|
|
||
15 years ago
|
typedef TQValueVector<int> PluginList;
|
||
15 years ago
|
|
||
15 years ago
|
class KGVerify : public TQObject, public KGreeterPluginHandler {
|
||
15 years ago
|
Q_OBJECT
|
||
15 years ago
|
typedef TQObject inherited;
|
||
15 years ago
|
|
||
|
public:
|
||
|
KGVerify( KGVerifyHandler *handler, KdmThemer *themer,
|
||
15 years ago
|
TQWidget *parent, TQWidget *predecessor,
|
||
|
const TQString &fixedEntity, const PluginList &pluginList,
|
||
15 years ago
|
KGreeterPlugin::Function func, KGreeterPlugin::Context ctx );
|
||
|
virtual ~KGVerify();
|
||
15 years ago
|
TQPopupMenu *getPlugMenu();
|
||
|
void loadUsers( const TQStringList &users );
|
||
|
void presetEntity( const TQString &entity, int field );
|
||
|
TQString getEntity() const;
|
||
|
void setUser( const TQString &user );
|
||
13 years ago
|
void setPassword( const TQString &pass );
|
||
15 years ago
|
/* virtual */ void selectPlugin( int id );
|
||
|
bool entitiesLocal() const;
|
||
|
bool entitiesFielded() const;
|
||
|
bool entityPresettable() const;
|
||
|
bool isClassic() const;
|
||
15 years ago
|
TQString pluginName() const;
|
||
15 years ago
|
void setEnabled( bool on );
|
||
|
void abort();
|
||
|
void suspend();
|
||
|
void resume();
|
||
|
void accept();
|
||
|
void reject();
|
||
|
|
||
|
int coreLock;
|
||
|
|
||
15 years ago
|
static bool handleFailVerify( TQWidget *parent );
|
||
|
static PluginList init( const TQStringList &plugins );
|
||
15 years ago
|
static void done();
|
||
|
|
||
|
public slots:
|
||
|
void start();
|
||
|
|
||
|
protected:
|
||
15 years ago
|
bool eventFilter( TQObject *, TQEvent * );
|
||
|
void MsgBox( TQMessageBox::Icon typ, const TQString &msg );
|
||
15 years ago
|
void setTimer();
|
||
14 years ago
|
void updateLockStatus();
|
||
|
virtual void updateStatus() = 0;
|
||
15 years ago
|
void handleVerify();
|
||
|
|
||
|
QXTimer timer;
|
||
15 years ago
|
TQString fixedEntity, presEnt, curUser;
|
||
15 years ago
|
PluginList pluginList;
|
||
|
KGVerifyHandler *handler;
|
||
|
KdmThemer *themer;
|
||
15 years ago
|
TQWidget *parent, *predecessor;
|
||
15 years ago
|
KGreeterPlugin *greet;
|
||
15 years ago
|
TQPopupMenu *plugMenu;
|
||
15 years ago
|
int curPlugin, presFld, timedLeft, deadTicks;
|
||
15 years ago
|
TQCString pName;
|
||
15 years ago
|
KGreeterPlugin::Function func;
|
||
|
KGreeterPlugin::Context ctx;
|
||
|
bool capsLocked;
|
||
|
bool enabled, running, suspended, failed, delayed, cont;
|
||
|
bool authTok, isClear, timeable;
|
||
|
|
||
15 years ago
|
static void VMsgBox( TQWidget *parent, const TQString &user, TQMessageBox::Icon type, const TQString &mesg );
|
||
|
static void VErrBox( TQWidget *parent, const TQString &user, const char *msg );
|
||
|
static void VInfoBox( TQWidget *parent, const TQString &user, const char *msg );
|
||
15 years ago
|
|
||
15 years ago
|
static TQValueVector<GreeterPluginHandle> greetPlugins;
|
||
15 years ago
|
|
||
|
private:
|
||
|
bool applyPreset();
|
||
|
void performAutoLogin();
|
||
|
bool scheduleAutoLogin( bool initial );
|
||
|
void doReject( bool initial );
|
||
|
|
||
|
private slots:
|
||
|
//virtual void slotPluginSelected( int id ) = 0;
|
||
|
void slotTimeout();
|
||
|
void slotActivity();
|
||
|
|
||
|
public: // from KGreetPluginHandler
|
||
|
virtual void gplugReturnText( const char *text, int tag );
|
||
|
virtual void gplugReturnBinary( const char *data );
|
||
15 years ago
|
virtual void gplugSetUser( const TQString &user );
|
||
15 years ago
|
virtual void gplugStart();
|
||
|
virtual void gplugActivity();
|
||
15 years ago
|
virtual void gplugMsgBox( TQMessageBox::Icon type, const TQString &text );
|
||
15 years ago
|
|
||
15 years ago
|
static TQVariant getConf( void *ctx, const char *key, const TQVariant &dflt );
|
||
15 years ago
|
};
|
||
|
|
||
|
class KGStdVerify : public KGVerify {
|
||
|
Q_OBJECT
|
||
|
typedef KGVerify inherited;
|
||
|
|
||
|
public:
|
||
15 years ago
|
KGStdVerify( KGVerifyHandler *handler, TQWidget *parent,
|
||
|
TQWidget *predecessor, const TQString &fixedEntity,
|
||
15 years ago
|
const PluginList &pluginList,
|
||
|
KGreeterPlugin::Function func, KGreeterPlugin::Context ctx );
|
||
|
virtual ~KGStdVerify();
|
||
14 years ago
|
TQLayout *getLayout() const { return TQT_TQLAYOUT(grid); }
|
||
15 years ago
|
void selectPlugin( int id );
|
||
|
|
||
|
protected:
|
||
14 years ago
|
void updateStatus();
|
||
15 years ago
|
|
||
|
private:
|
||
15 years ago
|
TQGridLayout *grid;
|
||
|
TQLabel *failedLabel;
|
||
15 years ago
|
int failedLabelState;
|
||
|
|
||
|
private slots:
|
||
|
void slotPluginSelected( int id );
|
||
|
};
|
||
|
|
||
|
class KGThemedVerify : public KGVerify {
|
||
|
Q_OBJECT
|
||
|
typedef KGVerify inherited;
|
||
|
|
||
|
public:
|
||
|
KGThemedVerify( KGVerifyHandler *handler, KdmThemer *themer,
|
||
15 years ago
|
TQWidget *parent, TQWidget *predecessor,
|
||
|
const TQString &fixedEntity,
|
||
15 years ago
|
const PluginList &pluginList,
|
||
|
KGreeterPlugin::Function func,
|
||
|
KGreeterPlugin::Context ctx );
|
||
|
virtual ~KGThemedVerify();
|
||
|
void selectPlugin( int id );
|
||
|
|
||
|
protected:
|
||
14 years ago
|
void updateStatus();
|
||
15 years ago
|
|
||
|
private slots:
|
||
|
void slotPluginSelected( int id );
|
||
|
};
|
||
|
|
||
|
class KGChTok : public FDialog, public KGVerifyHandler {
|
||
|
Q_OBJECT
|
||
|
typedef FDialog inherited;
|
||
|
|
||
|
public:
|
||
15 years ago
|
KGChTok( TQWidget *parent, const TQString &user,
|
||
15 years ago
|
const PluginList &pluginList, int curPlugin,
|
||
|
KGreeterPlugin::Function func, KGreeterPlugin::Context ctx );
|
||
|
~KGChTok();
|
||
|
|
||
|
public slots:
|
||
|
void accept();
|
||
|
|
||
|
private:
|
||
|
KPushButton *okButton, *cancelButton;
|
||
|
KGStdVerify *verify;
|
||
|
|
||
|
public: // from KGVerifyHandler
|
||
|
virtual void verifyPluginChanged( int id );
|
||
|
virtual void verifyOk();
|
||
|
virtual void verifyFailed();
|
||
|
virtual void verifyRetry();
|
||
15 years ago
|
virtual void verifySetUser( const TQString &user );
|
||
15 years ago
|
};
|
||
|
|
||
|
#endif /* KGVERIFY_H */
|