--- /dev/null
+README for src Directory
+=========================
+
+The following (sub-)directories exist:
+
+.
+ main build directory, contains main widget and some global classes
+
+wbase
+ Web object base classes.
+
+wob
+ generated web objects - auto created by woc from ../wob/magicsmoke.wolf
+
+iface
+ MagicSmoke web interface classes (derived from wbase/*)
+
+widgets
+ some simple helper widgets
+
+templates
+ template handling and renderers
+ printing
+
+misc
+ miscellaneous helper functions and classes
+ (eg. code-39 barcodes, crash-handling, xml escaping)
+
+images
+ image files, icons
+
+crypto
+ cryptographic functions and helpers (key generator)
+
+dialogs
+ dialogs for sub-tasks, like displaying events/orders/etc.pp.
+
+mwin
+ main overview window and its sub-widgets (tabs)
--- /dev/null
+HEADERS += \
+ crypto/keygen.h \
+ crypto/hmac.h
+
+SOURCES += \
+ crypto/keygen.cpp \
+ crypto/hmac.cpp
+
+INCLUDEPATH += ./crypto
\ No newline at end of file
--- /dev/null
+HEADERS += \
+ dialogs/configdialog.h \
+ dialogs/eventedit.h \
+ dialogs/eventsummary.h \
+ dialogs/orderwin.h \
+ dialogs/moneylog.h
+
+SOURCES += \
+ dialogs/configdialog.cpp \
+ dialogs/eventedit.cpp \
+ dialogs/eventsummary.cpp \
+ dialogs/orderwin.cpp \
+ dialogs/moneylog.cpp
+
+INCLUDEPATH += ./dialogs
\ No newline at end of file
+++ /dev/null
-//
-// C++ Implementation: host
-//
-// Description:
-//
-//
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-
-#include "host.h"
-#include "keygen.h"
-#include "msinterface.h"
-
-#include <QCoreApplication>
-#include <QRegExp>
-
-#define req (MSInterface::instance())
-
-MHost::MHost(QString n,QString k)
-{
- setname(n);
- setkey(k);
-}
-
-
-int MHost::newKey()
-{
- int r=getEntropy();
- setkey(QString(getRandom(40).toHex()));
- if(r<(40*8))return r;
- else return 40*8;
-}
-
-bool MHost::create()
-{
- //do not attempt to save invalid or incomplete data
- if(!isValid())return false;
- MTSetHost ch=req->querySetHost(name(),key());
- //check success
- return ch.stage()==ch.Success;
-}
-
-bool MHost::save()
-{
- //do not attempt to save invalid or incomplete data
- if(!isValid())return false;
- MTSetHost ch=req->querySetHost(name(),key());
- //check success
- return ch.stage()==ch.Success;
-}
-
-void MHost::deleteHost()
-{
- if(!isValid())return;
- req->queryDeleteHost(name());
-}
+++ /dev/null
-//
-// C++ Interface: host
-//
-// Description:
-//
-//
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-
-#ifndef MAGICSMOKE_HOST_H
-#define MAGICSMOKE_HOST_H
-
-#include <QString>
-#include <MOHost.h>
-
-/**this class wraps MOHost and adds some convenience methods*/
-class MHost:public MOHost
-{
- public:
- /**create invalid host*/
- MHost():MOHost(){}
- /**create host by name*/
- MHost(QString,QString k=QString());
- /**copy host*/
- MHost(const MHost&h):MOHost(h){}
-
- /**returns host name*/
- QString hostId(){return name();}
-
- /**returns host key (fetches it from DB if not known yet)*/
- QString hostKey(){return key();}
-
- /**checks host name*/
- bool isValid(){return name().value()!="";}
-
- /**creates new host key for this host; returns number of entropy bits*/
- int newKey();
-
- /**creates host in database; returns true on success*/
- bool create();
-
- /**updates host key in database; returns true on success*/
- bool save();
-
- /**deletes host from database*/
- void deleteHost();
-};
-
-#endif
--- /dev/null
+HEADERS += \
+ iface/msinterface.h \
+ iface/sslexception.h
+
+
+SOURCES += \
+ iface/msinterface.cpp \
+ iface/sslexception.cpp
+
+INCLUDEPATH += ./iface
\ No newline at end of file
--- /dev/null
+HEADERS += \
+ misc/debug.h \
+ misc/misc.h \
+ misc/domquery.h
+
+SOURCES += \
+ misc/code39.cpp \
+ misc/debug.cpp \
+ misc/misc.cpp \
+ misc/domquery.cpp
+
+INCLUDEPATH += ./misc
\ No newline at end of file
--- /dev/null
+HEADERS += \
+ mwin/overview.h
+
+SOURCES += \
+ mwin/overview.cpp
+
+INCLUDEPATH += ./mwin
\ No newline at end of file
SOURCES = \
main.cpp \
- debug.cpp \
- misc.cpp \
- keygen.cpp \
login.cpp \
- configdialog.cpp \
- hmac.cpp \
- code39.cpp \
- overview.cpp \
- eventedit.cpp \
event.cpp \
- user.cpp \
- host.cpp \
order.cpp \
shipping.cpp \
- customer.cpp \
- eventsummary.cpp \
- odtrender.cpp \
- ticketrender.cpp \
- orderwin.cpp \
- labeldlg.cpp \
- templates.cpp \
- templatedlg.cpp \
- office.cpp \
- moneylog.cpp \
- domquery.cpp \
- msinterface.cpp \
- sslexception.cpp
+ customer.cpp
HEADERS = \
main.h \
- keygen.h \
- debug.h \
login.h \
- configdialog.h \
- hmac.h \
- overview.h \
- eventedit.h \
event.h \
- user.h \
- host.h \
order.h \
shipping.h \
- customer.h \
- eventsummary.h \
- odtrender.h \
- ticketrender.h \
- orderwin.h \
- labeldlg.h \
- misc.h \
- templates.h \
- templatedlg.h \
- office.h \
- moneylog.h \
- domquery.h \
- msinterface.h \
- sslexception.h
+ customer.h
-RESOURCES += files.qrc
+RESOURCES += images/files.qrc
TRANSLATIONS = \
smoke_de.ts \
include(../zip/zip.pri)
include(widgets/widgets.pri)
include(wbase/wbase.pri)
+include(templates/templates.pri)
+include(iface/iface.pri)
+include(misc/misc.pri)
+include(crypto/crypto.pri)
+include(dialogs/dialogs.pri)
+include(mwin/mwin.pri)
+
+#build generated stuff last
include(wob/wob.pri)
--- /dev/null
+HEADERS += \
+ templates/odtrender.h \
+ templates/ticketrender.h \
+ templates/office.h \
+ templates/labeldlg.h \
+ templates/templates.h \
+ templates/templatedlg.h
+
+SOURCES += \
+ templates/odtrender.cpp \
+ templates/ticketrender.cpp \
+ templates/office.cpp \
+ templates/labeldlg.cpp \
+ templates/templates.cpp \
+ templates/templatedlg.cpp
+
+INCLUDEPATH += ./templates
\ No newline at end of file
+++ /dev/null
-//
-// C++ Implementation: user
-//
-// Description:
-//
-//
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-
-#include "user.h"
-#include "msinterface.h"
-
-#include <QCoreApplication>
-#include <QDomElement>
-#include <QRegExp>
-
-#define req (MSInterface::instance())
-
-bool MUser::isValid()
-{
- return QRegExp("[A-Za-z0-9_\\.,:-]+").exactMatch(name().value());
-}
-
-bool MUser::create(QString pwd)
-{
- //do not attempt to save invalid or incomplete data
- if(!isValid())return false;
- //call
- MTCreateUser cu=req->queryCreateUser(name(),pwd,"");
- //check success
- if(cu.stage()==cu.Success){
- operator=(cu.getuser().value());
- return true;
- }else{
- return false;
- }
-}
-
-bool MUser::changePassword(QString pwd)
-{
- //do not attempt to save invalid or incomplete data
- if(!isValid())return false;
- //call
- MTChangePassword cp=req->queryChangePassword(name(),pwd);
- //check success
- if(cp.stage()==cp.Success){
- return true;
- }else{
- return false;
- }
-}
-
-QString MUser::deleteUser(QString replace)
-{
- if(!isValid())return QCoreApplication::translate("MUser","User not valid: cannot delete.");
- MTDeleteUser du=req->queryDeleteUser(name(),replace);
- if(du.stage()!=du.Success)
- return " "+QCoreApplication::translate("php::",du.errorString().toAscii());
- else
- return QString();
-}
-
-bool MUser::setDescription(QString d)
-{
- //do not attempt to save invalid or incomplete data
- if(!isValid())return false;
- //call
- MTSetUserDescription sud=req->querySetUserDescription(name(),d);
- //check success
- if(sud.stage()==sud.Success){
- setdescription(d);
- return true;
- }else{
- return false;
- }
-}
-
-MCheckList MUser::getRoles()
-{
- //call
- MTGetUserRoles gr=req->queryGetUserRoles(name());
- //check success
- MCheckList ret;
- //TODO: also get roles we don't have and do something about rights
- if(gr.stage()==gr.Success){
- QList<QString>lr=gr.getroles();
- for(int i=0;i<lr.size();i++)
- ret.addItem(new MAcl(lr[i],true));
- }
- return ret;
-}
-
-bool MUser::setRoles(const MCheckList&cl)
-{/* TODO
- //create DOM
- QList<MOUserRole>lr;
- for(int i=0;i<cl.size();i++){
- MOUserRole ur;
- ur.setusername(cl[i].key());
- ur.setisset(cl[i].isSet());
- lr.append(ur);
- }
- //request
- MTSetUserRoles sur=req->querySetUserRoles(name(),lr);
- if(sur.stage()==sur.Success)return true;
- else*/ return false;
-}
-
-MCheckList MUser::getHosts()
-{/*TODO
- //call
- MTGetUserHosts gh=req->queryGetUserHosts(name());
- //check success
- MCheckList ret;
- if(gh.stage()==gh.Success){
- QList<MOHostAcl> hl=gh.gethosts();
- for(int i=0;i<hl.size();i++){
- ret.addItem(new MUserHost(hl[i]));
- }
- }
- return ret;*/ return MCheckList();
-}
-
-bool MUser::setHosts(const MCheckList&cl)
-{/*TODO
- //create DOM
- QList<MOHostAcl> hal;
- for(int i=0;i<cl.size();i++){
- MOHostAcl ha;
- ha.sethostname(cl[i].key());
- ha.setisset(cl[i].isSet());
- hal.append(ha);
- }
- //request
- MTSetUserHosts suh=req->querySetUserHosts(name(),hal);
- if(suh.stage()==suh.Success)return true;
- else*/ return false;
-}
-
-/********************************************************/
-
-MAcl::MAcl()
-{
- m_set=false;
-}
-
-MAcl::MAcl(const MAcl&a)
- :MCheckItem()
-{
- m_role=a.m_role;
- m_set=a.m_set;
-}
-
-MAcl::MAcl(QString r,bool s)
-{
- m_role=r;
- m_set=s;
-}
-
-QString MAcl::role()const
-{
- return m_role;
-}
-
-QString MAcl::key()const
-{
- return m_role;
-}
-
-QString MAcl::description()const
-{
- return QCoreApplication::translate("TransactionNames::",m_role.toAscii().data());
-}
-
-QString MAcl::label()const
-{
- QString d=description();
- if(d==m_role)return m_role;
- else return m_role+": "+d;
-}
-
-bool MAcl::isSet()const
-{
- return m_set;
-}
-
-void MAcl::set(bool b)
-{
- m_set=b;
-}
-
-MCheckItem* MAcl::copy()const
-{
- return new MAcl(*this);
-}
-
-/**************************************************/
-
-MUserHost::MUserHost()
-{
- m_set=false;
-}
-
-MUserHost::MUserHost(const MUserHost&h)
- :MCheckItem()
-{
- m_host=h.m_host;
- m_set=h.m_set;
-}
-
-MUserHost::MUserHost(QString h,bool s)
-{
- m_host=h;
- m_set=s;
-}
-
-/*TODO
-MUserHost::MUserHost(const MOHostAcl&a)
-{
- m_host=a.hostname();
- m_set=a.isset();
-}*/
-
-QString MUserHost::host()const
-{
- return m_host;
-}
-
-QString MUserHost::key()const
-{
- return m_host;
-}
-
-QString MUserHost::label()const
-{
- QString d=QCoreApplication::translate("SpecialHost",m_host.toAscii().data());
- if(d!=m_host)return m_host+": "+d;
- else return m_host;
-}
-
-bool MUserHost::isSet()const
-{
- return m_set;
-}
-
-void MUserHost::set(bool b)
-{
- m_set=b;
-}
-
-MCheckItem* MUserHost::copy()const
-{
- return new MUserHost(*this);
-}
+++ /dev/null
-//
-// C++ Interface: user
-//
-// Description:
-//
-//
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-
-#ifndef MAGICSMOKE_USER_H
-#define MAGICSMOKE_USER_H
-
-#include <QString>
-
-#include "checkdlg.h"
-
-#include "MOUser.h"
-
-class MUser:public MOUser
-{
- public:
- /**create invalid user*/
- MUser():MOUser(){}
- /**create user by name*/
- MUser(QString i){setname(i);}
- /**copy user*/
- MUser(const MUser&u):MOUser(u){}
-
- /**copy user*/
- MUser& operator=(const MOUser&u){MOUser::operator=(u);return *this;}
-
- /**checks user name*/
- bool isValid();
-
- /**creates user in database with an initial password; returns true on success*/
- bool create(QString pwd);
-
- /**deletes user from database; optionally: replace it by another existing user; returns an empty string on success or an error message on failure (may be a single space if no message was sent)*/
- QString deleteUser(QString replace=QString());
-
- /**sets new description, both locally and on server*/
- bool setDescription(QString);
-
- /**returns roles of this user (queries server); returns empty list if call fails, returns filled list if call succeeds, the bool will contain whether the user has the role*/
- MCheckList getRoles();
-
- /**sends the updated roles to the server; returns true on success*/
- bool setRoles(const MCheckList&);
-
- /**returns hosts that a user may connect from*/
- MCheckList getHosts();
-
- /**send the updated host list of the user to the server; returns true on success*/
- bool setHosts(const MCheckList&);
-
- /**change the password of this user; returns whether successful*/
- bool changePassword(QString);
-};
-
-/**overwrites MCheckItem to represent an ACL item for the user*/
-class MAcl:public MCheckItem
-{
- public:
- MAcl();
- MAcl(const MAcl&);
- MAcl(QString,bool);
-
- /**returns the role this ACL represents*/
- virtual QString role()const;
- /**returns the role this ACL represents*/
- virtual QString key()const;
- /**attempts to translate the role using the currently active language, this should yield a description of the role if successful or the role name if it fails*/
- virtual QString description()const;
- /**returns a usable label (role name + description) for the MCheckDialog */
- virtual QString label()const;
- /**returns whether the role is set for this user*/
- virtual bool isSet()const;
- /**changes the role setting (used by MCheckDialog)*/
- virtual void set(bool);
-
- protected:
- virtual MCheckItem* copy()const;
- private:
- QString m_role;
- bool m_set;
-};
-
-// class MOHostAcl;
-/**overwrites MCheckItem to represent a host item for the user*/
-class MUserHost:public MCheckItem
-{
- public:
- MUserHost();
- MUserHost(const MUserHost&);
- MUserHost(QString,bool);
- //MUserHost(const MOHostAcl&);
-
- /**returns the host this item represents*/
- virtual QString host()const;
- /**returns the host this item represents*/
- virtual QString key()const;
- /**returns a usable label (host name + opt. description for special hosts) for the MCheckDialog */
- virtual QString label()const;
- /**returns whether the host is allowed for this user*/
- virtual bool isSet()const;
- /**changes the host setting (used by MCheckDialog)*/
- virtual void set(bool);
-
- protected:
- virtual MCheckItem* copy()const;
- private:
- QString m_host;
- bool m_set;
-};
-
-#endif
-IDI_ICON1 ICON DISCARDABLE "icon.ico"
+IDI_ICON1 ICON DISCARDABLE "images\icon.ico"
#include "qtout.h"
#include "htmlout.h"
-#include "../src/domquery.h"
+#include "domquery.h"
#include <QDir>
#include <QDomDocument>
qtout.cpp \
phpout.cpp \
htmlout.cpp \
- ../src/domquery.cpp
+ ../src/misc/domquery.cpp
HEADERS+= \
processor.h \
phpout.h \
qtout.h \
htmlout.h \
- ../src/domquery.h
\ No newline at end of file
+ ../src/misc/domquery.h
+
+INCLUDEPATH += ../src/misc
\ No newline at end of file