├── svn └── .svn │ ├── entries │ ├── format │ ├── wc.db-journal │ └── wc.db ├── import.cpp ├── refill.cpp ├── repairs.cpp ├── delivery.cpp ├── discount.cpp ├── gmail_smtp.cpp ├── back_ground_global.png ├── repair_report.cpp ├── SmtpClient-for-Qt-1.1 ├── demos │ ├── demo2 │ │ ├── printscreen.png │ │ ├── demo2.pro │ │ ├── demo2.cpp │ │ ├── sendemail.h │ │ └── sendemail.cpp │ ├── demo3 │ │ ├── demo3.pro │ │ └── demo3.cpp │ ├── demo4 │ │ ├── demo4.pro │ │ └── demo4.cpp │ └── demo1 │ │ ├── demo1.pro │ │ └── demo1.cpp ├── src │ ├── smtpexports.h │ ├── SmtpMime │ ├── quotedprintable.h │ ├── mimecontentformatter.h │ ├── mimeinlinefile.cpp │ ├── mimeattachment.cpp │ ├── mimeattachment.h │ ├── mimehtml.cpp │ ├── mimeinlinefile.h │ ├── mimehtml.h │ ├── mimetext.h │ ├── mimefile.h │ ├── emailaddress.cpp │ ├── mimetext.cpp │ ├── emailaddress.h │ ├── mimefile.cpp │ ├── mimecontentformatter.cpp │ ├── mimemultipart.h │ ├── quotedprintable.cpp │ ├── mimemultipart.cpp │ ├── mimemessage.h │ ├── mimepart.h │ └── smtpclient.h ├── SMTPEmail.pro └── README.md ├── gmail_smtp.h ├── delivery.h ├── stats.h ├── discount.h ├── repair_report.h ├── stats.cpp ├── productstat.h ├── statistique.h ├── repairs.h ├── session.h ├── import.h ├── uipassword.h ├── inputcontrol.h ├── mainwindow.h ├── .gitignore ├── import_order.h ├── discount_event.h ├── slicepiewidget.h ├── statistique.cpp ├── statfinanace.h ├── piechartwidget.h ├── uiquicklog.h ├── refill.h ├── client.h ├── mytimer.h ├── import_order.cpp ├── mouvement.h ├── agepyramidwidget.h ├── promotionnal.h ├── session.cpp ├── refill_order.h ├── uioptions.h ├── corporate.h ├── Advance.h ├── Proget_commerce.pro ├── mouvement.cpp ├── style.qss ├── uicrm.h ├── bargraphwidget.h ├── smtp.h ├── productstat.cpp ├── driver.h ├── Fares_inventory.pro ├── mytimer.cpp ├── raises.h ├── event.h ├── customer.h ├── promotion.h ├── Charge.h ├── uipassword.cpp ├── truck.h ├── manager.h ├── product.h ├── Payment_report.h ├── uiquicklog.cpp ├── Supplier.h ├── statfinanace.cpp ├── order.h ├── discount_event.cpp ├── client.cpp ├── stmp.h ├── corporate.cpp ├── customer.cpp ├── shift.cpp ├── vacation.h ├── sale.h ├── Advance.cpp ├── event.cpp ├── shift.h ├── Financial_balance.h ├── uifinance.h ├── menu_inventory.h ├── promotionnal.cpp ├── Hamadi.pro ├── Charge.cpp ├── manager.cpp ├── uisales.h ├── driver.cpp ├── refill_order.cpp ├── piechartwidget.cpp ├── main.cpp ├── uipassword.ui └── slicepiewidget.cpp /svn/.svn/entries: -------------------------------------------------------------------------------- 1 | 12 2 | -------------------------------------------------------------------------------- /svn/.svn/format: -------------------------------------------------------------------------------- 1 | 12 2 | -------------------------------------------------------------------------------- /svn/.svn/wc.db-journal: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /import.cpp: -------------------------------------------------------------------------------- 1 | #include "import.h" 2 | 3 | import::import() 4 | { 5 | 6 | } 7 | 8 | -------------------------------------------------------------------------------- /refill.cpp: -------------------------------------------------------------------------------- 1 | #include "refill.h" 2 | 3 | refill::refill() 4 | { 5 | 6 | } 7 | 8 | -------------------------------------------------------------------------------- /repairs.cpp: -------------------------------------------------------------------------------- 1 | #include "repairs.h" 2 | 3 | repairs::repairs() 4 | { 5 | 6 | } 7 | 8 | -------------------------------------------------------------------------------- /delivery.cpp: -------------------------------------------------------------------------------- 1 | #include "delivery.h" 2 | 3 | Delivery::Delivery() 4 | { 5 | 6 | } 7 | 8 | -------------------------------------------------------------------------------- /discount.cpp: -------------------------------------------------------------------------------- 1 | #include "discount.h" 2 | 3 | discount::discount() 4 | { 5 | 6 | } 7 | 8 | -------------------------------------------------------------------------------- /svn/.svn/wc.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mariamcheikh/ERP-Aplication/HEAD/svn/.svn/wc.db -------------------------------------------------------------------------------- /gmail_smtp.cpp: -------------------------------------------------------------------------------- 1 | #include "gmail_smtp.h" 2 | 3 | gmail_smtp::gmail_smtp() 4 | { 5 | 6 | } 7 | 8 | -------------------------------------------------------------------------------- /back_ground_global.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mariamcheikh/ERP-Aplication/HEAD/back_ground_global.png -------------------------------------------------------------------------------- /repair_report.cpp: -------------------------------------------------------------------------------- 1 | #include "repair_report.h" 2 | 3 | Repair_report::Repair_report() 4 | { 5 | 6 | } 7 | 8 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/demos/demo2/printscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mariamcheikh/ERP-Aplication/HEAD/SmtpClient-for-Qt-1.1/demos/demo2/printscreen.png -------------------------------------------------------------------------------- /gmail_smtp.h: -------------------------------------------------------------------------------- 1 | #ifndef GMAIL_SMTP_H 2 | #define GMAIL_SMTP_H 3 | 4 | 5 | class gmail_smtp 6 | { 7 | public: 8 | gmail_smtp(); 9 | 10 | 11 | }; 12 | 13 | #endif // GMAIL_SMTP_H 14 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/smtpexports.h: -------------------------------------------------------------------------------- 1 | #ifndef SMTPEXPORTS_H 2 | #define SMTPEXPORTS_H 3 | 4 | #ifdef SMTP_BUILD 5 | #define SMTP_EXPORT Q_DECL_EXPORT 6 | #else 7 | #define SMTP_EXPORT Q_DECL_IMPORT 8 | #endif 9 | 10 | #endif // SMTPEXPORTS_H 11 | -------------------------------------------------------------------------------- /delivery.h: -------------------------------------------------------------------------------- 1 | #ifndef DELIVERY_H 2 | #define DELIVERY_H 3 | 4 | 5 | class Delivery 6 | { 7 | private: 8 | int id_delivery; 9 | float total_weight; 10 | float total_distance; 11 | float gas_quantity; 12 | public: 13 | Delivery(); 14 | }; 15 | 16 | #endif // DELIVERY_H 17 | -------------------------------------------------------------------------------- /stats.h: -------------------------------------------------------------------------------- 1 | #ifndef STATS_H 2 | #define STATS_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | class stats: public QWidget 10 | { 11 | public: 12 | 13 | explicit stats(QWidget *parent =0); 14 | 15 | protected: 16 | void paintEvent (QPaintEvent *); 17 | 18 | }; 19 | 20 | #endif // STATS_H 21 | 22 | 23 | -------------------------------------------------------------------------------- /discount.h: -------------------------------------------------------------------------------- 1 | #ifndef DISCOUNT_H 2 | #define DISCOUNT_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | class discount 10 | { 11 | public: 12 | discount(); 13 | 14 | private : 15 | int id_discount ; 16 | double amount ; 17 | QDate add_date ; 18 | }; 19 | 20 | #endif // DISCOUNT_H 21 | -------------------------------------------------------------------------------- /repair_report.h: -------------------------------------------------------------------------------- 1 | #ifndef REPAIR_REPORT_H 2 | #define REPAIR_REPORT_H 3 | #include 4 | 5 | class Repair_report 6 | { 7 | private: 8 | int id_repair; 9 | QString date; 10 | int time; 11 | float amount; 12 | int id_truck; 13 | public: 14 | Repair_report(); 15 | void add (); 16 | void modify(); 17 | void archive(); 18 | void search(); 19 | }; 20 | 21 | #endif // REPAIR_REPORT_H 22 | -------------------------------------------------------------------------------- /stats.cpp: -------------------------------------------------------------------------------- 1 | #include "stats.h"* 2 | #include 3 | 4 | 5 | stats:: stats(QWidget *parent ):QWidget(parent) 6 | { 7 | 8 | } 9 | 10 | void stats::paintEvent(QPaintEvent *) 11 | { 12 | QPainter painter(this); 13 | QRectF size = QRectF (10,10,this->height()-10, this->height()-10); 14 | painter.setBrush(Qt::black); 15 | painter.drawPie(size,0,90*16); 16 | painter.setBrush(Qt::red); 17 | painter.drawPie(size,90*16,270*16); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /productstat.h: -------------------------------------------------------------------------------- 1 | #ifndef PRODUCTSTAT_H 2 | #define PRODUCTSTAT_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | class ProductStat : public QWidget 9 | { 10 | Q_OBJECT 11 | public: 12 | ProductStat (int); 13 | explicit ProductStat(QWidget *parent = 0); 14 | protected: 15 | void paintEvent(QPaintEvent *); 16 | signals: 17 | 18 | public slots: 19 | private : 20 | int a ; 21 | }; 22 | 23 | #endif // PRODUCTSTAT_H 24 | -------------------------------------------------------------------------------- /statistique.h: -------------------------------------------------------------------------------- 1 | #ifndef STATISTIQUE_H 2 | #define STATISTIQUE_H 3 | #include 4 | #include 5 | #include 6 | class statistique:public QWidget 7 | { 8 | public: 9 | explicit statistique(QWidget*parent=0); 10 | void insert_values(double first_var, double second_var); 11 | protected: 12 | void paintEvent(QPaintEvent *); 13 | double first_var; 14 | double second_var; 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | }; 23 | 24 | #endif // STATISTIQUE_H 25 | -------------------------------------------------------------------------------- /repairs.h: -------------------------------------------------------------------------------- 1 | #ifndef REPAIRS_H 2 | #define REPAIRS_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | 10 | class repairs 11 | { 12 | public: 13 | repairs(); 14 | repairs(int id_repair,QDate date,QDate prediction_date,double amount,QString description); 15 | ~repairs(); 16 | private: 17 | int id_repair; 18 | QDate date; 19 | QDate prediction_date; 20 | double amount ; 21 | QString description; 22 | 23 | 24 | 25 | }; 26 | 27 | #endif // REPAIRS_H 28 | -------------------------------------------------------------------------------- /session.h: -------------------------------------------------------------------------------- 1 | #ifndef SESSION_H 2 | #define SESSION_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "session.h" 10 | using namespace std ; 11 | 12 | class session 13 | { 14 | private: 15 | int id_manager; 16 | QString password ; 17 | public: 18 | session(); 19 | session(int ,QString); 20 | ~session(); 21 | void connection(); 22 | bool change_password(); 23 | 24 | 25 | 26 | }; 27 | 28 | #endif // SESSION_H 29 | -------------------------------------------------------------------------------- /import.h: -------------------------------------------------------------------------------- 1 | #ifndef IMPORT_H 2 | #define IMPORT_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "product.h" 9 | using namespace std ; 10 | 11 | class import 12 | { 13 | public: 14 | import(); 15 | import(int id_order,QDate date_added,int id_supplier,int id_inventory ); 16 | ~import(); 17 | private: 18 | int id_order; 19 | QDate date_added ; 20 | int id_supplier ; 21 | int id_inventory ; 22 | vector products ; 23 | 24 | 25 | 26 | 27 | }; 28 | 29 | #endif // IMPORT_H 30 | -------------------------------------------------------------------------------- /uipassword.h: -------------------------------------------------------------------------------- 1 | #ifndef UIPASSWORD_H 2 | #define UIPASSWORD_H 3 | 4 | #include 5 | #include 6 | #include "session.h" 7 | using namespace std; 8 | namespace Ui { 9 | class password; 10 | } 11 | 12 | class password : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit password(QWidget *parent = 0); 18 | ~password(); 19 | void load_credentials(int ide, QString pwd); 20 | private: 21 | 22 | 23 | private slots: 24 | void on_change_clicked(); 25 | 26 | private: 27 | Ui::password *ui; 28 | QString pass; 29 | }; 30 | 31 | #endif // PASSWORD_H 32 | -------------------------------------------------------------------------------- /inputcontrol.h: -------------------------------------------------------------------------------- 1 | #ifndef INPUTCONTROL_H 2 | #define INPUTCONTROL_H 3 | #include 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | 9 | class inputcontrol 10 | { 11 | public: 12 | inputcontrol(); 13 | ~inputcontrol(); 14 | bool is_number(QString ); 15 | bool is_ssn(QString); 16 | bool is_leap_year(int); 17 | int generate_bar_code(QString object); 18 | bool is_valid_name(QString); 19 | bool is_valid_cin_or_phone(QString); 20 | bool is_valid_email(QString); 21 | bool is_valid_float(QString); 22 | 23 | 24 | 25 | }; 26 | 27 | #endif // INPUTCONTROL_H 28 | -------------------------------------------------------------------------------- /mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include "smtp.h" 6 | #include 7 | #include 8 | 9 | namespace Ui { 10 | class MainWindow; 11 | } 12 | 13 | class MainWindow : public QMainWindow 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit MainWindow(QWidget *parent = 0); 19 | ~MainWindow(); 20 | 21 | private slots: 22 | void sendMail(); 23 | void mailSent(QString); 24 | void browse(); 25 | 26 | private: 27 | Ui::MainWindow *ui; 28 | QStringList files; 29 | 30 | }; 31 | 32 | #endif // MAINWINDOW_H 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | *.slo 3 | *.lo 4 | *.o 5 | *.a 6 | *.la 7 | *.lai 8 | *.so 9 | *.dll 10 | *.dylib 11 | 12 | # Qt-es 13 | object_script.*.Release 14 | object_script.*.Debug 15 | *_plugin_import.cpp 16 | /.qmake.cache 17 | /.qmake.stash 18 | *.pro.user 19 | *.pro.user.* 20 | *.qbs.user 21 | *.qbs.user.* 22 | *.moc 23 | moc_*.cpp 24 | moc_*.h 25 | qrc_*.cpp 26 | ui_*.h 27 | *.qmlc 28 | *.jsc 29 | Makefile* 30 | *build-* 31 | 32 | # Qt unit tests 33 | target_wrapper.* 34 | 35 | # QtCreator 36 | *.autosave 37 | 38 | # QtCreator Qml 39 | *.qmlproject.user 40 | *.qmlproject.user.* 41 | 42 | # QtCreator CMake 43 | CMakeLists.txt.user* -------------------------------------------------------------------------------- /import_order.h: -------------------------------------------------------------------------------- 1 | #ifndef IMPORT_ORDER_H 2 | #define IMPORT_ORDER_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "inputcontrol.h" 11 | 12 | 13 | class Import_order 14 | { 15 | private: 16 | int id_order; 17 | int quantity; 18 | int id_product; 19 | int line; 20 | public: 21 | Import_order(); 22 | Import_order ( int id_order,int quantity,int id_product,int line); 23 | bool add (); 24 | void modify(); 25 | void archive(); 26 | void search(); 27 | }; 28 | 29 | #endif // IMPORT_ORDER_H 30 | -------------------------------------------------------------------------------- /discount_event.h: -------------------------------------------------------------------------------- 1 | #ifndef DISCOUNT_EVENT_H 2 | #define DISCOUNT_EVENT_H 3 | #include"event.h" 4 | 5 | 6 | 7 | class Discount_event : public Event 8 | { 9 | protected: 10 | int ID_discount; 11 | QVector tg_products; 12 | QVector amount; 13 | 14 | public: 15 | 16 | /*constr destr*/ 17 | Discount_event(); 18 | ~Discount_event(); 19 | Discount_event(int ID_second_responsible , int ID_building, QString name, int state , QDate beginning_date, QDate ending_date, int nb_add_employees ); 20 | 21 | /*Methods*/ 22 | bool Add_disc(); 23 | bool Modify_disc(); 24 | QSqlQueryModel * Display_disc(); 25 | 26 | 27 | }; 28 | 29 | #endif // DISCOUNT_EVENT_H 30 | -------------------------------------------------------------------------------- /slicepiewidget.h: -------------------------------------------------------------------------------- 1 | #ifndef SLICEPIEWIDGET_H 2 | #define SLICEPIEWIDGET_H 3 | #include 4 | #include 5 | #include 6 | using namespace std ; 7 | 8 | class slicepiewidget : public QWidget 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit slicepiewidget(QWidget *parent = 0); 13 | void insert_values(int, double, double, double, double,double); 14 | void insert_values(int,double,double,double,double); 15 | void insert_values(int,double,double,double); 16 | void insert_values(int,double,double); 17 | protected: 18 | void paintEvent(QPaintEvent *); 19 | int variables_number; 20 | double red,blue,green,yellow,black ; 21 | 22 | 23 | }; 24 | 25 | 26 | 27 | 28 | #endif // SLICEPIEWIDGET_H 29 | -------------------------------------------------------------------------------- /statistique.cpp: -------------------------------------------------------------------------------- 1 | #include "statistique.h" 2 | 3 | statistique::statistique(QWidget *parent):QWidget (parent) 4 | { 5 | 6 | } 7 | void statistique:: paintEvent(QPaintEvent *) 8 | { 9 | QPainter painter(this); 10 | double a=first_var; 11 | first_var=first_var-second_var; 12 | double p1=((((first_var*100)/a)*360)/100)*16; 13 | double p2=((((second_var*100)/a)*360)/100)*16; 14 | 15 | painter.setBrush(Qt::red); 16 | painter.drawPie(this->rect(),0,p2); 17 | painter.setBrush(Qt::black); 18 | painter.drawPie(this->rect(),p2,p1); 19 | 20 | } 21 | void statistique::insert_values(double first_var, double second_var) 22 | { 23 | this->first_var=first_var; 24 | this->second_var=second_var; 25 | } 26 | -------------------------------------------------------------------------------- /statfinanace.h: -------------------------------------------------------------------------------- 1 | #ifndef STATFINANACE_H 2 | #define STATFINANACE_H 3 | #include "session.h" 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | class statfinanace : public QWidget 10 | { 11 | Q_OBJECT 12 | public: 13 | ~statfinanace(); 14 | explicit statfinanace(QWidget *parent = 0); 15 | statfinanace(); 16 | void set_data(vector,vector,vector); 17 | protected: 18 | void paintEvent(QPaintEvent *); 19 | vector tab_nom; 20 | vector tab_id; 21 | vector tab_amount; 22 | 23 | 24 | // void set_id(); 25 | // void set_amount(); 26 | signals: 27 | 28 | public slots: 29 | }; 30 | 31 | #endif // STATFINANACE_H 32 | -------------------------------------------------------------------------------- /piechartwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef PIECHARTWIDGET_H 2 | #define PIECHARTWIDGET_H 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std ; 8 | 9 | class PieChartWidget : public QWidget 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit PieChartWidget(QWidget *parent = 0); 14 | void insert_values(int, double, double, double, double,double); 15 | void insert_values(int,double,double,double,double); 16 | void insert_values(int,double,double,double); 17 | void insert_values(int,double,double); 18 | protected: 19 | void paintEvent(QPaintEvent *); 20 | int variables_number; 21 | 22 | double red,blue,green,yellow,black ; 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | }; 31 | #endif // PIECHARTWIDGET_H 32 | -------------------------------------------------------------------------------- /uiquicklog.h: -------------------------------------------------------------------------------- 1 | #ifndef UIQUICKLOG_H 2 | #define UIQUICKLOG_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | using namespace std ; 8 | namespace Ui { 9 | class quicklog; 10 | } 11 | class quicklog : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit quicklog(QWidget *parent =0); 17 | ~quicklog(); 18 | void set_session(int id,QString pwd,int time_limit); 19 | void closeEvent(QCloseEvent *event); 20 | 21 | 22 | private slots: 23 | 24 | void on_connection_clicked(); 25 | 26 | 27 | void on_close_clicked(); 28 | 29 | private: 30 | Ui::quicklog *ui; 31 | int id ; 32 | QString pwd ; 33 | int attempts; 34 | int time_limit; 35 | }; 36 | #endif // QUICKLOG_H 37 | -------------------------------------------------------------------------------- /refill.h: -------------------------------------------------------------------------------- 1 | #ifndef REFILL_H 2 | #define REFILL_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "product.h" 9 | #include "truck.h" 10 | using namespace std ; 11 | 12 | class refill 13 | { 14 | public: 15 | refill(); 16 | refill(int id_shop,QDate date_added,QString state,QString type,int eta); 17 | ~refill(); 18 | private: 19 | int id_refill; 20 | int id_shop; 21 | QDate date_added ; 22 | QString state ; 23 | QString type ; 24 | int eta ; 25 | double gas_quantity ; 26 | double total_weight ; 27 | double distance ; 28 | vectorproducts ; 29 | vector trucks ; 30 | 31 | 32 | 33 | 34 | 35 | }; 36 | 37 | #endif // REFILL_H 38 | -------------------------------------------------------------------------------- /client.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT 2 | #define CLIENT 3 | #include "customer.h" 4 | 5 | 6 | class Client : public Customer 7 | { 8 | private: 9 | 10 | QString family_name; 11 | QString gender; 12 | QDate birth_date; 13 | QString CIN; 14 | public : 15 | /*Constructeur et destructeur*/ 16 | Client(); 17 | ~Client(); 18 | 19 | Client(QString family_name, QString gender, QDate birth_date, QString CIN, QString name, int number, QString mail, QString adress); 20 | /*Méthodes*/ 21 | bool add_new_client(); 22 | bool delete_client(int ID_customer); 23 | bool modify_client(int ID_customer); 24 | QSqlQueryModel * search_client(); 25 | QSqlQueryModel *display_client(); 26 | /*statistiques*/ 27 | 28 | 29 | 30 | }; 31 | 32 | 33 | 34 | 35 | 36 | 37 | #endif // CLIENT 38 | 39 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/demos/demo3/demo3.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2014-10-30T22:20:42 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core 8 | 9 | QT -= gui 10 | 11 | TARGET = demo3 12 | CONFIG += console 13 | CONFIG -= app_bundle 14 | 15 | TEMPLATE = app 16 | 17 | SOURCES += \ 18 | demo3.cpp 19 | 20 | # Location of SMTP Library 21 | SMTP_LIBRARY_LOCATION = $$PWD/../../../build/SMTPEmail-Desktop-Debug 22 | 23 | win32:CONFIG(release, debug|release): LIBS += -L$$SMTP_LIBRARY_LOCATION/release/ -lSMTPEmail 24 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$SMTP_LIBRARY_LOCATION/debug/ -lSMTPEmail 25 | else:unix: LIBS += -L$$SMTP_LIBRARY_LOCATION -lSMTPEmail 26 | 27 | INCLUDEPATH += $$SMTP_LIBRARY_LOCATION 28 | DEPENDPATH += $$SMTP_LIBRARY_LOCATION 29 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/demos/demo4/demo4.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2014-10-30T22:20:54 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core 8 | 9 | QT -= gui 10 | 11 | TARGET = demo4 12 | CONFIG += console 13 | CONFIG -= app_bundle 14 | 15 | TEMPLATE = app 16 | 17 | SOURCES += \ 18 | demo4.cpp 19 | 20 | # Location of SMTP Library 21 | SMTP_LIBRARY_LOCATION = $$PWD/../../../build/SMTPEmail-Desktop-Debug 22 | 23 | win32:CONFIG(release, debug|release): LIBS += -L$$SMTP_LIBRARY_LOCATION/release/ -lSMTPEmail 24 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$SMTP_LIBRARY_LOCATION/debug/ -lSMTPEmail 25 | else:unix: LIBS += -L$$SMTP_LIBRARY_LOCATION -lSMTPEmail 26 | 27 | INCLUDEPATH += $$SMTP_LIBRARY_LOCATION 28 | DEPENDPATH += $$SMTP_LIBRARY_LOCATION 29 | -------------------------------------------------------------------------------- /mytimer.h: -------------------------------------------------------------------------------- 1 | #ifndef MYTIMER_H 2 | #define MYTIMER_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "uiquicklog.h" 9 | using namespace std ; 10 | class Mytimer : public QObject 11 | { 12 | Q_OBJECT 13 | public: 14 | Mytimer(); 15 | Mytimer(int id,QString pass,int time_limit); 16 | QTimer *timer ; 17 | QTimer *timer_2; 18 | void setactivity_time_limit(int t){time_limit=t;} 19 | 20 | 21 | private: 22 | 23 | QPoint current_p; 24 | int progress_time; 25 | int time_limit; 26 | int id; 27 | QString password; 28 | quicklog *log ; 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | public slots: 38 | void timed_out(); 39 | void lets_go(); 40 | void unleash_the_dog(); 41 | void check_out(); 42 | 43 | 44 | }; 45 | #endif // MYTIMER_H 46 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/demos/demo1/demo1.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2014-10-30T22:19:03 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core 8 | 9 | QT -= gui 10 | 11 | TARGET = demo1 12 | CONFIG += console 13 | CONFIG -= app_bundle 14 | 15 | TEMPLATE = app 16 | 17 | 18 | SOURCES += \ 19 | demo1.cpp 20 | 21 | # Location of SMTP Library 22 | SMTP_LIBRARY_LOCATION = $$PWD/../../../build/SMTPEmail-Desktop-Debug 23 | 24 | win32:CONFIG(release, debug|release): LIBS += -L$$SMTP_LIBRARY_LOCATION/release/ -lSMTPEmail 25 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$SMTP_LIBRARY_LOCATION/debug/ -lSMTPEmail 26 | else:unix: LIBS += -L$$SMTP_LIBRARY_LOCATION -lSMTPEmail 27 | 28 | INCLUDEPATH += $$SMTP_LIBRARY_LOCATION 29 | DEPENDPATH += $$SMTP_LIBRARY_LOCATION 30 | -------------------------------------------------------------------------------- /import_order.cpp: -------------------------------------------------------------------------------- 1 | #include "import_order.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | Import_order::Import_order() 8 | { 9 | 10 | } 11 | 12 | Import_order::Import_order(int id_order, int quantity, int id_product, int line) 13 | { 14 | this-> id_order=id_order; 15 | this-> quantity=quantity; 16 | this-> id_product =id_product; 17 | this->line=line; 18 | } 19 | 20 | 21 | bool Import_order::add() 22 | { 23 | QSqlQuery query; 24 | query.prepare("insert into Import_order (id_order,quantity,id_product,line) " 25 | "values(:id_order,:quantity,:id_product,:line)"); 26 | query.bindValue(0,id_order); 27 | query.bindValue(1,quantity); 28 | query.bindValue(2,id_product); 29 | query.bindValue(3,line); 30 | 31 | qDebug()< 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "inputcontrol.h" 11 | class mouvement 12 | { 13 | public: 14 | /*--------desc/const-----------*/ 15 | mouvement(); 16 | mouvement(int original_building,int new_building,QString description); 17 | ~mouvement(); 18 | /*------------data input methods ---------*/ 19 | bool add_mouvement(); 20 | bool modify_mouvement(); 21 | bool archive_mouvement(); 22 | bool delete_mouvement(); 23 | 24 | /*---------------data fetch methods -------*/ 25 | 26 | 27 | 28 | 29 | private: 30 | int id_mouvement ; 31 | QDate date_transaction; 32 | int original_building; 33 | int new_building; 34 | QString description; 35 | }; 36 | 37 | #endif // MOUVEMENT_H 38 | -------------------------------------------------------------------------------- /agepyramidwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef AGEPYRAMIDWIDGET_H 2 | #define AGEPYRAMIDWIDGET_H 3 | 4 | #include 5 | #include 6 | 7 | class agepyramidwidget:public QWidget 8 | { 9 | Q_OBJECT 10 | public: 11 | explicit agepyramidwidget(QWidget *parent = 0); 12 | ~agepyramidwidget(); 13 | void set_left_values(double first,double second,double third,double fourth,double fifth); 14 | void set_right_values(double sixth,double seventh,double eigth,double nineth,double tenth); 15 | double get_max(); 16 | protected: 17 | void paintEvent(QPaintEvent *); 18 | 19 | double first,second,third,fourth,fifth,sixth,seventh,eigth,nineth,tenth; 20 | double distance_between_bars; 21 | double bar_width; 22 | double start_point_x; 23 | double start_point_y; 24 | double left_side_limit; 25 | double right_side_limit; 26 | 27 | 28 | 29 | 30 | 31 | }; 32 | 33 | #endif // AGEPYRAMIDWIDGET_H 34 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/demos/demo2/demo2.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2014-10-30T22:48:32 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = demo2 12 | TEMPLATE = app 13 | 14 | SOURCES += \ 15 | demo2.cpp \ 16 | sendemail.cpp 17 | 18 | # Location of SMTP Library 19 | SMTP_LIBRARY_LOCATION = $$PWD/../../../build/SMTPEmail-Desktop-Debug 20 | 21 | win32:CONFIG(release, debug|release): LIBS += -L$$SMTP_LIBRARY_LOCATION/release/ -lSMTPEmail 22 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$SMTP_LIBRARY_LOCATION/debug/ -lSMTPEmail 23 | else:unix: LIBS += -L$$SMTP_LIBRARY_LOCATION -lSMTPEmail 24 | 25 | INCLUDEPATH += $$SMTP_LIBRARY_LOCATION 26 | DEPENDPATH += $$SMTP_LIBRARY_LOCATION 27 | 28 | HEADERS += \ 29 | sendemail.h 30 | 31 | FORMS += \ 32 | sendemail.ui 33 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/demos/demo2/demo2.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | SmtpClient for Qt is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | SmtpClient for Qt is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY. 13 | 14 | See the LICENSE file for more details. 15 | */ 16 | 17 | #include 18 | 19 | #include "sendemail.h" 20 | #include "../../src/SmtpMime" 21 | 22 | #include 23 | 24 | using namespace std; 25 | 26 | int main(int argc, char *argv[]) 27 | { 28 | QApplication a(argc, argv); 29 | SendEmail form (NULL); 30 | 31 | form.setWindowTitle("SmtpClient for Qt - Demo 2"); 32 | 33 | form.show(); 34 | 35 | a.exec(); 36 | 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /promotionnal.h: -------------------------------------------------------------------------------- 1 | #ifndef PROMOTIONNAL_H 2 | #define PROMOTIONNAL_H 3 | #include"event.h" 4 | 5 | 6 | 7 | class Promotionnal : public Event 8 | { 9 | protected: 10 | QString type; 11 | QString description; 12 | float budget; 13 | float remaining_budget; 14 | QVector buyings; 15 | QVector price; 16 | 17 | public: 18 | 19 | /*Constr destr */ 20 | 21 | Promotionnal(); 22 | Promotionnal (QString , QString , float , QString , int , QDate , QDate , int ID_second_responsible, int , int ID_building); 23 | ~Promotionnal(); 24 | /* Gets */ 25 | QString Get_type(){return type;} 26 | QString Get_description(){return description;} 27 | float Get_budget(){return budget;} 28 | 29 | /* Méthodes */ 30 | bool Add_prom(); 31 | bool Modify_prom(); 32 | QSqlQueryModel * Display_prom(); 33 | /*QSqlQueryModel * Search_disc(QString type, QString description);*/ 34 | bool Add_extra_buying_in_DB(); 35 | 36 | 37 | }; 38 | 39 | #endif // PROMOTIONNAL_H 40 | -------------------------------------------------------------------------------- /session.cpp: -------------------------------------------------------------------------------- 1 | #include "session.h" 2 | 3 | session::session() 4 | { 5 | 6 | } 7 | session::~session() 8 | { 9 | 10 | } 11 | session::session(int id,QString mdp) 12 | { 13 | id_manager=id; 14 | password=mdp; 15 | } 16 | void session::connection() 17 | { 18 | QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); 19 | db.setDatabaseName("C:/Users/gambler/Desktop/erp_hamadi"); 20 | if (!db.open()) { 21 | QMessageBox::critical(0, "Cannot open database", 22 | "Click Cancel to exit.", QMessageBox::Cancel); 23 | 24 | 25 | } 26 | else 27 | { 28 | 29 | 30 | } 31 | 32 | 33 | 34 | } 35 | bool session::change_password() 36 | { 37 | QSqlQuery query; 38 | 39 | query.prepare("update manager set password=:password where( id_manager = :id_manager)"); 40 | 41 | query.bindValue(":id_manager",id_manager); 42 | query.bindValue(":password",password); 43 | 44 | qDebug()< 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | class Refill_Order 13 | { 14 | private: 15 | int id_refill; 16 | QDate date; 17 | QString state; 18 | QString type; 19 | QDate ETA; 20 | int id_building; 21 | public: 22 | Refill_Order(); 23 | Refill_Order(QDate date, QString state, QString type, QDate ETA, int id_building); 24 | 25 | //-------GETS------- 26 | int get_id(){return id_refill;} 27 | QDate get_date(){return date;} 28 | QString get_state(){return state;} 29 | QString get_type(){return type;} 30 | QDate get_eta(){return ETA;} 31 | int get_building(){return id_building;} 32 | bool add (); 33 | bool modify(int id); 34 | bool archive(int x); 35 | void search(); 36 | void select_order(int aux); 37 | 38 | 39 | QSqlQueryModel *display_Refill(); 40 | QSqlQueryModel *search_Refill(QString value); 41 | }; 42 | 43 | #endif // REFILL_ORDER_H 44 | -------------------------------------------------------------------------------- /uioptions.h: -------------------------------------------------------------------------------- 1 | #ifndef UIOPTIONS_H 2 | #define UIOPTIONS_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | using namespace std ; 15 | namespace Ui { 16 | class Options; 17 | } 18 | class Options : public QDialog 19 | { 20 | Q_OBJECT 21 | 22 | public: 23 | explicit Options(QWidget *parent = 0); 24 | ~Options(); 25 | int Getsize(){return size;} 26 | bool Getwindow(){return window ; } 27 | int Getlanguage(){return language; } 28 | void setwindow(bool signal){window=signal;} 29 | 30 | 31 | private slots: 32 | void on_cancel_clicked(); 33 | 34 | void on_fullscreen_clicked(); 35 | 36 | void on_window_clicked(); 37 | 38 | bool on_ok_clicked(); 39 | 40 | void on_pushButton_clicked(); 41 | 42 | void on_modify_logo_clicked(); 43 | 44 | private: 45 | Ui::Options *ui; 46 | int size ; 47 | bool window ; 48 | int language ; 49 | 50 | 51 | 52 | }; 53 | #endif // OPTIONS_H 54 | -------------------------------------------------------------------------------- /corporate.h: -------------------------------------------------------------------------------- 1 | #ifndef CORPORATE 2 | #define CORPORATE 3 | #include "customer.h" 4 | 5 | 6 | 7 | class Corporate:public Customer 8 | { 9 | private: 10 | QString type_of_ID; 11 | QString corp_ID; 12 | QString corp_comm; 13 | int fax; 14 | QString type_of_contract; 15 | QString contract /*chemin absolu du fichier*/; 16 | 17 | /*stats*/ 18 | int nb_clients; 19 | 20 | public : 21 | /*Constructeur et destructeur*/ 22 | Corporate(); 23 | ~Corporate(); 24 | 25 | Corporate(QString type_of_ID, QString corp_ID, QString corp_comm, int fax, QString type_of_contract, QString contract, QString name, int number, QString mail, QString adress ); 26 | /*Méthodes*/ 27 | bool add_new_corp(); 28 | bool delete_corp(int ID_customer); 29 | bool modify_corp(int ID_customer); 30 | bool search_corp(QString type_of_ID, QString corp_ID, QString corp_comm, int fax, QString type_of_contract, QString contract, QString name, int number, QString mail, QString adress ); 31 | 32 | QSqlQueryModel *display_corp(); 33 | /*statistiques*/ 34 | int get_nb_clients(){return nb_clients;} 35 | 36 | }; 37 | 38 | 39 | 40 | 41 | #endif // CORPORATE 42 | 43 | -------------------------------------------------------------------------------- /Advance.h: -------------------------------------------------------------------------------- 1 | #ifndef ADVANCE_H 2 | #define ADVANCE_H 3 | #include 4 | #include "session.h" 5 | #include "employee.h" 6 | class Advance 7 | { 8 | public: 9 | Advance(); 10 | Advance(double,QString,QString,int); 11 | ~Advance(); 12 | int Getid() { return id; } 13 | void Setid( int val) { id = val; } 14 | double Getamount() { return amount; } 15 | void Setamount(double val) { amount = val; } 16 | QString GetDescription() { return Description; } 17 | void SetDescription(QString val) { Description = val; } 18 | QString Getadd_date() { return add_date; } 19 | void Setadd_date( QString val) { add_date = val; } 20 | int Getid_employee() { return id_employee; } 21 | void Setid_employee(int val) { id_employee = val; } 22 | bool delete_advance(int); 23 | bool add_advance(); 24 | QSqlQueryModel *advancelist(); 25 | QSqlQueryModel *searchadvance(int ); 26 | protected: 27 | private: 28 | int id; 29 | double amount; 30 | QString Description; 31 | QString add_date; 32 | int id_employee; 33 | }; 34 | 35 | #endif // ADVANCE_H 36 | -------------------------------------------------------------------------------- /Proget_commerce.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2015-11-16T00:50:28 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui sql 8 | QT += printsupport 9 | QT += network \ 10 | webkit \ 11 | xml \ 12 | xmlpatterns 13 | 14 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets webkitwidgets 15 | 16 | TARGET = Proget_commerce 17 | TEMPLATE = app 18 | 19 | 20 | SOURCES += main.cpp\ 21 | mainwindow.cpp \ 22 | catalogue.cpp \ 23 | commande.cpp \ 24 | commerce.cpp \ 25 | product.cpp \ 26 | raw_materials.cpp \ 27 | production.cpp \ 28 | email.cpp \ 29 | smtp.cpp 30 | 31 | HEADERS += mainwindow.h \ 32 | connexion.h \ 33 | catalogue.h \ 34 | commande.h \ 35 | commerce.h \ 36 | product.h \ 37 | raw_materials.h \ 38 | production.h \ 39 | email.h \ 40 | smtp.h 41 | 42 | QT += axcontainer 43 | FORMS += mainwindow.ui \ 44 | commerce.ui \ 45 | production.ui \ 46 | email.ui 47 | RC_FILE = ressource.rc 48 | 49 | DISTFILES += \ 50 | ressource.rc \ 51 | map.html 52 | 53 | QT_LOGGING_RULES=qt.network.ssl.warning=false 54 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/quotedprintable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #ifndef QUOTEDPRINTABLE_H 20 | #define QUOTEDPRINTABLE_H 21 | 22 | #include 23 | #include 24 | 25 | #include "smtpexports.h" 26 | 27 | class SMTP_EXPORT QuotedPrintable : public QObject 28 | { 29 | Q_OBJECT 30 | public: 31 | 32 | static QString encode(const QByteArray &input); 33 | static QByteArray decode(const QString &input); 34 | 35 | private: 36 | QuotedPrintable(); 37 | }; 38 | 39 | #endif // QUOTEDPRINTABLE_H 40 | -------------------------------------------------------------------------------- /mouvement.cpp: -------------------------------------------------------------------------------- 1 | #include "mouvement.h" 2 | 3 | mouvement::mouvement() 4 | { 5 | this->original_building=0; 6 | this->new_building=0; 7 | this->description=""; 8 | } 9 | mouvement::mouvement(int original_building, int new_building, QString description) 10 | { 11 | this->original_building=original_building; 12 | this->new_building=new_building; 13 | this->description=description; 14 | } 15 | mouvement::~mouvement() 16 | { 17 | 18 | } 19 | 20 | bool mouvement::add_mouvement() 21 | { 22 | QSqlQuery *query=new QSqlQuery(); 23 | inputcontrol p; 24 | id_mouvement=p.generate_bar_code("movement"); 25 | date_transaction=QDate::currentDate(); 26 | 27 | query->prepare("insert into movement (id_movement,date_transaction,original_building,new_building,description) values (:id_mouvement,:date_transaction,:original_building,:new_building,:description)"); 28 | query->bindValue(0,id_mouvement); 29 | query->bindValue(1,date_transaction); 30 | query->bindValue(2,original_building); 31 | query->bindValue(3,new_building); 32 | query->bindValue(4,description); 33 | qDebug()<<" adding mouvement trace into data base ..."<lastError(); 34 | return query->exec(); 35 | } 36 | -------------------------------------------------------------------------------- /style.qss: -------------------------------------------------------------------------------- 1 | QLineEdit 2 | { color : black ; } 3 | QLineEdit { 4 | padding: 1px; 5 | border-style: solid; 6 | border: 2px solid gray; 7 | border-radius: 8px; 8 | } 9 | QLabel 10 | { color : white ; } 11 | QSpinBox { 12 | padding: 1px; 13 | border-style: solid; 14 | border: 2px solid gray; 15 | border-radius: 8px; 16 | } 17 | QSpinBox 18 | { color : black ;background-color: white ; } 19 | QComboBox { 20 | padding: 1px; 21 | border-style: solid; 22 | border: 2px solid gray; 23 | border-radius: 8px; 24 | } 25 | QTableview { 26 | padding: 1px; 27 | border-style: solid; 28 | border: 2px solid gray; 29 | border-radius: 8px; 30 | } 31 | QDateEdit 32 | { color : white ;background-color: rgba(0,0,0,0); } 33 | QTableView{ 34 | padding: 1px; 35 | border-style: solid; 36 | border: 2px solid gray; 37 | border-radius: 8px; 38 | } 39 | QPushButton { 40 | color: white; 41 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #61b, stop: 1 #77c); 42 | border-width: 1px; 43 | border-color: #339; 44 | border-style: solid; 45 | border-radius: 7; 46 | padding: 3px; 47 | padding-left: 5px; 48 | padding-right: 5px; 49 | min-width: 50px; 50 | max-width: 300px; 51 | min-height: 13px; 52 | max-height: 290px; 53 | } 54 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/demos/demo2/sendemail.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | SmtpClient for Qt is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | SmtpClient for Qt is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY. 13 | 14 | See the LICENCE file for more details. 15 | */ 16 | 17 | #ifndef SENDEMAIL_H 18 | #define SENDEMAIL_H 19 | 20 | #include 21 | 22 | #include "../../src/SmtpMime" 23 | 24 | 25 | 26 | namespace Ui { 27 | class SendEmail; 28 | } 29 | 30 | class SendEmail : public QWidget 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit SendEmail(QWidget *parent = 0); 36 | ~SendEmail(); 37 | 38 | static EmailAddress * stringToEmail(const QString & str); 39 | 40 | private slots: 41 | void on_addAttachment_clicked(); 42 | 43 | void on_sendEmail_clicked(); 44 | 45 | private: 46 | Ui::SendEmail *ui; 47 | 48 | void errorMessage(const QString & message); 49 | }; 50 | 51 | #endif // SENDEMAIL_H 52 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/SMTPEmail.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2011-08-11T20:59:25 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core network 8 | 9 | TARGET = SMTPEmail 10 | 11 | # Build as an application 12 | #TEMPLATE = app 13 | 14 | # Build as a library 15 | TEMPLATE = lib 16 | DEFINES += SMTP_BUILD 17 | win32:CONFIG += dll 18 | 19 | SOURCES += \ 20 | src/emailaddress.cpp \ 21 | src/mimeattachment.cpp \ 22 | src/mimefile.cpp \ 23 | src/mimehtml.cpp \ 24 | src/mimeinlinefile.cpp \ 25 | src/mimemessage.cpp \ 26 | src/mimepart.cpp \ 27 | src/mimetext.cpp \ 28 | src/smtpclient.cpp \ 29 | src/quotedprintable.cpp \ 30 | src/mimemultipart.cpp \ 31 | src/mimecontentformatter.cpp \ 32 | 33 | HEADERS += \ 34 | src/emailaddress.h \ 35 | src/mimeattachment.h \ 36 | src/mimefile.h \ 37 | src/mimehtml.h \ 38 | src/mimeinlinefile.h \ 39 | src/mimemessage.h \ 40 | src/mimepart.h \ 41 | src/mimetext.h \ 42 | src/smtpclient.h \ 43 | src/SmtpMime \ 44 | src/quotedprintable.h \ 45 | src/mimemultipart.h \ 46 | src/mimecontentformatter.h \ 47 | src/smtpexports.h 48 | 49 | OTHER_FILES += \ 50 | LICENSE \ 51 | README.md 52 | 53 | FORMS += 54 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/mimecontentformatter.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #ifndef MIMECONTENTFORMATTER_H 20 | #define MIMECONTENTFORMATTER_H 21 | 22 | #include 23 | #include 24 | 25 | #include "smtpexports.h" 26 | 27 | class SMTP_EXPORT MimeContentFormatter : public QObject 28 | { 29 | Q_OBJECT 30 | public: 31 | MimeContentFormatter (int max_length = 76); 32 | 33 | void setMaxLength(int l); 34 | int getMaxLength() const; 35 | 36 | QString format(const QString &content, bool quotedPrintable = false) const; 37 | 38 | protected: 39 | int max_length; 40 | 41 | }; 42 | 43 | #endif // MIMECONTENTFORMATTER_H 44 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/mimeinlinefile.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #include "mimeinlinefile.h" 20 | 21 | /* [1] Constructors and Destructors */ 22 | 23 | MimeInlineFile::MimeInlineFile(QFile *f) 24 | : MimeFile(f) 25 | { 26 | } 27 | 28 | MimeInlineFile::~MimeInlineFile() 29 | {} 30 | 31 | /* [1] --- */ 32 | 33 | 34 | /* [2] Getters and Setters */ 35 | 36 | /* [2] --- */ 37 | 38 | 39 | /* [3] Protected methods */ 40 | 41 | void MimeInlineFile::prepare() 42 | { 43 | this->header += "Content-Disposition: inline\r\n"; 44 | 45 | /* !!! IMPORTANT !!! */ 46 | MimeFile::prepare(); 47 | } 48 | 49 | /* [3] --- */ 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/mimeattachment.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #include "mimeattachment.h" 20 | #include 21 | 22 | /* [1] Constructors and Destructors */ 23 | 24 | MimeAttachment::MimeAttachment(QFile *file) 25 | : MimeFile(file) 26 | { 27 | } 28 | MimeAttachment::MimeAttachment(const QByteArray& stream, const QString& fileName): MimeFile(stream, fileName) 29 | { 30 | 31 | } 32 | 33 | MimeAttachment::~MimeAttachment() 34 | { 35 | } 36 | 37 | /* [1] --- */ 38 | 39 | 40 | /* [2] Protected methods */ 41 | 42 | void MimeAttachment::prepare() 43 | { 44 | this->header += "Content-disposition: attachment\r\n"; 45 | 46 | /* !!! IMPORTANT !!! */ 47 | MimeFile::prepare(); 48 | } 49 | 50 | /* [2] --- */ 51 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/mimeattachment.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #ifndef MIMEATTACHMENT_H 20 | #define MIMEATTACHMENT_H 21 | 22 | #include 23 | #include "mimepart.h" 24 | #include "mimefile.h" 25 | 26 | #include "smtpexports.h" 27 | 28 | class SMTP_EXPORT MimeAttachment : public MimeFile 29 | { 30 | Q_OBJECT 31 | public: 32 | 33 | /* [1] Constructors and Destructors */ 34 | 35 | MimeAttachment(QFile* file); 36 | MimeAttachment(const QByteArray& stream, const QString& fileName); 37 | 38 | ~MimeAttachment(); 39 | 40 | /* [1] --- */ 41 | 42 | protected: 43 | 44 | /* [2] Protected methods */ 45 | 46 | virtual void prepare(); 47 | 48 | /* [2] --- */ 49 | }; 50 | 51 | #endif // MIMEATTACHMENT_H 52 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/mimehtml.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #include "mimehtml.h" 20 | 21 | /* [1] Constructors and Destructors */ 22 | 23 | MimeHtml::MimeHtml(const QString &html) : MimeText(html) 24 | { 25 | this->cType = "text/html"; 26 | } 27 | 28 | MimeHtml::~MimeHtml() {} 29 | 30 | /* [1] --- */ 31 | 32 | 33 | /* [2] Getters and Setters */ 34 | 35 | void MimeHtml::setHtml(const QString & html) 36 | { 37 | this->text = html; 38 | } 39 | 40 | const QString & MimeHtml::getHtml() const 41 | { 42 | return text; 43 | } 44 | 45 | 46 | /* [2] --- */ 47 | 48 | 49 | /* [3] Protected methods */ 50 | 51 | void MimeHtml::prepare() 52 | { 53 | /* !!! IMPORTANT !!! */ 54 | MimeText::prepare(); 55 | } 56 | 57 | /* [3] --- */ 58 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/mimeinlinefile.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #ifndef MIMEINLINEFILE_H 20 | #define MIMEINLINEFILE_H 21 | 22 | #include "mimefile.h" 23 | 24 | #include "smtpexports.h" 25 | 26 | class SMTP_EXPORT MimeInlineFile : public MimeFile 27 | { 28 | public: 29 | 30 | /* [1] Constructors and Destructors */ 31 | 32 | MimeInlineFile(QFile *f); 33 | ~MimeInlineFile(); 34 | 35 | /* [1] --- */ 36 | 37 | 38 | /* [2] Getters and Setters */ 39 | 40 | /* [2] --- */ 41 | 42 | protected: 43 | 44 | /* [3] Protected members */ 45 | 46 | /* [3] --- */ 47 | 48 | 49 | /* [4] Protected methods */ 50 | 51 | virtual void prepare(); 52 | 53 | /* [4] --- */ 54 | }; 55 | 56 | #endif // MIMEINLINEFILE_H 57 | -------------------------------------------------------------------------------- /uicrm.h: -------------------------------------------------------------------------------- 1 | #ifndef UICRM_H 2 | #define UICRM_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "customer.h" 8 | #include 9 | #include "client.h" 10 | #include "corporate.h" 11 | #include "employee.h" 12 | namespace Ui { 13 | class uicrm; 14 | } 15 | 16 | class uicrm : public QWidget 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | explicit uicrm(QWidget *parent = 0); 22 | ~uicrm(); 23 | void clear_client_line_edits(); 24 | void clear_corp_line_edits(); 25 | 26 | private slots: 27 | void on_pb_add_disc_finish_clicked(); 28 | 29 | void on_pb_add_client_finish_clicked(); 30 | 31 | void on_pb_add_corp_finish_clicked(); 32 | 33 | void on_le_search_sec_responsible_prom_textChanged(const QString &arg1); 34 | 35 | void on_tw_employee_list_prom_doubleClicked(const QModelIndex &index); 36 | 37 | void on_le_search_add_employee_prom_textChanged(const QString &arg1); 38 | 39 | void on_pushButton_clicked(); 40 | 41 | private: 42 | Ui::uicrm *ui; 43 | Client *cl; 44 | Corporate *corp; 45 | QString name; 46 | int number; 47 | QString mail; 48 | QString adress; 49 | QString family_name; 50 | QString gender; 51 | QDate birth_date; 52 | QString CIN; 53 | QString type_of_ID; 54 | QString corp_ID; 55 | QString corp_comm; 56 | int fax; 57 | QString type_of_contract; 58 | QString contract; 59 | }; 60 | 61 | #endif // UICRM_H 62 | -------------------------------------------------------------------------------- /bargraphwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef BARGRAPHWIDGET_H 2 | #define BARGRAPHWIDGET_H 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | class bargraphwidget:public QWidget 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit bargraphwidget(QWidget *parent = 0); 13 | void insert_values(int,double,double); 14 | void insert_values(int,double,double,double); 15 | void insert_values(int,double,double,double,double); 16 | void insert_values(int,double,double,double,double,double); 17 | double get_max(); 18 | double Get_red_pos_x(){return red_pos_x;} 19 | double Get_blue_pos_x(){return blue_pos_x;} 20 | double Get_green_pos_x(){return green_pos_x;} 21 | double Get_yellow_pos_x(){return yellow_pos_x;} 22 | double Get_black_pos_x(){return black_pos_x;} 23 | double Get_red_pos_y(){return red_pos_y;} 24 | double Get_blue_pos_y(){return blue_pos_y;} 25 | double Get_green_pos_y(){return green_pos_y;} 26 | double Get_yellow_pos_y(){return yellow_pos_y;} 27 | double Get_black_pos_y(){return black_pos_y;} 28 | protected: 29 | void paintEvent(QPaintEvent *); 30 | int variables_number ; 31 | double first,second,third,fourth,fifth ; 32 | double distance_between_bars; 33 | double bar_width; 34 | double start_point_x; 35 | double start_point_y; 36 | double total; 37 | double red_pos_x,blue_pos_x,green_pos_x,yellow_pos_x,black_pos_x; 38 | double red_pos_y,blue_pos_y,green_pos_y,yellow_pos_y,black_pos_y; 39 | 40 | }; 41 | 42 | #endif // BARGRAPHWIDGET_H 43 | -------------------------------------------------------------------------------- /smtp.h: -------------------------------------------------------------------------------- 1 | #ifndef SMTP_H 2 | #define SMTP_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | 18 | class Smtp : public QObject 19 | { 20 | Q_OBJECT 21 | 22 | 23 | public: 24 | Smtp() ; 25 | Smtp( const QString &user, const QString &pass, const QString &host, int port = 465, int timeout = 30000 ); 26 | ~Smtp(); 27 | 28 | void sendMail( const QString &from, const QString &to,const QString &subject, const QString &body ); 29 | 30 | signals: 31 | void status( const QString &); 32 | 33 | private slots: 34 | void stateChanged(QAbstractSocket::SocketState socketState); 35 | void errorReceived(QAbstractSocket::SocketError socketError); 36 | void disconnected(); 37 | void connected(); 38 | void readyRead(); 39 | 40 | private: 41 | int timeout; 42 | QString message; 43 | QTextStream *t; 44 | QSslSocket *socket; 45 | QString from; 46 | QString rcpt; 47 | QString response; 48 | QString user; 49 | QString pass; 50 | QString host; 51 | int port; 52 | enum states{Tls, HandShake ,Auth,User,Pass,Rcpt,Mail,Data,Init,Body,Quit,Close}; 53 | int state; 54 | 55 | }; 56 | 57 | #endif //SMTP_H 58 | -------------------------------------------------------------------------------- /productstat.cpp: -------------------------------------------------------------------------------- 1 | #include "productstat.h" 2 | 3 | ProductStat::ProductStat(QWidget *parent) : QWidget(parent) 4 | { 5 | 6 | } 7 | 8 | ProductStat :: ProductStat (int a) 9 | { 10 | this->a=a; 11 | } 12 | void ProductStat::paintEvent(QPaintEvent *) 13 | { 14 | QPainter painter(this); 15 | QRectF size= QRectF (10,10,400,400); 16 | painter.setBrush(Qt::blue); 17 | QString r1="SELECT * FROM product"; 18 | QString r2="SELECT * FROM product where gender ='Female'"; 19 | QString r3="SELECT * FROM product where gender ='Male'"; 20 | 21 | 22 | QSqlQuery q1,q2,q3; 23 | QString n; 24 | q1.exec(r1); 25 | q2.exec(r2); 26 | q3.exec(r3); 27 | 28 | 29 | 30 | int tot=0,male=0,female=0,rfn=0; 31 | while ( q1.next() ) 32 | { 33 | tot++; 34 | } 35 | while ( q2.next() ) 36 | { 37 | female++; 38 | } 39 | while ( q3.next() ) 40 | { 41 | male++; 42 | } 43 | 44 | male=(((male*100)/tot)*360)/100; 45 | female=(((female*100)/tot)*360)/100; 46 | //other=(((other*100)/tot)*360)/100; 47 | rfn=360-(male+female); 48 | 49 | painter.drawPie(size ,0,male*16); 50 | painter.setBrush(Qt::green); 51 | painter.drawPie(size ,male*16,female*16); 52 | painter.setBrush(Qt::blue); 53 | painter.drawPie(size ,male*16+female*16,rfn*16); 54 | /* painter.setBrush(Qt::red); 55 | painter.drawPie(size ,male*16+female*16+other*16,rfn*16);*/ 56 | 57 | 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /driver.h: -------------------------------------------------------------------------------- 1 | #ifndef DRIVER_H 2 | #define DRIVER_H 3 | #include 4 | #include 5 | #include 6 | #include "employee.h" 7 | 8 | class driver : public employee 9 | { 10 | public: 11 | /*--------- const /dest ---------*/ 12 | driver(); 13 | driver(int lisence,bool big_trucks,bool small_trucks,QDate expiration_date); 14 | driver(int lisence,bool big_trucks,bool small_trucks,QDate expiration_date,QString name,QString family_name, QDate birthdate, QString social_state, long int social_sn,QString zip_code,QString street,QString area , QString city,int phone_number,int Cin ,double salary,QString post , QString gender ,bool activity ,QString contract_type ,QString paiment_type , int interveiwer , QString c_v ,QString m_l,QString photo,int building); 15 | ~driver(); 16 | /*-------- data input methods -------*/ 17 | bool add_driver(); 18 | void select_driver(int id); 19 | bool modify_driver(int id); 20 | bool delete_driver(int id); 21 | /*--------- transformation methods--------*/ 22 | bool this_employee_became_a_driver(int employee); 23 | /*--------- gets -----------*/ 24 | int Get_lisence(){return lisence;} 25 | bool Get_big_trucks(){return big_trucks;} 26 | bool Get_small_trucks(){return small_trucks;} 27 | QDate Get_expiration_date(){return expiration_date;} 28 | private: 29 | int lisence; 30 | bool big_trucks; 31 | bool small_trucks; 32 | QDate expiration_date; 33 | 34 | 35 | }; 36 | 37 | #endif // DRIVER_H 38 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/mimehtml.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #ifndef MIMEHTML_H 20 | #define MIMEHTML_H 21 | 22 | #include "mimetext.h" 23 | 24 | #include "smtpexports.h" 25 | 26 | class SMTP_EXPORT MimeHtml : public MimeText 27 | { 28 | Q_OBJECT 29 | public: 30 | 31 | /* [1] Constructors and Destructors */ 32 | 33 | MimeHtml(const QString &html = ""); 34 | ~MimeHtml(); 35 | 36 | /* [1] --- */ 37 | 38 | 39 | /* [2] Getters and Setters */ 40 | 41 | void setHtml(const QString & html); 42 | 43 | const QString& getHtml() const; 44 | 45 | /* [2] --- */ 46 | 47 | protected: 48 | 49 | /* [3] Protected members */ 50 | 51 | /* [3] --- */ 52 | 53 | 54 | /* [4] Protected methods */ 55 | 56 | virtual void prepare(); 57 | 58 | /* [4] --- */ 59 | }; 60 | 61 | #endif // MIMEHTML_H 62 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/mimetext.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #ifndef MIMETEXT_H 20 | #define MIMETEXT_H 21 | 22 | #include "mimepart.h" 23 | 24 | #include "smtpexports.h" 25 | 26 | class SMTP_EXPORT MimeText : public MimePart 27 | { 28 | public: 29 | 30 | /* [1] Constructors and Destructors */ 31 | 32 | MimeText(const QString &text = ""); 33 | ~MimeText(); 34 | 35 | /* [1] --- */ 36 | 37 | 38 | /* [2] Getters and Setters*/ 39 | 40 | void setText(const QString & text); 41 | 42 | const QString & getText() const; 43 | 44 | /* [2] --- */ 45 | 46 | protected: 47 | 48 | /* [3] Protected members */ 49 | 50 | QString text; 51 | /* [3] --- */ 52 | 53 | 54 | /* [4] Protected methods */ 55 | 56 | void prepare(); 57 | 58 | /* [4] --- */ 59 | 60 | }; 61 | 62 | #endif // MIMETEXT_H 63 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/mimefile.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #ifndef MIMEFILE_H 20 | #define MIMEFILE_H 21 | 22 | #include "mimepart.h" 23 | #include 24 | 25 | #include "smtpexports.h" 26 | 27 | class SMTP_EXPORT MimeFile : public MimePart 28 | { 29 | Q_OBJECT 30 | public: 31 | 32 | /* [1] Constructors and Destructors */ 33 | 34 | MimeFile(const QByteArray& stream, const QString& fileName); 35 | MimeFile(QFile *f); 36 | ~MimeFile(); 37 | 38 | /* [1] --- */ 39 | 40 | 41 | /* [2] Getters and Setters */ 42 | 43 | /* [2] --- */ 44 | 45 | protected: 46 | 47 | /* [3] Protected members */ 48 | 49 | QFile* file; 50 | 51 | /* [3] --- */ 52 | 53 | 54 | /* [4] Protected methods */ 55 | 56 | virtual void prepare(); 57 | 58 | /* [4] --- */ 59 | 60 | }; 61 | 62 | #endif // MIMEFILE_H 63 | -------------------------------------------------------------------------------- /Fares_inventory.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2015-11-02T05:26:57 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui sql printsupport network webkit 8 | QT += sql 9 | QT += network \ 10 | webkit \ 11 | xml \ 12 | xmlpatterns 13 | 14 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 15 | 16 | TARGET = Fares_inventory 17 | TARGET = smtp 18 | TEMPLATE = app 19 | 20 | 21 | SOURCES += main.cpp\ 22 | menu_inventory.cpp \ 23 | inputcontrol.cpp\ 24 | uioptions.cpp\ 25 | uiquicklog.cpp\ 26 | employee.cpp\ 27 | manager.cpp\ 28 | product.cpp \ 29 | refill_order.cpp \ 30 | delivery.cpp \ 31 | truck.cpp \ 32 | import_order.cpp \ 33 | supplier.cpp \ 34 | session.cpp\ 35 | uimainframe.cpp\ 36 | repair_report.cpp \ 37 | mail.cpp \ 38 | smtp.cpp \ 39 | productstat.cpp \ 40 | stmp.cpp 41 | 42 | HEADERS += menu_inventory.h \ 43 | product.h\ 44 | ui_mainframe.h\ 45 | inputcontrol.h\ 46 | uioptions.h\ 47 | uiquicklog.h\ 48 | employee.h\ 49 | manager.h\ 50 | refill_order.h \ 51 | delivery.h \ 52 | truck.h \ 53 | import_order.h \ 54 | supplier.h \ 55 | session.h\ 56 | repair_report.h \ 57 | mail.h \ 58 | smtp.h \ 59 | productstat.h \ 60 | stmp.h 61 | 62 | FORMS += menu_inventory.ui\ 63 | uimainframe.ui\ 64 | uioptions.ui\ 65 | uipassword.ui\ 66 | uiquicklog.ui \ 67 | mail.ui 68 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/emailaddress.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #include "emailaddress.h" 20 | 21 | /* [1] Constructors and Destructors */ 22 | 23 | EmailAddress::EmailAddress(const QString & address, const QString & name) 24 | { 25 | this->address = address; 26 | this->name = name; 27 | } 28 | 29 | EmailAddress::~EmailAddress() 30 | { 31 | } 32 | 33 | /* [1] --- */ 34 | 35 | 36 | /* [2] Getters and Setters */ 37 | 38 | void EmailAddress::setName(const QString & name) 39 | { 40 | this->name = name; 41 | 42 | } 43 | 44 | void EmailAddress::setAddress(const QString & address) 45 | { 46 | this->address = address; 47 | } 48 | 49 | const QString & EmailAddress::getName() const 50 | { 51 | return name; 52 | } 53 | 54 | const QString & EmailAddress::getAddress() const 55 | { 56 | return address; 57 | } 58 | 59 | /* [2] --- */ 60 | 61 | -------------------------------------------------------------------------------- /mytimer.cpp: -------------------------------------------------------------------------------- 1 | #include "mytimer.h" 2 | 3 | 4 | Mytimer::Mytimer() 5 | { 6 | 7 | } 8 | Mytimer::Mytimer(int id, QString pass, int time_limit) 9 | { 10 | this->id=id; 11 | this->password=pass; 12 | this->time_limit=time_limit; 13 | this->progress_time=0; 14 | } 15 | void Mytimer::lets_go() 16 | { 17 | 18 | current_p=QCursor::pos(); 19 | 20 | 21 | timer =new QTimer(this); 22 | connect(timer,SIGNAL(timeout()),this,SLOT (timed_out()));//boucle repetitive chaque 1000 ms(1 seconde ) 23 | timer->start(1000); 24 | } 25 | void Mytimer::unleash_the_dog() 26 | { 27 | timer_2 =new QTimer(this); 28 | connect(timer_2,SIGNAL(timeout()),this,SLOT (check_out()));//boucle repetitive chaque 1000 ms(1 seconde ) 29 | timer_2->start(1000); 30 | } 31 | void Mytimer::check_out() 32 | { 33 | 34 | } 35 | 36 | void Mytimer::timed_out() 37 | {QPoint pos=QCursor::pos(); 38 | 39 | 40 | 41 | if(current_p!=pos){current_p=pos;progress_time=0;}// if our user is in action then timer resets 42 | else {if(progress_time=time_limit){progress_time=0;// when progress time reaches the limit the pop up window will occure 44 | log=new quicklog(); 45 | log->set_session(id,password,time_limit); 46 | log->setFixedSize(340,200); 47 | log->exec(); 48 | 49 | 50 | 51 | } 52 | ;} 53 | } 54 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/mimetext.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #include "mimetext.h" 20 | 21 | /* [1] Constructors and Destructors */ 22 | 23 | MimeText::MimeText(const QString &txt) 24 | { 25 | this->text = txt; 26 | this->cType = "text/plain"; 27 | this->cCharset = "utf-8"; 28 | this->cEncoding = _8Bit; 29 | } 30 | 31 | MimeText::~MimeText() { } 32 | 33 | /* [1] --- */ 34 | 35 | 36 | /* [2] Getters and Setters */ 37 | 38 | void MimeText::setText(const QString & text) 39 | { 40 | this->text = text; 41 | } 42 | 43 | const QString & MimeText::getText() const 44 | { 45 | return text; 46 | } 47 | 48 | /* [2] --- */ 49 | 50 | 51 | /* [3] Protected Methods */ 52 | 53 | void MimeText::prepare() 54 | { 55 | this->content.clear(); 56 | this->content.append(text); 57 | 58 | /* !!! IMPORTANT !!! */ 59 | MimePart::prepare(); 60 | } 61 | 62 | /* [3] --- */ 63 | -------------------------------------------------------------------------------- /raises.h: -------------------------------------------------------------------------------- 1 | #ifndef RAISES_H 2 | #define RAISES_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "inputcontrol.h" 10 | 11 | 12 | class raises 13 | { 14 | public: 15 | raises(); 16 | raises(QString title, double amount); 17 | ~raises(); 18 | /*-------data input methds --------*/ 19 | bool create_raise(); 20 | bool modify_raise(int id_raise); 21 | bool delete_raise(int id_raise); 22 | bool delete_raises(int id_raise); 23 | /*------- gets-----------*/ 24 | QDate Get_date_assigned(){return date_assigned;} 25 | QString Get_title(){return title;} 26 | double Get_amount(){return amount;} 27 | void select_raise(int id); 28 | QSqlQueryModel * select_all_raises_accomplished_by_this_employee(int employee); 29 | /*--------data_assigning methods -----*/ 30 | 31 | bool assigne_this_raise_to_this_employee(int raise,int employee); 32 | bool this_employee_has_no_longer_this_raise(int id_combination); 33 | /*---------- data fetch methods ---------*/ 34 | QSqlQueryModel *select_all_raises_ids(); 35 | QSqlQueryModel *select_raises(QString var ); 36 | 37 | /*------- check methods --------*/ 38 | bool does_this_raise_already_exist(); 39 | bool does_this_employee_already_have_this_raise(int id_raise,int id_employee); 40 | 41 | private : 42 | int id_raise ; 43 | QDate date_assigned ; 44 | QString title ; 45 | double amount ; 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | }; 54 | 55 | 56 | #endif // RAISES_H 57 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/emailaddress.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #ifndef EMAILADDRESS_H 20 | #define EMAILADDRESS_H 21 | 22 | #include 23 | 24 | #include "smtpexports.h" 25 | 26 | class SMTP_EXPORT EmailAddress : public QObject 27 | { 28 | Q_OBJECT 29 | public: 30 | 31 | /* [1] Constructors and Destructors */ 32 | 33 | EmailAddress(); 34 | EmailAddress(const QString & address, const QString & name=""); 35 | 36 | ~EmailAddress(); 37 | 38 | /* [1] --- */ 39 | 40 | 41 | /* [2] Getters and Setters */ 42 | void setName(const QString & name); 43 | void setAddress(const QString & address); 44 | 45 | const QString & getName() const; 46 | const QString & getAddress() const; 47 | 48 | /* [2] --- */ 49 | 50 | 51 | private: 52 | 53 | /* [3] Private members */ 54 | 55 | QString name; 56 | QString address; 57 | 58 | /* [3] --- */ 59 | }; 60 | 61 | #endif // EMAILADDRESS_H 62 | -------------------------------------------------------------------------------- /event.h: -------------------------------------------------------------------------------- 1 | #ifndef EVENT_H 2 | #define EVENT_H 3 | #include 4 | #include 5 | #include "employee.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | using namespace std; 12 | class Event 13 | { 14 | protected: 15 | int ID_event; 16 | int ID_first_responsible; 17 | int ID_second_responsible; 18 | int ID_building; 19 | QString name; 20 | int state; 21 | QDate beginning_date; 22 | QDate ending_date; 23 | int nb_add_employees; 24 | QVector add_employees; 25 | QVector tasks; 26 | 27 | 28 | public: 29 | 30 | /* constructeurs et destructeur : */ 31 | 32 | Event(); 33 | ~Event(); 34 | Event(int ID_second_responsible , int ID_building, QString name, int state , QDate beginning_date, QDate ending_date, int nb_add_employees ); 35 | 36 | 37 | /* Méthodes : */ 38 | bool Add_event(); 39 | bool Add_add_employees_in_DB(); 40 | bool Activate_event(); 41 | bool Modify_event(); 42 | QSqlQueryModel *Display_event(); /*type adresse (pointeur)*/ 43 | QSqlQueryModel * Search(QString var); 44 | 45 | Archive(); 46 | 47 | 48 | /* Gets */ 49 | int Get_ID_event(){return ID_event;} 50 | QString Get_name(){return name;} 51 | int Get_state(){return state;} 52 | QDate Get_beginning_date() {return beginning_date;} 53 | QDate Get_ending_date() {return ending_date;} 54 | int Get_nb_add_employees(){return nb_add_employees;} 55 | int Get_ID_second_responsible(){return ID_second_responsible;} 56 | 57 | 58 | 59 | }; 60 | 61 | 62 | 63 | #endif // EVENT_H 64 | -------------------------------------------------------------------------------- /customer.h: -------------------------------------------------------------------------------- 1 | #ifndef CUSTOMER_H 2 | #define CUSTOMER_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | using namespace std ; 17 | 18 | 19 | 20 | 21 | 22 | class Customer 23 | { 24 | protected: 25 | int ID_customer; 26 | QString name; 27 | int number; 28 | QString mail; 29 | QString adress; 30 | int nb_points; 31 | 32 | 33 | int nb_cust; 34 | int nb_cust_18_25; 35 | int nb_cust_25_30; 36 | int nb_cust_30_60 ; 37 | int nb_cust_over_60 ; 38 | 39 | 40 | public: 41 | /*Constructeur et destructeur*/ 42 | Customer(); 43 | ~Customer(); 44 | Customer(QString name,int number,QString mail,QString adress, int nb_points); 45 | /*Méthodes*/ 46 | bool add_new_customer(); 47 | bool modify_customer(int ID_customer); 48 | bool delete_customer(int ID_customer); 49 | Modify(); 50 | Archive(); 51 | /*Affichage*/ 52 | QSqlQueryModel *Display(); 53 | QSqlQueryModel *client_id_list(); 54 | void select_client(int id); 55 | Get_nb_points(){return nb_points;} 56 | QString Get_family_name(){return name;} 57 | /*statistiques*/ 58 | int get_nb_cust(){return nb_cust;} 59 | int get_nb_cust_18_25() {return nb_cust_18_25;} 60 | int get_nb_cust_25_30 (){return nb_cust_25_30;} 61 | int get_nb_cust_30_60 (){return nb_cust_30_60;} 62 | int get_nb_cust_over_60 (){return nb_cust_over_60;} 63 | 64 | 65 | 66 | }; 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | #endif // CUSTOMER_H 78 | -------------------------------------------------------------------------------- /promotion.h: -------------------------------------------------------------------------------- 1 | #ifndef PROMOTION_H 2 | #define PROMOTION_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include "inputcontrol.h" 12 | using namespace std; 13 | 14 | class promotion 15 | { 16 | public: 17 | /*------- const/dest---------*/ 18 | promotion(); 19 | promotion(QString original_p,QString foreign_p ,double bonus_salary,int employee ); 20 | ~promotion(); 21 | /*-----------data input methods ----------*/ 22 | bool add_promotion(); 23 | bool modify_promotion(int promotion); 24 | bool delete_promotion(int promotion); 25 | /*----------data manipulations methods---------*/ 26 | QSqlQueryModel *select_all_promotions_id(); 27 | QSqlQueryModel *select_all_promotions_id(int employee); 28 | QSqlQueryModel *select_all_promotions(QString var, QString column , QString order); 29 | /*---------- statistics data gathering --------*/ 30 | void count_salarys_for_this_fella(int employee); 31 | int get_me_this_employee_promotions_history(int employee); 32 | /*---------------gets for statistics-----------*/ 33 | double get_salary(int order_in_vector){return salarys_employee[order_in_vector];} 34 | QDate get_promotion_date_from_list(int order_in_vector){return promotions_employee[order_in_vector];} 35 | 36 | 37 | 38 | 39 | private: 40 | int id_promotion; 41 | QDate date_added; 42 | QString original_p; 43 | QString foreign_p; 44 | double bonus_salary; 45 | int employee; 46 | vectorsalarys_employee; 47 | vector promotions_employee; 48 | 49 | 50 | }; 51 | 52 | #endif // PROMOTION_H 53 | -------------------------------------------------------------------------------- /Charge.h: -------------------------------------------------------------------------------- 1 | #ifndef CHARGE_H 2 | #define CHARGE_H 3 | 4 | #include 5 | #include 6 | #include "session.h" 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "building.h" 13 | #include 14 | #include 15 | class Charge 16 | { 17 | public: 18 | Charge(QString,QString,int,double,QString); 19 | Charge(); 20 | ~Charge(); 21 | int Getid_charge() { return id_charge; } 22 | void Setid_charge( int val) { id_charge = val; } 23 | QString GetDescription() { return Description; } 24 | void SetDescription(QString val) { Description = val; } 25 | QString GetType() { return Type; } 26 | void SetType(QString val) { Type = val; } 27 | int GetID_building() { return ID_building; } 28 | void SetID_building( int val) { ID_building = val; } 29 | double Getamount() { return amount; } 30 | void Setamount(double val) { amount = val; } 31 | 32 | bool create_charge(); 33 | void modify_chare(unsigned int ); 34 | void delete_charge(unsigned int); 35 | QSqlQueryModel * displayid(); 36 | 37 | 38 | vector tab_nom; 39 | vector tab_id; 40 | vector tab_amount; 41 | void set_id(); 42 | void set_amount(); 43 | QSqlQueryModel *displaycharges(); 44 | QSqlQueryModel *displaychargesbyname(QString value); 45 | 46 | 47 | 48 | protected: 49 | private: 50 | int id_charge; 51 | QString Description; 52 | QString Type; 53 | int ID_building; 54 | double amount; 55 | QString date; 56 | 57 | }; 58 | 59 | #endif // CHARGE_H 60 | -------------------------------------------------------------------------------- /uipassword.cpp: -------------------------------------------------------------------------------- 1 | #include "uipassword.h" 2 | #include "ui_uipassword.h" 3 | 4 | 5 | password::password(QWidget *parent) : 6 | QDialog(parent), 7 | ui(new Ui::password) 8 | { 9 | ui->setupUi(this); 10 | this->setWindowTitle("Session Control"); 11 | QPixmap pix("C:/Users/gambler/Pictures/icon_hamadi.jpg"); 12 | 13 | QIcon p=pix.scaled(128,128); 14 | 15 | this->setWindowIcon(p); 16 | this->setAutoFillBackground(true); 17 | 18 | 19 | } 20 | 21 | password::~password() 22 | { 23 | delete ui; 24 | } 25 | 26 | void password::on_change_clicked() 27 | { 28 | int id1=ui->id_employer->text().toInt(); 29 | 30 | QString oldpwd= ui->ancien_mdp->text(); 31 | QString conpwd= ui->conf_mdp->text(); 32 | QString newpwd= ui->mdp->text(); 33 | if(oldpwd!=pass) 34 | {QMessageBox::critical(0,"fatal","the password you entred does not match the existing password ", QMessageBox::Ok);} 35 | else if(conpwd!=newpwd) 36 | {QMessageBox::critical(0,"fatal","passwords missmatch" ,QMessageBox::Ok);;} 37 | 38 | else 39 | { 40 | 41 | 42 | int res= QMessageBox::warning(this,"warning"," أنت على وشك تغيير كلمة المرور الخاصة بك ! \n are you sure ? ","yes","no"); 43 | if(res==1) 44 | { 45 | QMessageBox::information(0,"system","password change request canceled",QMessageBox::Accepted); 46 | } 47 | else if(res==0) 48 | {session s(id1,newpwd);pass=newpwd; 49 | if(s.change_password()==false){QMessageBox::critical(0,"fatal","date base time out" ,QMessageBox::Ok);} 50 | else{QMessageBox::information(0,"fatal","password changed بنجاح" ,QMessageBox::Ok);} 51 | } 52 | } 53 | } 54 | void password::load_credentials(int ide, QString pwd) 55 | 56 | { 57 | QString id1=QString::number(ide); 58 | ui->id_employer->setText(id1); 59 | pass=pwd; 60 | 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /truck.h: -------------------------------------------------------------------------------- 1 | #ifndef TRUCK_H 2 | #define TRUCK_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class Truck 12 | { 13 | private: 14 | int id_truck; 15 | QString type; 16 | int city_state_nb; 17 | QString size; 18 | QString power; 19 | float max_weight; 20 | float initial_weight; 21 | float price; 22 | QString contract; 23 | QString availability; 24 | QString reason; 25 | int serial_num; 26 | int building; 27 | public: 28 | Truck(); 29 | Truck(QString type, int city_state_nb, QString size, QString power, float max_weight, float initial_weight, float price, QString contract, QString availability, QString reason, int serial_num,int building); 30 | bool add (); 31 | 32 | bool modify(int aux); 33 | 34 | bool Supprimer_T(int id_truck); 35 | void search(); 36 | 37 | void select_truck(int aux); 38 | 39 | 40 | /*--------------------------gets--------------------*/ 41 | QString Get_type(){return type;} 42 | QString Get_power(){return power;} 43 | QString Get_size(){return size;} 44 | QString Get_availability(){return availability;} 45 | int Get_id_truck(){return id_truck;} 46 | int Get_city_state_nb(){return city_state_nb;} 47 | QString Get_reason(){return reason;} 48 | float Get_initial_weight(){return initial_weight ;} 49 | float Get_price(){return price;} 50 | QString Get_contract(){return contract ;} 51 | int Get_serial_num(){return serial_num;} 52 | float Get_max_weight(){return max_weight;} 53 | 54 | 55 | QSqlQueryModel *display_truck(); 56 | QSqlQueryModel *display_driver(); 57 | QSqlQueryModel *search_truck(QString value); 58 | }; 59 | 60 | #endif // TRUCK_H 61 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/mimefile.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #include "mimefile.h" 20 | #include 21 | 22 | /* [1] Constructors and Destructors */ 23 | 24 | MimeFile::MimeFile(QFile *file) 25 | { 26 | this->file = file; 27 | this->cType = "application/octet-stream"; 28 | this->cName = QFileInfo(*file).fileName(); 29 | this->cEncoding = Base64; 30 | } 31 | 32 | MimeFile::MimeFile(const QByteArray& stream, const QString& fileName) 33 | { 34 | this->cEncoding = Base64; 35 | this->cType = "application/octet-stream"; 36 | this->file = 0; 37 | this->cName = fileName; 38 | this->content = stream; 39 | } 40 | 41 | MimeFile::~MimeFile() 42 | { 43 | if (file) 44 | delete file; 45 | } 46 | 47 | /* [1] --- */ 48 | 49 | 50 | /* [2] Getters and setters */ 51 | 52 | /* [2] --- */ 53 | 54 | 55 | /* [3] Protected methods */ 56 | 57 | void MimeFile::prepare() 58 | { 59 | if (this->file) 60 | { 61 | file->open(QIODevice::ReadOnly); 62 | this->content = file->readAll(); 63 | file->close(); 64 | } 65 | /* !!! IMPORTANT !!!! */ 66 | MimePart::prepare(); 67 | } 68 | 69 | /* [3] --- */ 70 | 71 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/demos/demo1/demo1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "../../src/SmtpMime" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QCoreApplication a(argc, argv); 8 | 9 | // This is a first demo application of the SmtpClient for Qt project 10 | 11 | 12 | // First we need to create an SmtpClient object 13 | // We will use the Gmail's smtp server (smtp.gmail.com, port 465, ssl) 14 | 15 | SmtpClient smtp("smtp.gmail.com", 465, SmtpClient::SslConnection); 16 | 17 | // We need to set the username (your email address) and password 18 | // for smtp authentification. 19 | 20 | smtp.setUser("your_email_address@host.com"); 21 | smtp.setPassword("your_password"); 22 | 23 | // Now we create a MimeMessage object. This is the email. 24 | 25 | MimeMessage message; 26 | 27 | EmailAddress sender("your_email_address@host.com", "Your Name"); 28 | message.setSender(&sender); 29 | 30 | EmailAddress to("recipient@host.com", "Recipient's Name"); 31 | message.addRecipient(&to); 32 | 33 | message.setSubject("SmtpClient for Qt - Demo"); 34 | 35 | // Now add some text to the email. 36 | // First we create a MimeText object. 37 | 38 | MimeText text; 39 | 40 | text.setText("Hi,\nThis is a simple email message.\n"); 41 | 42 | // Now add it to the mail 43 | 44 | message.addPart(&text); 45 | 46 | // Now we can send the mail 47 | 48 | if (!smtp.connectToHost()) { 49 | qDebug() << "Failed to connect to host!" << endl; 50 | return -1; 51 | } 52 | 53 | if (!smtp.login()) { 54 | qDebug() << "Failed to login!" << endl; 55 | return -2; 56 | } 57 | 58 | if (!smtp.sendMail(message)) { 59 | qDebug() << "Failed to send mail!" << endl; 60 | return -3; 61 | } 62 | 63 | smtp.quit(); 64 | 65 | } 66 | -------------------------------------------------------------------------------- /manager.h: -------------------------------------------------------------------------------- 1 | #ifndef MANAGER_H 2 | #define MANAGER_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "employee.h" 9 | 10 | 11 | using namespace std ; 12 | 13 | class manager:public employee 14 | { 15 | private: 16 | 17 | QString pwd; 18 | QString type; 19 | QString email; 20 | public: 21 | /*------ const/dest------*/ 22 | manager(); 23 | manager(QString pwd, QString type, QString email); 24 | manager(QString pwd, QString type, QString email, QString name, QString family_name, QDate birthdate, QString social_state, long int social_sn, QString zip_code, QString street, QString area , QString city, int phone_number, int Cin , double salary, QString post , QString gender , bool activity , QString contract_type , QString paiment_type , int interveiwer , QString c_v , QString m_l, QString photo, int building); 25 | manager(QString type, QString email, QString name, QString family_name, QDate birthdate, QString social_state, long int social_sn, QString zip_code, QString street, QString area , QString city, int phone_number, int Cin , double salary, QString post , QString gender , bool activity , QString contract_type , QString paiment_type , int interveiwer , QString c_v , QString m_l, QString photo, int building); 26 | /*-------- gets-------*/ 27 | QString getpwd(){return pwd;} 28 | QString gettype(){return type;} 29 | QString get_email(){return email;} 30 | /*--------data input methods -------*/ 31 | bool add_manager(); 32 | bool modify_manager(int id); 33 | bool delete_manager(int id); 34 | /*--------data selection methods-----*/ 35 | void select_manager(int); 36 | /*-------- data transformation methods -----*/ 37 | bool this_employee_became_a_manager(int employee); 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | }; 46 | 47 | #endif // MANAGER_H 48 | -------------------------------------------------------------------------------- /product.h: -------------------------------------------------------------------------------- 1 | #ifndef PRODUCT_H 2 | #define PRODUCT_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "inputcontrol.h" 11 | 12 | 13 | class Product 14 | { 15 | int id_product; 16 | QDate added_date; 17 | int quantity; 18 | QString color; 19 | QString size; 20 | QString name; 21 | QString type_of_fabric; 22 | QString gender; 23 | QString category; 24 | float weight; 25 | float initial_price; 26 | int nb_point; 27 | float production_price; 28 | int existence; 29 | public: 30 | 31 | /*--------------------------gets--------------------*/ 32 | QString Get_name(){return name;} 33 | QString Get_color(){return color;} 34 | QString Get_size(){return size;} 35 | QString Get_type_of_fabric(){return type_of_fabric;} 36 | int Get_id_product(){return id_product;} 37 | int Get_quantity(){return quantity;} 38 | QString Get_category(){return category;} 39 | float Get_initial_price(){return initial_price ;} 40 | float Get_weight(){return weight;} 41 | QString Get_gender(){return gender ;} 42 | int Get_nb_point(){return nb_point;} 43 | float Get_production_price(){return production_price;} 44 | QDate Get_add_date(){return added_date;} 45 | 46 | /*--------data manipulation methods --------------*/ 47 | Product(); 48 | Product(QDate added_date,int quantity,QString color,QString size,QString name,QString type_of_fabric,QString gender,QString category,float weight,float initial_price,int nb_point,float production_price); 49 | bool add (); 50 | bool modify(int id); 51 | bool Supprimer(int id_product); 52 | void search(); 53 | QSqlQueryModel *display_product(); 54 | QSqlQueryModel *search_product(QString type, QString value); 55 | void select_product(int aux); 56 | QSqlQueryModel *select_ID_product(); 57 | }; 58 | 59 | #endif // PRODUCT_H 60 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/mimecontentformatter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #include "mimecontentformatter.h" 20 | 21 | MimeContentFormatter::MimeContentFormatter(int max_length) : 22 | max_length(max_length) 23 | {} 24 | 25 | QString MimeContentFormatter::format(const QString &content, bool quotedPrintable) const { 26 | 27 | QString out; 28 | 29 | int chars = 0; 30 | for (int i = 0; i < content.length() ; ++i) { 31 | chars++; 32 | if (!quotedPrintable) { 33 | if (chars > max_length) { 34 | out.append("\r\n"); 35 | chars = 1; 36 | } 37 | } 38 | else { 39 | if (content[i] == '\n') { // new line 40 | out.append(content[i]); 41 | chars = 0; 42 | continue; 43 | } 44 | 45 | if ((chars > max_length - 1) 46 | || ((content[i] == '=') && (chars > max_length - 3) )) { 47 | out.append('='); 48 | out.append("\r\n"); 49 | chars = 1; 50 | } 51 | 52 | } 53 | out.append(content[i]); 54 | } 55 | 56 | return out; 57 | 58 | } 59 | 60 | void MimeContentFormatter::setMaxLength(int l) { 61 | max_length = l; 62 | } 63 | 64 | int MimeContentFormatter::getMaxLength() const { 65 | return max_length; 66 | } 67 | -------------------------------------------------------------------------------- /Payment_report.h: -------------------------------------------------------------------------------- 1 | #ifndef PAYMENT_REPORT_H 2 | #define PAYMENT_REPORT_H 3 | #include 4 | #include 5 | #include "session.h" 6 | #include 7 | #include 8 | class Payment_report 9 | { 10 | public: 11 | Payment_report(); 12 | ~Payment_report(); 13 | unsigned int Getid_payslip() { return id_payslip; } 14 | void Setid_payslip(unsigned int val) { id_payslip = val; } 15 | double Getnet_pay() { return net_pay; } 16 | void Setnet_pay(double val) { net_pay = val; } 17 | double Getbasic_pay() { return basic_pay; } 18 | void Setbasic_pay(double val) { basic_pay = val; } 19 | double Getraises() { return raises; } 20 | void Setraises(double val) { raises = val; } 21 | double Getadvances() { return advances; } 22 | void Setadvances(double val) { advances = val; } 23 | double Gettaxes() { return taxes; } 24 | void Settaxes(double val) { taxes = val; } 25 | double Getinsurance() { return insurance; } 26 | void Setinsurance(double val) { insurance = val; } 27 | double Getpension() { return pension; } 28 | void Setpension(double val) { pension = val; } 29 | QDate Getpay_date() { return pay_date; } 30 | void Setpay_date(QDate val) { pay_date = val; } 31 | 32 | bool calculate_payslip(unsigned int, int , int); 33 | void displaypayslip(unsigned int, int , int); 34 | QSqlQueryModel *displayallpayslip(); 35 | QSqlQueryModel *searchpayslip(QString); 36 | 37 | void export_pdf_payslip(unsigned int); 38 | void print_payslip(unsigned int); 39 | 40 | 41 | QStringList List; 42 | 43 | 44 | 45 | protected: 46 | private: 47 | unsigned int id_payslip; 48 | double net_pay; 49 | double basic_pay; 50 | double raises; 51 | double advances; 52 | double taxes; 53 | double insurance; 54 | double pension; 55 | QDate pay_date; 56 | }; 57 | 58 | #endif // PAYMENT_REPORT_H 59 | -------------------------------------------------------------------------------- /uiquicklog.cpp: -------------------------------------------------------------------------------- 1 | #include "uiquicklog.h" 2 | #include "ui_uiquicklog.h" 3 | 4 | quicklog::quicklog(QWidget *parent) : QDialog(parent),ui(new Ui::quicklog) 5 | { 6 | ui->setupUi(this); 7 | this->setWindowTitle("Activity monitor"); 8 | ui->time_limit_lab->setText(QString::number(time_limit)); 9 | 10 | ui->wrong_attempts->setText(QString::number(3)); 11 | 12 | 13 | } 14 | 15 | void quicklog::set_session(int id, QString pwd, int time_limit) 16 | {this->id=id; 17 | this->pwd=pwd; 18 | attempts=3; 19 | this->time_limit=time_limit; 20 | ui->wrong_attempts->setText("3"); 21 | 22 | } 23 | 24 | quicklog::~quicklog() 25 | { 26 | delete ui; 27 | } 28 | void quicklog::closeEvent(QCloseEvent *event) 29 | { 30 | return event->ignore(); 31 | } 32 | 33 | 34 | void quicklog::on_connection_clicked() 35 | { 36 | int idc=ui->id->text().toInt(); 37 | QString pwdc=ui->password->text(); 38 | if(idc==id&&pwd==pwdc) 39 | { 40 | QMessageBox::information(0,"system","welcome back !",QMessageBox::Ok); 41 | this->hide(); 42 | } 43 | else { if(attempts>1) 44 | { 45 | attempts--; 46 | QString timelimit=QString::number(time_limit); 47 | ui->time_limit_lab->setText(timelimit); 48 | QString w_attempts=QString::number(attempts); 49 | ui->wrong_attempts->setText(w_attempts); 50 | 51 | } 52 | else 53 | { 54 | QMessageBox::critical(0,"system","you have failed to specify the right id/password\n you will be logged off ",QMessageBox::Ok); 55 | QProcess::startDetached(QApplication::applicationFilePath());exit(12); 56 | } 57 | } 58 | } 59 | 60 | void quicklog::on_close_clicked() 61 | {int choice=QMessageBox::warning(0,"system","by pressing continue \nyou are loging yourself off ","continue","cancel"); 62 | if(choice==0) 63 | { this->close(); 64 | QProcess::startDetached(QApplication::applicationFilePath());exit(12); 65 | } 66 | else { 67 | /* stand by */ 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Supplier.h: -------------------------------------------------------------------------------- 1 | #ifndef SUPPLIER_H 2 | #define SUPPLIER_H 3 | #include 4 | #include 5 | #include "session.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | class Supplier 12 | { 13 | public: 14 | Supplier(); 15 | ~Supplier(); 16 | QString Getsupplier_name() { return supplier_name; } 17 | void Setsupplier_name(QString val) { supplier_name = val; } 18 | QString Getemail() { return email; } 19 | void Setemail(QString val) { email = val; } 20 | QString Getdescription() { return description; } 21 | void Setdescription(QString val) { description = val; } 22 | unsigned int Gettel() { return tel; } 23 | void Settel(unsigned int val) { tel = val; } 24 | unsigned int Getfax() { return fax; } 25 | void Setfax(unsigned int val) { fax = val; } 26 | QDate Getadd_date() { return add_date; } 27 | void Setadd_date(QDate val) { add_date = val; } 28 | long Getid_supplier() { return id_supplier; } 29 | void Setid_supplier(long val) { id_supplier = val; } 30 | QString getarea(){return area;} 31 | QString getstreet(){return street;} 32 | QString getzip(){return zip_code;} 33 | QString getcity(){return city;} 34 | Supplier(QString,QString,QString,int,int,QString,QString,QString,QString); 35 | 36 | bool add_supplier(); 37 | bool modify_supplier( int); 38 | bool delete_supplier( int); 39 | QSqlQueryModel * search_supplier(QString,QString ); 40 | QSqlQueryModel * display_supplier(); 41 | 42 | QSqlQueryModel *supplier_id_list(); 43 | void select_supplier(int); 44 | 45 | 46 | 47 | private: 48 | 49 | QString supplier_name; 50 | QString email; 51 | QString description; 52 | int tel; 53 | int fax; 54 | QDate add_date; 55 | int id_supplier; 56 | QString zip_code; 57 | QString street; 58 | QString area; 59 | QString city; 60 | }; 61 | 62 | #endif // SUPPLEIR_H 63 | -------------------------------------------------------------------------------- /statfinanace.cpp: -------------------------------------------------------------------------------- 1 | #include "statfinanace.h" 2 | #include 3 | statfinanace::statfinanace(QWidget *parent) : QWidget(parent) 4 | { 5 | 6 | } 7 | 8 | statfinanace::statfinanace() 9 | { 10 | 11 | } 12 | statfinanace::~statfinanace() 13 | { 14 | 15 | } 16 | void statfinanace::set_data(vectortab_amount ,vector tab_id,vector tab_nom) 17 | { 18 | this->tab_nom=tab_nom; 19 | this-> tab_amount= tab_amount; 20 | this->tab_id =tab_id; 21 | repaint(); 22 | update(); 23 | } 24 | 25 | void statfinanace::paintEvent(QPaintEvent *) 26 | { 27 | 28 | 29 | // vector::iterator amount; 30 | 31 | 32 | 33 | QPainter painter(this); 34 | QPen pen; 35 | QRectF size,name; 36 | pen.setColor(Qt::black); 37 | pen.setWidth(2); 38 | painter.setPen(pen); 39 | if(this->height() > this->width()) 40 | { 41 | size=QRectF(5,5,this->width()-10,this->width()-10); 42 | } 43 | else 44 | { 45 | size=QRectF(5,5,this->height()-10,this->height()-10); 46 | } 47 | 48 | double sum =0.0,startangle=0.0; 49 | double angle=0.0,endangle=0.0,percent=0.0; 50 | 51 | 52 | for(unsigned int i=0;i & getParts() const; 57 | 58 | /* [2] --- */ 59 | 60 | /* [3] Public methods */ 61 | 62 | void addPart(MimePart *part); 63 | 64 | virtual void prepare(); 65 | 66 | /* [3] --- */ 67 | 68 | protected: 69 | QList< MimePart* > parts; 70 | 71 | MultiPartType type; 72 | 73 | }; 74 | 75 | #endif // MIMEMULTIPART_H 76 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/quotedprintable.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #include "quotedprintable.h" 20 | 21 | QString QuotedPrintable::encode(const QByteArray &input) 22 | { 23 | QString output; 24 | 25 | char byte; 26 | const char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; 27 | 28 | for (int i = 0; i < input.length() ; ++i) 29 | { 30 | byte = input[i]; 31 | 32 | if ((byte == 0x20) || ((byte >= 33) && (byte <= 126) && (byte != 61))) 33 | { 34 | output.append(byte); 35 | } 36 | else 37 | { 38 | output.append('='); 39 | output.append(hex[((byte >> 4) & 0x0F)]); 40 | output.append(hex[(byte & 0x0F)]); 41 | } 42 | } 43 | 44 | return output; 45 | } 46 | 47 | 48 | QByteArray QuotedPrintable::decode(const QString &input) 49 | { 50 | // 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F 51 | const int hexVal[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15}; 52 | 53 | QByteArray output; 54 | 55 | for (int i = 0; i < input.length(); ++i) 56 | { 57 | if (input.at(i).toLatin1() == '=') 58 | { 59 | output.append((hexVal[input.at(i + 1).toLatin1() - '0'] << 4) + hexVal[input.at(i + 2).toLatin1() - '0']); 60 | i += 2; 61 | } 62 | else 63 | { 64 | output.append(input.at(i).toLatin1()); 65 | } 66 | } 67 | 68 | return output; 69 | } 70 | -------------------------------------------------------------------------------- /order.h: -------------------------------------------------------------------------------- 1 | #ifndef ORDER_H 2 | #define ORDER_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include "inputcontrol.h" 12 | using namespace std; 13 | 14 | class Order 15 | { 16 | public: 17 | Order(); 18 | ~Order(); 19 | 20 | /*------- Ajout -----*/ 21 | 22 | bool ajouter(); 23 | bool add_order_line_in_bd(); 24 | void insert_order_data_2(int order_id_client); 25 | void insert_order_data( QString client_name,int client_phone_number,bool delivery); 26 | void add_line(int id_product, int qunty); 27 | int update_line_quantity(int qnt, int pos); 28 | 29 | void cancel_line(int pos); 30 | /*------- Affichage-----*/ 31 | QSqlQueryModel *Display_Order(); 32 | QSqlQueryModel * afficher(); 33 | /*------- Recherche-----*/ 34 | QSqlQueryModel *search_Order(QString type, QString value); 35 | /*------- Suppression -----*/ 36 | bool delete_Order(int id_order); 37 | 38 | /*------------ modify ---------------*/ 39 | void updte_line(int id_product,int qnt,int pos);// function that modifys order_line 40 | 41 | /*------- Gets and methods needed in modify -----*/ 42 | 43 | int get_product() {return product;} 44 | void set_product (int value); 45 | int get_quatity() {return quantity_tool;} 46 | void fetch_line_order_values(int ID_order); 47 | int get_rows_quantity(){return product;} 48 | void insert_table_items (); 49 | int get_id_line (int pos){return id_lines_edited[pos];} 50 | int get_quatity(int pos ){return quantity[pos];} 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | private: 59 | int id_order; 60 | int id_export_line; 61 | int client ; 62 | QString client_name; 63 | int client_phone_number; 64 | QString status; 65 | bool delivery ; 66 | QDate date_of_transaction; 67 | vector products; 68 | vector quantity; 69 | vectorid_lines_edited; 70 | int quantityy; 71 | int quantity_tool ; 72 | int product; 73 | 74 | }; 75 | #endif // ORDER_H 76 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/demos/demo3/demo3.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | SmtpClient for Qt is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | SmtpClient for Qt is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY. 13 | 14 | See the LICENSE file for more details. 15 | */ 16 | 17 | #include 18 | 19 | #include "../../src/SmtpMime" 20 | 21 | int main(int argc, char *argv[]) 22 | { 23 | QCoreApplication a(argc, argv); 24 | 25 | // First create the SmtpClient object and set the user and the password. 26 | 27 | SmtpClient smtp("smtp.gmail.com", 465, SmtpClient::SslConnection); 28 | 29 | smtp.setUser("your_email@host.com"); 30 | smtp.setPassword("your_password"); 31 | 32 | // Create a MimeMessage 33 | 34 | MimeMessage message; 35 | 36 | EmailAddress sender("your_email_address@host.com", "Your Name"); 37 | message.setSender(&sender); 38 | 39 | EmailAddress to("recipient@host.com", "Recipient's Name"); 40 | message.addRecipient(&to); 41 | 42 | message.setSubject("SmtpClient for Qt - Demo"); 43 | 44 | // Add some text 45 | MimeText text; 46 | text.setText("Hi!\n This is an email with some attachments."); 47 | message.addPart(&text); 48 | 49 | // Now we create the attachment object 50 | MimeAttachment attachment (new QFile("image1.jpg")); 51 | 52 | // the file type can be setted. (by default is application/octet-stream) 53 | attachment.setContentType("image/jpg"); 54 | 55 | // Now add it to message 56 | message.addPart(&attachment); 57 | 58 | // Add an another attachment 59 | MimeAttachment document(new QFile("document.pdf")); 60 | message.addPart(&document); 61 | 62 | // Now we can send the mail 63 | 64 | if (!smtp.connectToHost()) { 65 | qDebug() << "Failed to connect to host!" << endl; 66 | return -1; 67 | } 68 | 69 | if (!smtp.login()) { 70 | qDebug() << "Failed to login!" << endl; 71 | return -2; 72 | } 73 | 74 | if (!smtp.sendMail(message)) { 75 | qDebug() << "Failed to send mail!" << endl; 76 | return -3; 77 | } 78 | 79 | smtp.quit(); 80 | 81 | } 82 | -------------------------------------------------------------------------------- /discount_event.cpp: -------------------------------------------------------------------------------- 1 | #include "discount_event.h" 2 | 3 | Discount_event::Discount_event() 4 | { 5 | 6 | 7 | } 8 | Discount_event::~Discount_event() 9 | { 10 | 11 | 12 | } 13 | 14 | Discount_event::Discount_event (int ID_second_responsible , int ID_building, QString name, int state , QDate beginning_date, QDate ending_date, int nb_add_employees ):Event(ID_second_responsible,ID_building,name, state, beginning_date, ending_date, nb_add_employees) 15 | { 16 | 17 | 18 | } 19 | 20 | bool Discount_event:: Add_disc() 21 | { 22 | QSqlQuery query; 23 | inputcontrol p ; 24 | bool res; 25 | ID_discount= p.generate_bar_code("discount"); 26 | Add_event(); 27 | for(int i=0;iprepare("select *from Event inner join Discount on Event.ID_event=Discount.ID_event "); 52 | qDebug()<lastError(); 53 | query->exec(); 54 | model->setQuery(*query); 55 | 56 | return model; 57 | } 58 | 59 | 60 | 61 | 62 | 63 | 64 | /* 65 | 66 | 67 | 68 | 69 | 70 | 71 | //AJOUT VECTEUR 72 | 73 | QSqlQuery query2; 74 | inputcontrol *p; 75 | bool res; 76 | for(int i=0;igenerate_bar_code("sale_line")*(i+1)); 79 | if(ID_sale_line<0){ID_sale_line=ID_sale_line*-1;} 80 | query2.prepare("INSERT INTO sale_line (id_sale_line,quantity,sale,product)" 81 | "VALUES (:id_sale_line,:quantity,:sale,:product)"); 82 | //ajouter les vecteurs et les lire les unes aprés les autres 83 | p=new inputcontrol(); 84 | 85 | query2.bindValue(0,ID_sale_line); 86 | query2.bindValue(1,quantity[i]); 87 | query2.bindValue(2,ID_sale); 88 | query2.bindValue(3,products[i]); 89 | delete p; 90 | 91 | res =query2.exec(); 92 | qDebug()< 21 | #include 22 | 23 | const QString MULTI_PART_NAMES[] = { 24 | "multipart/mixed", // Mixed 25 | "multipart/digest", // Digest 26 | "multipart/alternative", // Alternative 27 | "multipart/related", // Related 28 | "multipart/report", // Report 29 | "multipart/signed", // Signed 30 | "multipart/encrypted" // Encrypted 31 | }; 32 | 33 | MimeMultiPart::MimeMultiPart(MultiPartType type) 34 | { 35 | this->type = type; 36 | this->cType = MULTI_PART_NAMES[this->type]; 37 | this->cEncoding = _8Bit; 38 | 39 | QCryptographicHash md5(QCryptographicHash::Md5); 40 | md5.addData(QByteArray().append(qrand())); 41 | cBoundary = md5.result().toHex(); 42 | } 43 | 44 | MimeMultiPart::~MimeMultiPart() { 45 | 46 | } 47 | 48 | void MimeMultiPart::addPart(MimePart *part) { 49 | parts.append(part); 50 | } 51 | 52 | const QList & MimeMultiPart::getParts() const { 53 | return parts; 54 | } 55 | 56 | void MimeMultiPart::prepare() { 57 | QList::iterator it; 58 | 59 | content = ""; 60 | for (it = parts.begin(); it != parts.end(); it++) { 61 | content += "--" + cBoundary + "\r\n"; 62 | (*it)->prepare(); 63 | content += (*it)->toString(); 64 | }; 65 | 66 | content += "--" + cBoundary + "--\r\n"; 67 | 68 | MimePart::prepare(); 69 | } 70 | 71 | void MimeMultiPart::setMimeType(const MultiPartType type) { 72 | this->type = type; 73 | this->cType = MULTI_PART_NAMES[type]; 74 | } 75 | 76 | MimeMultiPart::MultiPartType MimeMultiPart::getMimeType() const { 77 | return type; 78 | } 79 | -------------------------------------------------------------------------------- /client.cpp: -------------------------------------------------------------------------------- 1 | #include "customer.h" 2 | #include "client.h" 3 | 4 | 5 | Client::~Client() 6 | { 7 | 8 | } 9 | Client::Client() 10 | { 11 | 12 | } 13 | Client::Client(QString family_name,QString gender,QDate birth_date,QString CIN,QString name,int number,QString mail,QString adress):Customer(name,number,mail,adress,nb_points) 14 | { this->family_name=family_name; 15 | this->gender=gender; 16 | this->birth_date=birth_date; 17 | this->CIN=CIN; 18 | } 19 | 20 | 21 | bool Client::add_new_client() 22 | { 23 | QSqlQuery query; 24 | add_new_customer(); 25 | query.prepare("insert into Client (ID_customer,family_name,gender,birth_date,CIN) values (:ID_customer,:family_name,:gender,:birth_date,:CIN)"); 26 | query.bindValue(0,ID_customer); 27 | query.bindValue(1,family_name); 28 | query.bindValue(2,gender); 29 | query.bindValue(3,birth_date); 30 | query.bindValue(4,CIN); 31 | qDebug()<prepare("select *from Customer inner join Client on Customer.ID_customer=Client.ID_customer "); 40 | qDebug()<lastError(); 41 | query->exec(); 42 | model->setQuery(*query); 43 | return model; 44 | } 45 | 46 | QSqlQueryModel *Client::search_client() 47 | { 48 | QSqlQueryModel * model= new QSqlQueryModel(); 49 | 50 | QString str="select * from Customer where ID_customer ="+QString::number(ID_customer); 51 | 52 | return model; 53 | 54 | // etc etc etc 55 | 56 | } 57 | 58 | bool Client::delete_client(int ID_customer) 59 | { 60 | delete_customer(ID_customer); 61 | QSqlQuery query; 62 | QString str="delete from Client where ID_customer ="+QString::number(ID_customer); 63 | 64 | return true; 65 | } 66 | 67 | bool Client::modify_client(int ID_customer) 68 | { 69 | QSqlQuery query ; 70 | query.prepare("UPDATE Corporate SET ID_customer=:ID_customer,type_of_ID=:type_of_ID,corp_ID=:corp_ID,corp_comm=:corp_comm,fax=:fax,type_of_contract=:type_of_contract,contract=:contract"); 71 | query.bindValue(":ID_customer",ID_customer); 72 | query.bindValue(":family_name",family_name); 73 | query.bindValue(":gender",gender); 74 | query.bindValue(":birth_date",birth_date); 75 | query.bindValue(":CIN",CIN); 76 | 77 | qDebug()< 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | 27 | 28 | class smtp : public QObject 29 | { 30 | Q_OBJECT 31 | 32 | 33 | public: 34 | smtp( const QString &user, const QString &pass, 35 | const QString &host, int port = 465, int timeout = 30000 ); 36 | ~smtp(); 37 | 38 | void sendMail( const QString &from, const QString &to, 39 | const QString &subject, const QString &body, 40 | QStringList files = QStringList()); 41 | 42 | signals: 43 | void status( const QString &); 44 | 45 | private slots: 46 | void stateChanged(QAbstractSocket::SocketState socketState); 47 | void errorReceived(QAbstractSocket::SocketError socketError); 48 | void disconnected(); 49 | void connected(); 50 | void readyRead(); 51 | 52 | private: 53 | int timeout; 54 | QString message; 55 | QTextStream *t; 56 | QSslSocket *socket; 57 | QString from; 58 | QString rcpt; 59 | QString response; 60 | QString user; 61 | QString pass; 62 | QString host; 63 | int port; 64 | enum states{Tls, HandShake ,Auth,User,Pass,Rcpt,Mail,Data,Init,Body,Quit,Close}; 65 | int state; 66 | 67 | }; 68 | #endif 69 | -------------------------------------------------------------------------------- /corporate.cpp: -------------------------------------------------------------------------------- 1 | #include "customer.h" 2 | #include "corporate.h" 3 | 4 | 5 | Corporate::~Corporate() 6 | { 7 | 8 | } 9 | Corporate::Corporate() 10 | { 11 | 12 | } 13 | Corporate::Corporate(QString type_of_ID, QString corp_ID, QString corp_comm, int fax, QString type_of_contract, QString contract, QString name, int number, QString mail, QString adress ):Customer(name,number,mail,adress,nb_points) 14 | { this->type_of_ID=type_of_ID; 15 | this->corp_ID=corp_ID; 16 | this->corp_comm=corp_comm; 17 | this->fax=fax; 18 | this->type_of_contract=type_of_contract; 19 | this->contract=contract; 20 | } 21 | 22 | bool Corporate::add_new_corp() 23 | { 24 | QSqlQuery query; 25 | add_new_customer(); 26 | query.prepare("insert into Corporate (ID_customer,type_of_ID,corp_ID,corp_comm,fax,type_of_contract,contract) values (:ID_customer,:type_of_ID,:corp_ID,:corp_comm,:fax,:type_of_contract,:contract)"); 27 | query.bindValue(0,ID_customer); 28 | query.bindValue(1,type_of_ID); 29 | query.bindValue(2,corp_ID); 30 | query.bindValue(3,corp_comm); 31 | query.bindValue(4,fax); 32 | query.bindValue(5,type_of_contract); 33 | query.bindValue(6,contract); 34 | qDebug()<prepare("select *from Customer inner join Corporate on Customer.ID_customer=Corporate.ID_customer "); 43 | qDebug()<lastError(); 44 | query->exec(); 45 | model->setQuery(*query); 46 | return model; 47 | } 48 | 49 | bool Corporate::delete_corp(int ID_customer) 50 | { 51 | delete_customer(ID_customer); 52 | QSqlQuery query; 53 | QString str="delete from Corporate where ID_customer ="+QString::number(ID_customer); 54 | return true; 55 | } 56 | bool Corporate::modify_corp(int ID_customer) 57 | { 58 | QSqlQuery query ; 59 | query.prepare("UPDATE Corporate SET ID_customer=:ID_customer,type_of_ID=:type_of_ID,corp_ID=:corp_ID,corp_comm=:corp_comm,fax=:fax,type_of_contract=:type_of_contract,contract=:contract"); 60 | query.bindValue(":ID_customer",ID_customer); 61 | query.bindValue(":type_of_ID",type_of_ID); 62 | query.bindValue(":corp_ID",corp_ID); 63 | query.bindValue(":corp_comm",corp_comm); 64 | query.bindValue(":fax",fax); 65 | query.bindValue(":type_of_contract",type_of_contract); 66 | query.bindValue(":contract",contract); 67 | qDebug()< 26 | 27 | #include "smtpexports.h" 28 | 29 | class SMTP_EXPORT MimeMessage : public QObject 30 | { 31 | public: 32 | 33 | enum RecipientType { 34 | To, // primary 35 | Cc, // carbon copy 36 | Bcc // blind carbon copy 37 | }; 38 | 39 | /* [1] Constructors and Destructors */ 40 | 41 | MimeMessage(bool createAutoMimeConent = true); 42 | ~MimeMessage(); 43 | 44 | /* [1] --- */ 45 | 46 | 47 | /* [2] Getters and Setters */ 48 | 49 | void setSender(EmailAddress* e); 50 | void addRecipient(EmailAddress* rcpt, RecipientType type = To); 51 | void addTo(EmailAddress* rcpt); 52 | void addCc(EmailAddress* rcpt); 53 | void addBcc(EmailAddress* rcpt); 54 | void setSubject(const QString & subject); 55 | void addPart(MimePart* part); 56 | 57 | void setHeaderEncoding(MimePart::Encoding); 58 | 59 | const EmailAddress & getSender() const; 60 | const QList & getRecipients(RecipientType type = To) const; 61 | const QString & getSubject() const; 62 | const QList & getParts() const; 63 | 64 | MimePart& getContent(); 65 | void setContent(MimePart *content); 66 | /* [2] --- */ 67 | 68 | 69 | /* [3] Public methods */ 70 | 71 | virtual QString toString(); 72 | 73 | /* [3] --- */ 74 | 75 | protected: 76 | 77 | /* [4] Protected members */ 78 | 79 | EmailAddress* sender; 80 | QList recipientsTo, recipientsCc, recipientsBcc; 81 | QString subject; 82 | MimePart *content; 83 | bool autoMimeContentCreated; 84 | 85 | MimePart::Encoding hEncoding; 86 | 87 | /* [4] --- */ 88 | 89 | 90 | }; 91 | 92 | #endif // MIMEMESSAGE_H 93 | -------------------------------------------------------------------------------- /customer.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "customer.h" 3 | 4 | Customer::Customer() 5 | { 6 | 7 | } 8 | 9 | Customer::Customer(QString name, int number, QString mail, QString adress, int nb_points) 10 | { 11 | this->name=name; 12 | this->number=number; 13 | this->mail=mail; 14 | this->adress=adress; 15 | this->nb_points=nb_points; 16 | } 17 | Customer::~Customer() 18 | { 19 | 20 | } 21 | 22 | 23 | bool Customer::add_new_customer() 24 | { 25 | QSqlQuery query; 26 | inputcontrol p; 27 | ID_customer=p.generate_bar_code("customer"); 28 | query.prepare("insert into Customer (ID_customer,name,number,mail,adress,adhesion_date,nb_points) values (:ID_customer,:name,:number,:mail,:adress,:adhesion_date,:nb_points)"); 29 | query.bindValue(0,ID_customer); 30 | query.bindValue(1,name); 31 | nb_points=0; 32 | query.bindValue(2,number); 33 | query.bindValue(3,mail); 34 | query.bindValue(4,adress); 35 | QDate adhesion_date=QDate::currentDate(); 36 | query.bindValue(5,adhesion_date); 37 | query.bindValue(6,nb_points); 38 | qDebug()<prepare("select id_client from client"); 74 | query->exec(); 75 | Model->setQuery(*query); 76 | return Model; 77 | } 78 | void Customer::select_client(int id) 79 | { 80 | QSqlQueryModel *model=new QSqlQueryModel(); 81 | QString id1=QString::number(id); 82 | model->setQuery("select name,total_nbr_points from client where id_client='"+id1+"' "); 83 | 84 | for(int i=0;irowCount();++i) 85 | { 86 | 87 | this->name=model->record(i).value("name").toString(); 88 | 89 | this->nb_points=model->record(i).value("total_nbr_points").toInt(); 90 | } 91 | 92 | 93 | 94 | 95 | } 96 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/demos/demo4/demo4.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | SmtpClient for Qt is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | SmtpClient for Qt is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY. 13 | 14 | See the LICENSE file for more details. 15 | */ 16 | 17 | #include 18 | 19 | #include "../../src/SmtpMime" 20 | 21 | int main(int argc, char *argv[]) 22 | { 23 | QCoreApplication a(argc, argv); 24 | 25 | // First create the SmtpClient object and set the user and the password. 26 | 27 | SmtpClient smtp("smtp.gmail.com", 465, SmtpClient::SslConnection); 28 | 29 | smtp.setUser("your_email@host.com"); 30 | smtp.setPassword("your_password"); 31 | 32 | // Create a MimeMessage 33 | 34 | MimeMessage message; 35 | 36 | EmailAddress sender("your_email_address@host.com", "Your Name"); 37 | message.setSender(&sender); 38 | 39 | EmailAddress to("recipient@host.com", "Recipient's Name"); 40 | message.addRecipient(&to); 41 | 42 | message.setSubject("SmtpClient for Qt - Example 3 - Html email with images"); 43 | 44 | // Now we need to create a MimeHtml object for HTML content 45 | MimeHtml html; 46 | 47 | html.setHtml("

Hello!

" 48 | "

This is the first image

" 49 | "" 50 | "

This is the second image

" 51 | ""); 52 | 53 | 54 | // Create a MimeInlineFile object for each image 55 | MimeInlineFile image1 (new QFile("image1.jpg")); 56 | 57 | // An unique content id must be setted 58 | image1.setContentId("image1"); 59 | image1.setContentType("image/jpg"); 60 | 61 | MimeInlineFile image2 (new QFile("image2.jpg")); 62 | image2.setContentId("image2"); 63 | image2.setContentType("image/jpg"); 64 | 65 | message.addPart(&html); 66 | message.addPart(&image1); 67 | message.addPart(&image2); 68 | 69 | // Now the email can be sended 70 | if (!smtp.connectToHost()) { 71 | qDebug() << "Failed to connect to host!" << endl; 72 | return -1; 73 | } 74 | 75 | if (!smtp.login()) { 76 | qDebug() << "Failed to login!" << endl; 77 | return -2; 78 | } 79 | 80 | if (!smtp.sendMail(message)) { 81 | qDebug() << "Failed to send mail!" << endl; 82 | return -3; 83 | } 84 | 85 | smtp.quit(); 86 | 87 | } 88 | -------------------------------------------------------------------------------- /shift.cpp: -------------------------------------------------------------------------------- 1 | #include "shift.h" 2 | 3 | shift::shift() 4 | { 5 | 6 | } 7 | 8 | shift::shift(QString type, QString day, QDate date, int employee) 9 | { 10 | this->type=type; 11 | this->day=day; 12 | this->date=date; 13 | this->employee=employee; 14 | } 15 | 16 | shift::shift(QString type, QString day, QDate date, QTime arrival_time, int employee, QString presence) 17 | { 18 | this->type=type; 19 | this->day=day; 20 | this->date=date; 21 | this->arrival_time=arrival_time; 22 | this->employee=employee; 23 | this->presence=presence; 24 | } 25 | shift::~shift() 26 | { 27 | 28 | } 29 | 30 | bool shift::create_a_shift(int pos) 31 | { 32 | QSqlQuery *query =new QSqlQuery(); 33 | inputcontrol p; 34 | id_shift=p.generate_bar_code("shift")*pos+1; 35 | query->prepare("insert into shift (id_shift,type,day,date,presence,arrival_time,employee,archive) values (:id_shift,:type,:day,:date,:presence,:arrival_time,:employee,:archive)"); 36 | query->bindValue(0,id_shift); 37 | query->bindValue(1,type); 38 | query->bindValue(2,day); 39 | query->bindValue(3,date); 40 | query->bindValue(4,presence); 41 | query->bindValue(5,arrival_time); 42 | query->bindValue(6,employee); 43 | query->bindValue(7,false); 44 | qDebug()<<"shift creation returned...:"<lastError(); 45 | return query->exec(); 46 | 47 | } 48 | 49 | bool shift::edit_a_shift(int shift) 50 | { 51 | QSqlQuery *query =new QSqlQuery(); 52 | query->prepare("update shift set type=:type,day=:day,date=:date,presence=:presence,arrival_time=:arrival_time,employee=:employee where id_shift =:id_shift"); 53 | query->bindValue(":id_shift",shift); 54 | query->bindValue(":type",type); 55 | query->bindValue(":day",day); 56 | query->bindValue(":date",date); 57 | query->bindValue(":presence",presence); 58 | query->bindValue(":arrival_time",arrival_time); 59 | query->bindValue(":employee",employee); 60 | qDebug()<<"shift editing returned...:"<lastError(); 61 | return query->exec(); 62 | } 63 | 64 | bool shift::archive_a_shift(int shift, QString mode) 65 | { 66 | bool res=false; 67 | QSqlQuery *query =new QSqlQuery(); 68 | if(mode=="archive") 69 | { 70 | 71 | query->prepare("update shift set archive='true' where id_shift=:id_shift"); 72 | query->bindValue(":id_shift",shift); 73 | qDebug()<<"archiving a shift returned :"<lastError(); 74 | res=query->exec();} 75 | else if(mode=="delete") 76 | { 77 | 78 | query->prepare("delete from shift where id_shift=:id_shift"); 79 | qDebug()<<"deleting a shift returned :"<lastError(); 80 | res=query->exec(); 81 | } 82 | return res; 83 | } 84 | 85 | void shift::count_places_left_for_this_week(QDate start_date, QDate end_date) 86 | { 87 | QSqlQuery *query =new QSqlQuery(); 88 | QSqlQueryModel *model = new QSqlQueryModel();/* ill be back */ 89 | 90 | 91 | } 92 | 93 | 94 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/README.md: -------------------------------------------------------------------------------- 1 | SMTP Client for Qt (C++) - Version 1.1 2 | ============================================= 3 | 4 | The SmtpClient for Qt is small library writen for Qt 4 (C++ version) that allows application to send complex emails (plain text, html, attachments, inline files, etc.) using the Simple Mail Transfer Protocol (SMTP). 5 | 6 | ##New in version 1.1: 7 | 8 | - TLS (STARTTLS) connection is now supported 9 | 10 | - multiple types of recipients (to, cc, bcc) 11 | 12 | - nested mime emails (mixed/alternative, mixed/related) 13 | 14 | - output compilant with RFC2045 15 | 16 | 17 | ## SMPT Client for Qt supports 18 | 19 | - TCP and SSL connections to SMTP servers 20 | 21 | - SMTP authentication (PLAIN and LOGIN methods) 22 | 23 | - sending MIME emails (to multiple recipients) 24 | 25 | - plain text and HTML (with inline files) content in emails 26 | 27 | - multiple attachments and inline files (used in HTML) 28 | 29 | - different character sets (ascii, utf-8, etc) and encoding methods (7bit, 8bit, base64) 30 | 31 | - error handling 32 | 33 | ## Examples 34 | 35 | Lets see a simple example: 36 | 37 | ```c++ 38 | #include 39 | #include "../src/SmtpMime" 40 | 41 | int main(int argc, char *argv[]) 42 | { 43 | QApplication a(argc, argv); 44 | 45 | // This is a first demo application of the SmtpClient for Qt project 46 | 47 | // First we need to create an SmtpClient object 48 | // We will use the Gmail's smtp server (smtp.gmail.com, port 465, ssl) 49 | 50 | SmtpClient smtp("smtp.gmail.com", 465, SmtpClient::SslConnection); 51 | 52 | // We need to set the username (your email address) and the password 53 | // for smtp authentification. 54 | 55 | smtp.setUser("your_email_address@gmail.com"); 56 | smtp.setPassword("your_password"); 57 | 58 | // Now we create a MimeMessage object. This will be the email. 59 | 60 | MimeMessage message; 61 | 62 | message.setSender(new EmailAddress("your_email_address@gmail.com", "Your Name")); 63 | message.addRecipient(new EmailAddress("recipient@host.com", "Recipient's Name")); 64 | message.setSubject("SmtpClient for Qt - Demo"); 65 | 66 | // Now add some text to the email. 67 | // First we create a MimeText object. 68 | 69 | MimeText text; 70 | 71 | text.setText("Hi,\nThis is a simple email message.\n"); 72 | 73 | // Now add it to the mail 74 | 75 | message.addPart(&text); 76 | 77 | // Now we can send the mail 78 | 79 | smtp.connectToHost(); 80 | smtp.login(); 81 | smtp.sendMail(message); 82 | smtp.quit(); 83 | 84 | } 85 | ``` 86 | 87 | For more examples see the [Wiki/Examples](https://github.com/bluetiger9/SmtpClient-for-Qt/wiki/Examples). 88 | 89 | ## License 90 | 91 | This project (all files including the demos/examples) is licensed under the GNU LGPL, version 2.1. 92 | 93 | 94 | **Copyright (c) 2011 - Tőkés Attila** 95 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/mimepart.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #ifndef MIMEPART_H 20 | #define MIMEPART_H 21 | 22 | #include 23 | #include "mimecontentformatter.h" 24 | 25 | #include "smtpexports.h" 26 | 27 | class SMTP_EXPORT MimePart : public QObject 28 | { 29 | Q_OBJECT 30 | public: 31 | 32 | /* [0] Enumerations */ 33 | enum Encoding { 34 | _7Bit, 35 | _8Bit, 36 | Base64, 37 | QuotedPrintable 38 | }; 39 | 40 | 41 | /* [0] --- */ 42 | 43 | 44 | /* [1] Constructors and Destructors */ 45 | 46 | MimePart(); 47 | ~MimePart(); 48 | 49 | /* [1] --- */ 50 | 51 | 52 | /* [2] Getters and Setters */ 53 | 54 | const QString& getHeader() const; 55 | const QByteArray& getContent() const; 56 | 57 | void setContent(const QByteArray & content); 58 | void setHeader(const QString & header); 59 | 60 | void addHeaderLine(const QString & line); 61 | 62 | void setContentId(const QString & cId); 63 | const QString & getContentId() const; 64 | 65 | void setContentName(const QString & cName); 66 | const QString & getContentName() const; 67 | 68 | void setContentType(const QString & cType); 69 | const QString & getContentType() const; 70 | 71 | void setCharset(const QString & charset); 72 | const QString & getCharset() const; 73 | 74 | void setEncoding(Encoding enc); 75 | Encoding getEncoding() const; 76 | 77 | MimeContentFormatter& getContentFormatter(); 78 | 79 | /* [2] --- */ 80 | 81 | 82 | /* [3] Public methods */ 83 | 84 | virtual QString toString(); 85 | 86 | virtual void prepare(); 87 | 88 | /* [3] --- */ 89 | 90 | 91 | 92 | protected: 93 | 94 | /* [4] Protected members */ 95 | 96 | QString header; 97 | QByteArray content; 98 | 99 | QString cId; 100 | QString cName; 101 | QString cType; 102 | QString cCharset; 103 | QString cBoundary; 104 | Encoding cEncoding; 105 | 106 | QString mimeString; 107 | bool prepared; 108 | 109 | MimeContentFormatter formatter; 110 | 111 | /* [4] --- */ 112 | }; 113 | 114 | #endif // MIMEPART_H 115 | -------------------------------------------------------------------------------- /vacation.h: -------------------------------------------------------------------------------- 1 | #ifndef VACATION_H 2 | #define VACATION_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include "inputcontrol.h" 12 | 13 | class vacation 14 | { 15 | public: 16 | /*---------dest/const---------*/ 17 | vacation(); 18 | vacation(QDate start_date,QDate end_date ,QString type ,int employee ); 19 | ~vacation(); 20 | /*-------gets--------*/ 21 | QString Get_collision_direction() { return collision_direction;} 22 | QString Get_crop_or_extend(){return crop_or_extend;} 23 | QString Get_shorter_or_longer(){return shorter_or_longer;} 24 | 25 | /*---------data input methods --------*/ 26 | bool add_vacation(); 27 | bool modify_vacation(); 28 | bool delay_vacation(int days, int id); // delay a vacation to a certain period 29 | bool modify_vacation(bool action,int id);//if action is true then it will be archived if false then it will be dearchived 30 | void select_vacation(int id); // insert a specific vacation values from data_base into instence 31 | bool delete_vacation(int id );// delete a specific vacation from data_base 32 | /*-------data fetch methods-------*/ 33 | QSqlQueryModel *vacation_list(QString var);// dynamic data list for wigdet and static search too ( all ) 34 | QSqlQueryModel *vacation_id_list();//id list for combobox 35 | QSqlQueryModel *vacation_id_list(QString var);//id list for combobox to narrow the search for vacations 36 | QSqlQueryModel *vacation_list_by_employee(QString employee); 37 | QSqlQueryModel *vacation_id_list_by_employee(QString employee); 38 | QSqlQueryModel *employees_id_list_with_vacations(); 39 | /*------------check methods --------*/ 40 | bool have_this_employee_got_a_vacation_already(QString employee); 41 | bool does_this_vacation_already_exist(); 42 | bool does_this_vacation_colisions_with_an_existing_one(); 43 | bool does_this_vacation_exist_withing_an_existing_one(); 44 | bool does_this_vacation_have_one_of_its_limits_withing_an_existing_one(); 45 | bool does_this_vacation_have_another_vacation_living_inside_of_it(); 46 | bool does_this_vacation_has_a_shorter_or_longer_version(); 47 | /*------------ data transformation methods---------*/ 48 | bool extend_or_crop_vacation(int days, QString mode, int id_vacation); 49 | bool merge_vacations_into_one (int id, QDate new_start_date , QDate new_end_date); 50 | bool crop_vacation(int id,QDate new_start_date ,QDate new_end_date); 51 | 52 | 53 | 54 | 55 | 56 | private: 57 | int id_vacation ; 58 | QDate start_date ; 59 | QDate end_date ; 60 | QString type ; 61 | QDate date_of_transaction ; 62 | int employee ; 63 | /*------check vars------*/ 64 | QString collision_direction; 65 | QString crop_or_extend; 66 | QString shorter_or_longer; 67 | 68 | 69 | 70 | 71 | }; 72 | 73 | #endif // VACATION_H 74 | -------------------------------------------------------------------------------- /sale.h: -------------------------------------------------------------------------------- 1 | #ifndef SALE_H 2 | #define SALE_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | //#include 12 | #include "QtPrintSupport/QPrintDialog" 13 | #include "QtPrintSupport/QPrinter" 14 | #include "QPainter" 15 | class sale 16 | { 17 | public: 18 | 19 | sale(); 20 | ~sale(); 21 | 22 | 23 | int update_line_quantity(int qnt, int pos); 24 | void updte_line(int id_product,int qnt,int pos);// function that modifys order_line 25 | 26 | /*--------- gets--------------------*/ 27 | int GetID_sale() { return ID_sale; } 28 | void SetID_sale(long val) { ID_sale = val; } 29 | int Getnb_point() { return nb_point; } 30 | void Setnb_point(int val) { nb_point = val; } 31 | QDate Getdate() { return date; } 32 | void Setdate(QDate val) { date = val; } 33 | 34 | /*--------- ajout--------------------*/ 35 | bool ajouter(); 36 | bool add_sale_line_in_bd(); 37 | void insert_sale_data(int id_client,int id_seller); 38 | void add_line(int id_product, int qunty); 39 | void cancel_line(int pos); 40 | 41 | /*--------- affichage--------------------*/ 42 | QSqlQueryModel *Display_sale(); 43 | QSqlQueryModel * afficher(); 44 | /*--------- recherches--------------------*/ 45 | QSqlQueryModel *search_sale(QString type, QString value); 46 | /*--------- suppression--------------------*/ 47 | bool delete_sale(int ID_sale); 48 | 49 | /*--------statistics methods Bargraph --------------*/ 50 | void select_date(); 51 | /*--------statistics methods PieChart --------------*/ 52 | void count_products(); 53 | /*--------statistics Bargraph Gets--------------*/ 54 | double Get_sales_2010_2011(){return sales_2010_2011;} 55 | double Get_sales_2011_2012(){return sales_2011_2012;} 56 | double Get_sales_2012_2013(){return sales_2012_2013;} 57 | double Get_sales_2013_2014(){return sales_2013_2014;} 58 | double Get_sales_2014_2015(){return sales_2014_2015;} 59 | /*--------statistics PieChart Gets--------------*/ 60 | double Get_product_groupe(){return product_groupe;} 61 | double Get_total_products(){return total_products; } 62 | private: 63 | int ID_sale; 64 | int ID_sale_line; 65 | int nb_point; 66 | int client; 67 | int seller; 68 | QDate date; 69 | int old_qt; 70 | int total_point_fidelity; 71 | QVector products; 72 | QVector quantity; 73 | double sales_2010_2011; 74 | double sales_2011_2012; 75 | double sales_2012_2013; 76 | double sales_2013_2014; 77 | double sales_2014_2015; 78 | double total_products; 79 | double product_groupe; 80 | double sale_client; 81 | double total_sale; 82 | }; 83 | 84 | #endif // SALE_H 85 | -------------------------------------------------------------------------------- /Advance.cpp: -------------------------------------------------------------------------------- 1 | #include "Advance.h" 2 | 3 | Advance::Advance() 4 | { 5 | //ctor 6 | } 7 | 8 | Advance::~Advance() 9 | { 10 | //dtor 11 | } 12 | 13 | bool Advance::delete_advance(int id_advance) 14 | { 15 | QSqlQuery query; 16 | query.prepare("delete from advances where id_advance=:id_advance"); 17 | query.bindValue(0, id_advance); 18 | return query.exec(); 19 | } 20 | Advance::Advance(double amount,QString description ,QString add_date,int id_employee) 21 | { 22 | 23 | this->amount=amount; 24 | this->Description=description; 25 | this->add_date=add_date; 26 | this->id_employee=id_employee; 27 | 28 | } 29 | bool Advance:: add_advance() 30 | { 31 | QSqlQueryModel *model = new QSqlQueryModel(); 32 | 33 | QDate date = QDate::fromString(add_date,"dd/MM/yyyy"); 34 | model->setQuery("select * from advances where id_emp="+QString::number(id_employee)); 35 | for(int i=0;i< model->rowCount();i++) 36 | { QDate qdate; 37 | qdate= QDate::fromString(model->data(model->index(i,3)).toString(),"dd/MM/yyyy"); 38 | if(qdate.year()==date.year()&&qdate.month()==date.month()) 39 | {QMessageBox::critical(0,"Error!","This employee has alredy an advance this month",QMessageBox::Cancel); 40 | return false;} 41 | 42 | } 43 | model->setQuery("select base_salary from Employee where id_employee= "+QString::number(id_employee)); 44 | double salary = model->data(model->index(0,0)).toDouble() *0.2; 45 | 46 | 47 | if(amount < salary ) 48 | { 49 | QSqlQuery querry; 50 | querry.prepare("insert into advances (amount,description,date,id_emp) values(:amount,:description,:date,:id_emp)"); 51 | querry.bindValue(0,amount); 52 | querry.bindValue(1,Description); 53 | querry.bindValue(2,add_date); 54 | querry.bindValue(3,id_employee); 55 | return querry.exec(); 56 | } 57 | else QMessageBox::critical(0,"Error!","The advance must be less than 20% ("+QString::number(salary)+")of the base salary",QMessageBox::Cancel); 58 | return false; 59 | } 60 | QSqlQueryModel * Advance::advancelist() 61 | { 62 | QSqlQueryModel *model =new QSqlQueryModel(); 63 | 64 | model->setQuery("SELECT Employee.id_employee,Employee.name,Employee.last_name,advances.id_advance,advances.amount,advances.date,advances.description " 65 | " FROM Employee,advances" 66 | " WHERE Employee.id_employee=advances.id_emp"); 67 | return model; 68 | } 69 | 70 | QSqlQueryModel *Advance::searchadvance(int id) 71 | { 72 | 73 | 74 | QSqlQueryModel *model =new QSqlQueryModel(); 75 | QSqlQuery querry; 76 | QString str ="SELECT Employee.id_employee,Employee.name,Employee.last_name,advances.id_advance,advances.amount,advances.date,advances.description " 77 | " FROM Employee,advances" 78 | " WHERE Employee.id_employee=advances.id_emp and advances.id_emp=:id"; 79 | querry.prepare(str); 80 | querry.bindValue(0,id); 81 | querry.exec(); 82 | model->setQuery(querry); 83 | qDebug()< 4 | 5 | 6 | 7 | Event::Event(int ID_second_responsible, int ID_building, QString name, int state, QDate beginning_date, QDate ending_date, int nb_add_employees) 8 | { this->ID_event=0; 9 | this-> ID_second_responsible=ID_first_responsible; 10 | this-> ID_second_responsible=ID_second_responsible; 11 | this-> ID_second_responsible=ID_building; 12 | this-> name=name; 13 | this-> state=state; 14 | this-> beginning_date= beginning_date; 15 | this-> ending_date= ending_date; 16 | this-> nb_add_employees=nb_add_employees; 17 | 18 | 19 | } 20 | 21 | bool Event::Add_event() 22 | { 23 | inputcontrol p; 24 | ID_event=p.generate_bar_code("event"); 25 | QSqlQuery query; 26 | query.prepare( "INSERT INTO Event ( ID_event, ID_first_responsible, ID_second_responsible, ID_building,name, state, beginning_date,ending_date,nb_add_employees)" 27 | "VALUES (:ID_event, :ID_first_responsible, :ID_second_responsible, :ID_building, :name, :state, :beginning_date,:ending_date,:nb_add_employees)"); 28 | 29 | 30 | query.bindValue(0,ID_event); 31 | query.bindValue(1, ID_first_responsible); 32 | query.bindValue(2,ID_second_responsible); 33 | query.bindValue(3, ID_building); 34 | query.bindValue(4,name); 35 | query.bindValue(5,state); 36 | query.bindValue(6,beginning_date); 37 | query.bindValue(7,ending_date); 38 | query.bindValue(8,nb_add_employees); 39 | 40 | Add_add_employees_in_DB(); 41 | 42 | return query.exec(); 43 | } 44 | 45 | bool Event:: Add_add_employees_in_DB() 46 | { 47 | 48 | 49 | QSqlQuery query2; 50 | inputcontrol *p; 51 | bool res=false ; 52 | for(int i=0;isetQuery("select * from event"); 79 | model->setHeaderData(0, Qt::Horizontal, QObject::tr("ID of the event :")); 80 | model->setHeaderData(1, Qt::Horizontal, QObject::tr("Name :")); 81 | model->setHeaderData(2, Qt::Horizontal, QObject::tr("State :")); 82 | model->setHeaderData(3, Qt::Horizontal, QObject::tr("Beginning date:")); 83 | model->setHeaderData(4, Qt::Horizontal, QObject::tr("Ending date :")); 84 | model->setHeaderData(5, Qt::Horizontal, QObject::tr("Second responsible :")); 85 | 86 | return model; 87 | } 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | Event::Event() 106 | { 107 | 108 | } 109 | Event::~Event() 110 | { 111 | 112 | } 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /shift.h: -------------------------------------------------------------------------------- 1 | #ifndef SHIFT_H 2 | #define SHIFT_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | using namespace std ; 12 | 13 | class shift 14 | { 15 | public: 16 | /*---------------const/dest--------------*/ 17 | shift(); 18 | shift(QString type,QString day, QDate date ,int employee); 19 | shift(QString type,QString day,QDate date,QTime arrival_time,int employee,QString presence); 20 | ~shift(); 21 | /*---------------data input methods -----------*/ 22 | bool create_a_shift(int pos); 23 | bool edit_a_shift(int shift); 24 | bool archive_a_shift(int shift,QString mode); 25 | /*------------assigning methods--------*/ 26 | bool this_employee_has_been_moved(int employee); 27 | /*---------pimp methods ----------*/ 28 | bool this_employee_just_came_to_his_shift(int employee, QTime time); 29 | bool its_been_more_than_30_minutes_mark_all_employees_who_didnt_showup_absent(); 30 | /*-----------check methods --------*/ 31 | bool does_this_employee_have_a_shift_now(); 32 | QString did_this_employee_show_up_today(int employee); 33 | /*--------- count methods ---------*/ 34 | void count_places_left_for_this_week(QDate start_date,QDate end_date); 35 | /*------------ gets -----------------*/ 36 | 37 | /*----morning ----*/ 38 | int Get_places_left_monday_morning(){return places_left_monday_morning;} 39 | int Get_places_left_tuesday_morning(){return places_left_tuesday_morning;} 40 | int Get_places_left_wednsday_morning(){return places_left_wednsday_morning;} 41 | int Get_places_left_thursday_morning(){return places_left_thursday_morning;} 42 | int Get_places_left_friday_morning(){return places_left_friday_morning;} 43 | int Get_places_left_saturday_morning(){return places_left_saturday_morning;} 44 | int Get_places_left_sunday_morning(){return places_left_sunday_morning;} 45 | /*------ after noon ----*/ 46 | int Get_places_left_monday_after_noon(){return places_left_monday_after_noon;} 47 | int Get_places_left_tuesday_after_noon(){return places_left_tuesday_after_noon;} 48 | int Get_places_left_wednsday_after_noon(){return places_left_wednsday_after_noon;} 49 | int Get_places_left_thursday_after_noon(){return places_left_thursday_after_noon;} 50 | int Get_places_left_friday_after_noon(){return places_left_friday_after_noon;} 51 | int Get_places_left_saturday_after_noon(){return places_left_saturday_after_noon;} 52 | int Get_places_left_sunday__after_noon(){return places_left_sunday__after_noon;} 53 | 54 | 55 | private: 56 | int id_shift; 57 | QString type ; 58 | QString day ; 59 | QDate date ; 60 | QTime arrival_time ; 61 | int employee; 62 | QString presence ; 63 | /*---- counting containers ------*/ 64 | /*----morning ----*/ 65 | int places_left_monday_morning; 66 | int places_left_tuesday_morning; 67 | int places_left_wednsday_morning; 68 | int places_left_thursday_morning; 69 | int places_left_friday_morning; 70 | int places_left_saturday_morning; 71 | int places_left_sunday_morning; 72 | /*------ after noon ----*/ 73 | int places_left_monday_after_noon; 74 | int places_left_tuesday_after_noon; 75 | int places_left_wednsday_after_noon; 76 | int places_left_thursday_after_noon; 77 | int places_left_friday_after_noon; 78 | int places_left_saturday_after_noon; 79 | int places_left_sunday__after_noon; 80 | 81 | 82 | }; 83 | 84 | #endif // SHIFT_H 85 | -------------------------------------------------------------------------------- /Financial_balance.h: -------------------------------------------------------------------------------- 1 | #ifndef FINANCIAL_BALANCE_H 2 | #define FINANCIAL_BALANCE_ 3 | 4 | #include 5 | #include 6 | #include "session.h" 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "building.h" 13 | #include 14 | 15 | 16 | class Financial_balance 17 | { 18 | public: 19 | Financial_balance(double,double,double,double,double,double,double,double,double,double,double,double,QString,QString,int); 20 | Financial_balance(); 21 | ~Financial_balance(); 22 | int Getid_balance() { return id_balance; } 23 | void Setid_balance( int val) { id_balance = val; } 24 | 25 | double GetIntangible_Assets() { return Intangible_Assets; } 26 | void SetIntangible_Assets(double val) { Intangible_Assets = val; } 27 | 28 | double GetTangible_assets() { return Tangible_assets; } 29 | void SetTangible_assets(double val) { Tangible_assets = val; } 30 | 31 | double Getfinancial_assets() { return financial_assets; } 32 | void Setfinancial_assets(double val) { financial_assets = val; } 33 | 34 | double GetInventory_value() { return Inventory_value; } 35 | void SetInventory_value(double val) { Inventory_value = val; } 36 | 37 | double GetTrade_Receivable() { return Trade_Receivable; } 38 | void SetTrade_Receivable(double val) { Trade_Receivable = val; } 39 | 40 | double GetNon_operating_Debts() { return Non_operating_Depts; } 41 | void SetNon_operating_Debts(double val) { Non_operating_Depts = val; } 42 | 43 | double GetLiquidity() { return Liquidity; } 44 | void SetLiquidity(double val) { Liquidity = val; } 45 | 46 | double GetEquity() { return Equity; } 47 | void SetEquity(double val) { Equity = val; } 48 | 49 | double GetTrade_accounts() { return Trade_accounts; } 50 | void SetTrade_accounts(double val) { Trade_accounts = val; } 51 | 52 | double GetFinancial_Depts() { return Financial_Depts; } 53 | void SetFinancial_Depts(double val) { Financial_Depts = val; } 54 | 55 | int Getid_building() { return id_building; } 56 | void Setid_building(int val) { id_building = val; } 57 | 58 | double Getdepts() { return depts; } 59 | void Setdepts(double val) { depts = val; } 60 | 61 | QString Getyear() { return year; } 62 | void Setyear(QString val) { year = val; } 63 | 64 | QString Getmounth() { return mounth; } 65 | void Setmounth(QString val) { mounth = val; } 66 | 67 | double GetNon_operating_Credit() { return Non_operating_credits; } 68 | void SetNon_operating_Credits(double val) { Non_operating_credits= val; } 69 | 70 | bool add_finacial_balance(); 71 | void create_ratio(QString, QString, long ); 72 | void displaybalance(QString, QString, long ); 73 | //void print_financial_balance(); 74 | QStringList List; 75 | 76 | 77 | protected: 78 | private: 79 | int id_balance; 80 | double Intangible_Assets; 81 | double Tangible_assets; 82 | double financial_assets; 83 | double Inventory_value; 84 | double Trade_Receivable; 85 | double Non_operating_Depts; 86 | double Liquidity; 87 | double Equity; 88 | double Trade_accounts; 89 | double Financial_Depts; 90 | double Non_operating_credits; 91 | double depts ; 92 | 93 | QString mounth; 94 | QString year; 95 | int id_building; 96 | }; 97 | 98 | #endif // FINANCIAL_BALANCE_H 99 | -------------------------------------------------------------------------------- /uifinance.h: -------------------------------------------------------------------------------- 1 | #ifndef FINANCE_H 2 | #define FINANCE_H 3 | 4 | //#include "uimail.h" 5 | #include 6 | #include"Supplier.h" 7 | #include "Advance.h" 8 | #include "Charge.h" 9 | #include "Financial_balance.h" 10 | #include "statfinanace.h" 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "Payment_report.h" 16 | namespace Ui { 17 | class finance; 18 | } 19 | 20 | class finance : public QWidget 21 | { 22 | Q_OBJECT 23 | 24 | public: 25 | explicit finance(QWidget *parent = 0); 26 | ~finance(); 27 | 28 | private slots: 29 | QGraphicsScene *Statclef(vector); 30 | 31 | 32 | 33 | void on_PBaddSupplier_clicked(); 34 | 35 | void on_PBvaliderSupplier_clicked(); 36 | 37 | void on_PBclear_clicked(); 38 | 39 | 40 | 41 | void on_PBdisconnect_clicked(); 42 | 43 | void on_PBarchivesupplier_clicked(); 44 | 45 | void on_PBupdateSupplier_clicked(); 46 | 47 | 48 | void on_PBaddAdvance_clicked(); 49 | 50 | void on_supplier_list_clicked(const QModelIndex &index); 51 | 52 | void on_PBpdf_clicked(); 53 | 54 | void on_exportcsv_clicked(); 55 | 56 | void on_exportpdf_2_clicked(); 57 | 58 | void on_pbChoisir_clicked(); 59 | 60 | void on_PBaddcharge_clicked(); 61 | 62 | void on_pbrechercheavance_clicked(); 63 | 64 | void on_PBaddFB_clicked(); 65 | 66 | 67 | 68 | 69 | void on_LEsearchSupplier_cursorPositionChanged(); 70 | 71 | void on_PBsatat_clicked(); 72 | void on_LEname_cursorPositionChanged(); 73 | 74 | void on_LEdiscribe_cursorPositionChanged( ); 75 | 76 | void on_LEtel_cursorPositionChanged( ); 77 | 78 | void on_LEfax_cursorPositionChanged( ); 79 | 80 | void on_LEmail_cursorPositionChanged( ); 81 | 82 | void on_LEzip_cursorPositionChanged( ); 83 | 84 | void on_LEcity_cursorPositionChanged( ); 85 | 86 | void on_LEarea_cursorPositionChanged( ); 87 | 88 | void on_LEstreet_cursorPositionChanged( ); 89 | 90 | void on_LEname_edit_cursorPositionChanged( ); 91 | 92 | void on_LEdiscribe_edit_cursorPositionChanged( ); 93 | 94 | void on_LEtel_edit_cursorPositionChanged( ); 95 | 96 | void on_LEfax_edit_cursorPositionChanged( ); 97 | 98 | void on_LEmail_edit_cursorPositionChanged( ); 99 | 100 | void on_LEzip_edit_cursorPositionChanged( ); 101 | 102 | void on_LEcity_edit_cursorPositionChanged( ); 103 | 104 | void on_LEarea_edit_cursorPositionChanged( ); 105 | 106 | void on_LEstreet_edit_cursorPositionChanged( ); 107 | 108 | void on_s_clicked(); 109 | 110 | void on_LEadvancevalue_cursorPositionChanged( ); 111 | 112 | void on_PBcreerratio_clicked(); 113 | 114 | 115 | void on_PBpayslip_clicked(); 116 | 117 | void on_pbdisplaypay_clicked(); 118 | 119 | void on_pBmail_clicked(); 120 | 121 | void on_Print_clicked(); 122 | 123 | 124 | 125 | void on_advance_list_clicked(const QModelIndex &index); 126 | 127 | void on_pbdeleteadvance_clicked(); 128 | 129 | void on_LEsearchcharges_cursorPositionChanged(); 130 | 131 | void on_pbSearch_clicked(); 132 | 133 | void on_PBdisplayFB_clicked(); 134 | 135 | private: 136 | Ui::finance *ui; 137 | QString supplier_name; 138 | QString email; 139 | QString description; 140 | int tel; 141 | int fax; 142 | QDate add_date; 143 | int id_supplier; 144 | QString zip_code; 145 | QString street; 146 | QString area; 147 | QString city; 148 | void clear(); 149 | Supplier tempSupplier; 150 | employee tempemp; 151 | Advance tempadvance; 152 | Charge tempcharge; 153 | int id_advance; 154 | 155 | }; 156 | 157 | #endif // FINANCE_H 158 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/demos/demo2/sendemail.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | SmtpClient for Qt is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | SmtpClient for Qt is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY. 13 | 14 | See the LICENSE file for more details. 15 | */ 16 | 17 | #include "sendemail.h" 18 | #include "ui_sendemail.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | using namespace std; 27 | 28 | SendEmail::SendEmail(QWidget *parent) : 29 | QWidget(parent), 30 | ui(new Ui::SendEmail) 31 | { 32 | ui->setupUi(this); 33 | } 34 | 35 | SendEmail::~SendEmail() 36 | { 37 | delete ui; 38 | } 39 | 40 | EmailAddress* SendEmail::stringToEmail(const QString &str) 41 | { 42 | int p1 = str.indexOf("<"); 43 | int p2 = str.indexOf(">"); 44 | 45 | if (p1 == -1) 46 | { 47 | // no name, only email address 48 | return new EmailAddress(str); 49 | } 50 | else 51 | { 52 | return new EmailAddress(str.mid(p1 + 1, p2 - p1 - 1), str.left(p1)); 53 | } 54 | 55 | } 56 | 57 | void SendEmail::on_addAttachment_clicked() 58 | { 59 | QFileDialog dialog(this); 60 | dialog.setFileMode(QFileDialog::ExistingFiles); 61 | 62 | 63 | if (dialog.exec()) 64 | ui->attachments->addItems(dialog.selectedFiles()); 65 | 66 | 67 | } 68 | 69 | void SendEmail::on_sendEmail_clicked() 70 | { 71 | QString host = ui->host->text(); 72 | int port = ui->port->value(); 73 | bool ssl = ui->ssl->isChecked(); 74 | bool auth = ui->auth->isChecked(); 75 | QString user = ui->username->text(); 76 | QString password = ui->password->text(); 77 | 78 | EmailAddress *sender = stringToEmail(ui->sender->text()); 79 | 80 | QStringList rcptStringList = ui->recipients->text().split(';'); 81 | 82 | QString subject = ui->subject->text(); 83 | QString html = ui->texteditor->toHtml(); 84 | 85 | SmtpClient smtp (host, port, ssl ? SmtpClient::SslConnection : SmtpClient::TcpConnection); 86 | 87 | MimeMessage message; 88 | 89 | message.setSender(sender); 90 | message.setSubject(subject); 91 | 92 | for (int i = 0; i < rcptStringList.size(); ++i) 93 | message.addRecipient(stringToEmail(rcptStringList.at(i))); 94 | 95 | MimeHtml content; 96 | content.setHtml(html); 97 | 98 | message.addPart(&content); 99 | 100 | for (int i = 0; i < ui->attachments->count(); ++i) 101 | { 102 | message.addPart(new MimeAttachment(new QFile(ui->attachments->item(i)->text()))); 103 | } 104 | 105 | if (!smtp.connectToHost()) 106 | { 107 | errorMessage("Connection Failed"); 108 | return; 109 | } 110 | 111 | if (auth) 112 | if (!smtp.login(user, password)) 113 | { 114 | errorMessage("Authentification Failed"); 115 | return; 116 | } 117 | 118 | if (!smtp.sendMail(message)) 119 | { 120 | errorMessage("Mail sending failed"); 121 | return; 122 | } 123 | else 124 | { 125 | QMessageBox okMessage (this); 126 | okMessage.setText("The email was succesfully sent."); 127 | okMessage.exec(); 128 | } 129 | 130 | smtp.quit(); 131 | 132 | } 133 | 134 | void SendEmail::errorMessage(const QString &message) 135 | { 136 | QErrorMessage err (this); 137 | 138 | err.showMessage(message); 139 | 140 | err.exec(); 141 | } 142 | -------------------------------------------------------------------------------- /menu_inventory.h: -------------------------------------------------------------------------------- 1 | #ifndef MENU_INVENTORY_H 2 | #define MENU_INVENTORY_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "product.h" 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include "truck.h" 14 | #include "import_order.h" 15 | #include "refill_order.h" 16 | 17 | 18 | 19 | namespace Ui { 20 | class Menu_Inventory; 21 | } 22 | 23 | class Menu_Inventory : public QWidget 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | void size_follower(QString); 29 | 30 | void size_follower_modify(QString); 31 | 32 | explicit Menu_Inventory(QWidget *parent = 0); 33 | ~Menu_Inventory(); 34 | 35 | private slots: 36 | void on_pushButton_3_clicked(); 37 | 38 | void on_Disconnect_clicked(); 39 | 40 | void on_comboBox_Category_currentTextChanged(const QString &arg1); 41 | 42 | void on_pushButton_Add_product_released(); 43 | 44 | void on_pushButton_Search_Display_released(); 45 | 46 | void on_LoadM_clicked(); 47 | 48 | void on_Pushbutton_Modify_Delete_clicked(); 49 | 50 | void on_pb_pdf_clicked(); 51 | 52 | void on_pushButton_Delete_Product_in_Modify_clicked(); 53 | 54 | void on_pushButton_Add_Truck_released(); 55 | 56 | void on_comboBox_Modify_Category_currentIndexChanged(const QString &arg1); 57 | 58 | void on_pushButton_Truck_Display_clicked(); 59 | 60 | void on_pushButton_Load_Truck_Modify_clicked(); 61 | 62 | void on_pushButton_Truck_Delete_clicked(); 63 | 64 | void on_pushButton_Add_Refill_Submit_clicked(); 65 | 66 | void on_pushButton_Search_Refill_Order_Display_2_clicked(); 67 | 68 | void on_pushButton_Load_Refill_Modify_clicked(); 69 | 70 | void on_pushButton_Refill_Order_Modify_Delete_clicked(); 71 | 72 | void on_pushButton_Load_Delivery_Details_clicked(); 73 | 74 | void on_pushButton_Modify_Product_Confirm_clicked(); 75 | 76 | void on_pushButton_Modify_Truck_Submit_clicked(); 77 | 78 | void on_pushButton_Email_clicked(); 79 | 80 | void on_tabWidget_3_destroyed(); 81 | 82 | void on_pushButton_Modify_Refill_Show_clicked(); 83 | 84 | void on_pushButton_Modify_Refill_Submit_clicked(); 85 | 86 | void on_pushButton_Add_Import_Submit_clicked(); 87 | 88 | void on_pushButton_Load_Product_List_clicked(); 89 | 90 | void on_pushButton_Show_Truck_clicked(); 91 | 92 | void on_pushButton_export_Excel_clicked(); 93 | 94 | 95 | void on_pushButton_clicked(); 96 | 97 | 98 | 99 | private: 100 | QSqlDatabase db; 101 | Ui::Menu_Inventory *ui; 102 | 103 | 104 | //attribus Refill 105 | int id_refill; 106 | QDate date; 107 | QString state; 108 | QString type_o; 109 | QDate ETA; 110 | int id_building; 111 | 112 | //attribus Import 113 | int id_order; 114 | int quantity_i; 115 | int id_product_i; 116 | 117 | //attribus produits 118 | Product tempProduct; 119 | Truck tempTruck; 120 | Refill_Order tempRefill; 121 | Import_order tempImport; 122 | int id_product; 123 | QDate added_date; 124 | int quantity; 125 | QString color; 126 | QString size; 127 | QString name; 128 | QString type_of_fabric; 129 | QString gender; 130 | QString category; 131 | float weight; 132 | float initial_price; 133 | int nb_point; 134 | float production_price; 135 | 136 | //attribus Trucks 137 | 138 | int id_truck; 139 | QString type; 140 | int city_state_nb; 141 | QString sizeT; 142 | QString power; 143 | float max_weight; 144 | float initial_weight; 145 | float price; 146 | QString contract; 147 | QString availability; 148 | QString reason; 149 | int serial_num; 150 | 151 | }; 152 | 153 | #endif // MENU_INVENTORY_H 154 | -------------------------------------------------------------------------------- /promotionnal.cpp: -------------------------------------------------------------------------------- 1 | #include "promotionnal.h" 2 | #include "event.h" 3 | 4 | 5 | Promotionnal::~Promotionnal() 6 | { 7 | //ctor// 8 | } 9 | Promotionnal::Promotionnal() 10 | { 11 | 12 | } 13 | Promotionnal::Promotionnal(QString type, QString description, float budget, QString name, int state, QDate beginning_date, QDate ending_date, int ID_second_responsible, int nb_add_employees ,int ID_building):Event(ID_second_responsible ,ID_building ,name,state,beginning_date,ending_date,nb_add_employees) 14 | { 15 | this-> type=type; 16 | this-> description=description; 17 | this->budget=budget; 18 | 19 | 20 | } 21 | 22 | 23 | bool Promotionnal:: Add_prom() 24 | { 25 | QSqlQuery query; 26 | query.prepare("INSERT INTO Promotionnal(ID_promotionnal,type,description,remaining_budget,budget) VALUES (:ID_promotionnal, :type,:description,:remaining_budget, :budget)"); 27 | Add_event(); 28 | query.bindValue(0,ID_event); 29 | query.bindValue(1,type); 30 | query.bindValue(2,description); 31 | query.bindValue(3,remaining_budget); 32 | query.bindValue(4,budget); 33 | 34 | Add_extra_buying_in_DB(); 35 | qDebug("Promotionnal event added with success!"); 36 | return query.exec(); 37 | } 38 | 39 | 40 | 41 | 42 | 43 | 44 | bool Promotionnal:: Add_extra_buying_in_DB() 45 | { 46 | QSqlQuery query2; 47 | inputcontrol *p; 48 | bool res; 49 | for(int i=0;iprepare("select *from Event inner join Promotionnal on Event.ID_event=Promotionnal.ID_event "); 78 | qDebug()<lastError(); 79 | query->exec(); 80 | model->setQuery(*query); 81 | 82 | return model; 83 | } 84 | 85 | 86 | /*bool Promotionnal:: Add_prom() 87 | { 88 | QSqlQuery query; 89 | //query.prepare("INSERT INTO Promotionnal(ID_promotionnal,type,description,if_extra_buyings,/*extra_buyings,*///budget) VALUES (:ID_promotionnal, :type,:description,:if_extra_buyings,/*:extra_buyings,*/ :budget)"); 90 | // Add_event(); 91 | //query.bindValue(0,Get_ID_event()); 92 | //query.bindValue(1,type); 93 | //query.bindValue(2,description); 94 | //query.bindValue(3,if_extra_buyings); 95 | /* query.bindValue(4,extra_byings);*/ 96 | // query.bindValue(5, budget); 97 | 98 | // qDebug("Promotionnal event added with success!"); 99 | 100 | //return query.exec(); 101 | //} 102 | 103 | //QSqlQueryModel * Promotionnal::Display_prom() 104 | //{ 105 | // QSqlQueryModel * model= new QSqlQueryModel(); 106 | 107 | // model->setQuery("select * from Promotionnal"); 108 | //model->setHeaderData(0, Qt::Horizontal, QObject::tr("Type:")); 109 | // model->setHeaderData(1, Qt::Horizontal, QObject::tr("Description :")); 110 | // model->setHeaderData(2, Qt::Horizontal, QObject::tr("if_extra_buyings :")); 111 | // model->setHeaderData(3, Qt::Horizontal, QObject::tr("Budget:")); 112 | // return model; 113 | //} 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /Hamadi.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2015-09-15T13:29:29 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | QT += sql 9 | QT += widgets 10 | QT += core 11 | QT +=network 12 | QT += core gui xml printsupport 13 | QT +=webkitwidgets 14 | 15 | 16 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 17 | 18 | TARGET = Hamadi 19 | TEMPLATE = app 20 | 21 | INCLUDEPATH += $$PWD 22 | SOURCES += main.cpp\ 23 | mytimer.cpp \ 24 | session.cpp \ 25 | inputcontrol.cpp \ 26 | employee.cpp \ 27 | manager.cpp \ 28 | vacation.cpp \ 29 | driver.cpp \ 30 | product.cpp \ 31 | building.cpp \ 32 | truck.cpp \ 33 | repairs.cpp \ 34 | event.cpp \ 35 | discount.cpp \ 36 | import.cpp \ 37 | refill.cpp \ 38 | order.cpp \ 39 | sale.cpp \ 40 | client.cpp \ 41 | promotion.cpp \ 42 | shift.cpp \ 43 | raises.cpp \ 44 | uigestionrh.cpp \ 45 | uimainframe.cpp \ 46 | uioptions.cpp \ 47 | uiquicklog.cpp \ 48 | uipassword.cpp \ 49 | piechartwidget.cpp \ 50 | bargraphwidget.cpp \ 51 | agepyramidwidget.cpp \ 52 | slicepiewidget.cpp \ 53 | mouvement.cpp \ 54 | uisales.cpp \ 55 | customer.cpp \ 56 | corporate.cpp \ 57 | uicrm.cpp \ 58 | smtp.cpp \ 59 | delivery.cpp \ 60 | menu_inventory.cpp \ 61 | import_order.cpp \ 62 | refill_order.cpp \ 63 | Advance.cpp \ 64 | Charge.cpp \ 65 | Financial_balance.cpp \ 66 | Payment_report.cpp \ 67 | statfinanace.cpp \ 68 | Supplier.cpp \ 69 | uifinance.cpp \ 70 | gmail_smtp.cpp \ 71 | statistique.cpp \ 72 | productstat.cpp \ 73 | discount_event.cpp \ 74 | promotionnal.cpp \ 75 | stats.cpp 76 | 77 | HEADERS += \ 78 | mytimer.h \ 79 | session.h \ 80 | inputcontrol.h \ 81 | employee.h \ 82 | manager.h \ 83 | vacation.h \ 84 | driver.h \ 85 | product.h \ 86 | building.h \ 87 | truck.h \ 88 | repairs.h \ 89 | event.h \ 90 | discount.h \ 91 | import.h \ 92 | refill.h \ 93 | order.h \ 94 | sale.h \ 95 | client.h \ 96 | promotion.h \ 97 | shift.h \ 98 | raises.h \ 99 | uigestionrh.h \ 100 | ui_mainframe.h \ 101 | uioptions.h \ 102 | uiquicklog.h \ 103 | uipassword.h \ 104 | piechartwidget.h \ 105 | bargraphwidget.h \ 106 | agepyramidwidget.h \ 107 | slicepiewidget.h \ 108 | mouvement.h \ 109 | uisales.h \ 110 | customer.h \ 111 | corporate.h \ 112 | uicrm.h \ 113 | delivery.h \ 114 | smtp.h \ 115 | menu_inventory.h \ 116 | import_order.h \ 117 | refill_order.h \ 118 | Advance.h \ 119 | Charge.h \ 120 | Financial_balance.h \ 121 | Payment_report.h \ 122 | statfinanace.h \ 123 | Supplier.h \ 124 | uifinance.h \ 125 | gmail_smtp.h \ 126 | statistique.h \ 127 | SmtpClient-for-Qt-1.1/src/mimetext.h \ 128 | SmtpClient-for-Qt-1.1/src/smtpclient.h \ 129 | productstat.h \ 130 | discount_event.h \ 131 | promotionnal.h \ 132 | stats.h 133 | 134 | FORMS += \ 135 | uigestionrh.ui \ 136 | uimainframe.ui \ 137 | uiquicklog.ui \ 138 | uipassword.ui \ 139 | uioptions.ui \ 140 | uisales.ui \ 141 | uicrm.ui \ 142 | menu_inventory.ui \ 143 | finance.ui 144 | 145 | win32:CONFIG(release, debug|release): LIBS += -L$$PWD/build-SMTPEmail-Desktop_Qt_5_5_1_MinGW_32bit-Debug/debug/ -lSMTPEmail 146 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/build-SMTPEmail-Desktop_Qt_5_5_1_MinGW_32bit-Debug/debug/ -lSMTPEmail 147 | 148 | #INCLUDEPATH += $$PWD/build-SMTPEmail-Desktop_Qt_5_5_1_MinGW_32bit-Debug/debug 149 | INCLUDEPATH += $$PWD/SmtpClient-for-Qt-1.1/src 150 | DEPENDPATH += $$PWD/build-SMTPEmail-Desktop_Qt_5_5_1_MinGW_32bit-Debug/debug 151 | 152 | -------------------------------------------------------------------------------- /Charge.cpp: -------------------------------------------------------------------------------- 1 | #include "Charge.h" 2 | 3 | Charge::Charge() 4 | { 5 | //ctor 6 | } 7 | 8 | Charge::~Charge() 9 | { 10 | //dtor 11 | } 12 | 13 | Charge::Charge(QString Description, QString Type, int ID_building, double amount,QString date ) 14 | { 15 | this->Description=Description; 16 | this->Type= Type; 17 | this->ID_building=ID_building; 18 | this->amount=amount; 19 | this->date=date; 20 | } 21 | 22 | bool Charge::create_charge() 23 | { 24 | 25 | QSqlQuery querry; 26 | querry.prepare("insert into charges(type, description, amount, id_building, date)" 27 | "values (:type,:description,:amount,:id_building,:date) ") ; 28 | querry.bindValue(0,Type); 29 | querry.bindValue(1,Description); 30 | querry.bindValue(2,amount); 31 | querry.bindValue(3,ID_building); 32 | querry.bindValue(4,date); 33 | 34 | return querry.exec(); 35 | } 36 | 37 | QSqlQueryModel * Charge::displayid() 38 | { 39 | 40 | QSqlQueryModel *model =new QSqlQueryModel(); 41 | model->setQuery("SELECT id_building from building"); 42 | return model; 43 | } 44 | 45 | 46 | void Charge::set_id() 47 | { 48 | tab_id.clear(); 49 | tab_nom.clear(); 50 | QSqlQueryModel * model =new QSqlQueryModel(); 51 | 52 | QString str = "Select charges.id_building , building.name from charges,building where charges.id_building=building.id_building "; 53 | 54 | set tab; 55 | set ::iterator it; 56 | set tab1; 57 | set ::iterator ite; 58 | model->setQuery(str); 59 | for (int i = 0; i < model->rowCount(); ++i) 60 | { 61 | tab.insert(model->data(model->index(i,0)).toInt()); 62 | tab1.insert(model->data(model->index(i,1)).toString()); 63 | 64 | } 65 | for(it=tab.begin();it!=tab.end();it++) 66 | { 67 | tab_id.push_back(*it); 68 | } 69 | 70 | for(ite=tab1.begin();ite!=tab1.end();ite++) 71 | { 72 | tab_nom.push_back(*ite); 73 | qDebug()<<*ite; 74 | } 75 | //qDebug()<::iterator id; 85 | // vector::iterator amount; 86 | 87 | QSqlQueryModel * model1 =new QSqlQueryModel(); 88 | 89 | QSqlQuery querry; 90 | for(id=tab_id.begin();id!=tab_id.end();id++) 91 | { 92 | QString str = "Select amount from charges where id_building=:id"; 93 | 94 | querry.prepare(str); 95 | querry.bindValue(0,*id); 96 | querry.exec(); 97 | model1->setQuery(querry); 98 | qDebug()<rowCount(); ++i) 100 | { 101 | aux += model1->data(model1->index(i,0)).toDouble(); 102 | 103 | } 104 | tab_amount.push_back(aux); 105 | 106 | qDebug()<setQuery(str); 121 | return model; 122 | } 123 | 124 | QSqlQueryModel *Charge::displaychargesbyname(QString value) 125 | { 126 | QSqlQueryModel *model= new QSqlQueryModel(); 127 | value=value+"%"; 128 | QString str ="Select charges.id_charges,charges.type,charges.amount,charges.date ,building.type,building.name" 129 | " from charges,building where" 130 | " building.id_building = charges.id_building" 131 | " and building.name like '"+value+"'"; 132 | qDebug()<setQuery(str); 134 | return model; 135 | 136 | } 137 | 138 | -------------------------------------------------------------------------------- /manager.cpp: -------------------------------------------------------------------------------- 1 | #include "manager.h" 2 | 3 | manager::manager() 4 | { 5 | 6 | } 7 | 8 | manager::manager(QString pwd, QString type, QString email) 9 | { 10 | this->pwd=pwd; 11 | this->type=type; 12 | this->email=email; 13 | } 14 | void manager::select_manager(int id) 15 | { 16 | QSqlQueryModel* model =new QSqlQueryModel(); 17 | 18 | QSqlQuery *query= new QSqlQuery(); 19 | query->prepare("select * from manager where id_manager = :id_manager"); 20 | query->bindValue(":id_manager",id); 21 | qDebug()<<"selecting manager from data base ... result :"<lastError(); 22 | query->exec(); 23 | model->setQuery(*query); 24 | 25 | 26 | id_employee=model->record(0).value("id_manager").toInt(); 27 | pwd=model->record(0).value("password").toString(); 28 | type=model->record(0).value("type").toString(); 29 | email=model->record(0).value("email").toString(); 30 | 31 | } 32 | manager::manager(QString pwd,QString type,QString email,QString name,QString family_name, QDate birthdate, QString social_state, long int social_sn,QString zip_code,QString street,QString area , QString city,int phone_number,int Cin ,double salary,QString post , QString gender ,bool activity ,QString contract_type ,QString paiment_type , int interveiwer , QString c_v ,QString m_l,QString photo,int building):employee(name,family_name,birthdate,social_state,social_sn,zip_code,street,area,city, phone_number,Cin,salary,post ,gender ,activity ,contract_type ,paiment_type ,interveiwer,c_v,m_l, photo,building) 33 | { 34 | this->pwd=pwd; 35 | this->type=type; 36 | this->email=email; 37 | } 38 | 39 | manager::manager(QString type, QString email, QString name, QString family_name, QDate birthdate, QString social_state, long social_sn, QString zip_code, QString street, QString area, QString city, int phone_number, int Cin, double salary, QString post, QString gender, bool activity, QString contract_type, QString paiment_type, int interveiwer, QString c_v, QString m_l, QString photo, int building):employee(name,family_name,birthdate,social_state,social_sn,zip_code,street,area,city, phone_number,Cin,salary,post ,gender ,activity ,contract_type ,paiment_type ,interveiwer,c_v,m_l, photo,building) 40 | { 41 | this->pwd=""; 42 | this->type=type; 43 | this->email=email; 44 | } 45 | bool manager::add_manager() 46 | { 47 | QSqlQuery *query=new QSqlQuery(); 48 | query->prepare("INSERT INTO manager (id_manager,password,type,email) VALUES (:id_manager,:password,:type,:email)"); 49 | add_employee(); 50 | query->bindValue(0,id_employee); 51 | query->bindValue(1,pwd); 52 | query->bindValue(2,type); 53 | query->bindValue(3,email); 54 | qDebug()<lastError(); 55 | return query->exec(); 56 | } 57 | 58 | bool manager::modify_manager(int id) 59 | { 60 | QSqlQuery *query=new QSqlQuery(); 61 | query->prepare("update manager set type=:type,email=:email where id_manager=:id_manager "); 62 | modify_employee(id); 63 | query->bindValue(":id_manager",id); 64 | query->bindValue(":type",type); 65 | query->bindValue(":email",email); 66 | qDebug()<<" updating manager ... result :"<lastError(); 67 | modify_employee(id); 68 | return query->exec(); 69 | } 70 | bool manager::this_employee_became_a_manager(int employee) 71 | { 72 | QSqlQuery *query= new QSqlQuery(); 73 | query->prepare("insert into manager (id_manager,password,type,email)VALUES (:id_manager,:password,:type,:email)"); 74 | query->bindValue(0,employee); 75 | query->bindValue(1,pwd); 76 | query->bindValue(2,type); 77 | query->bindValue(3,email); 78 | qDebug()<<" transforming emlpoyee into a manager... result :"<lastError(); 79 | return query->exec(); 80 | 81 | } 82 | bool manager::delete_manager(int id) 83 | { 84 | QSqlQuery *query= new QSqlQuery(); 85 | query->prepare("delete from manager where id_manager=:id_manager"); 86 | query->bindValue(":id_manager",id); 87 | qDebug()<<"deleting manager ... result :"<lastError(); 88 | return query->exec(); 89 | 90 | } 91 | 92 | -------------------------------------------------------------------------------- /uisales.h: -------------------------------------------------------------------------------- 1 | #ifndef UISALES_H 2 | #define UISALES_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "employee.h" 19 | #include "product.h" 20 | #include "customer.h" 21 | #include "sale.h" 22 | #include"Order.h" 23 | #include"bargraphwidget.h" 24 | #include"session.h" 25 | #include"uipassword.h" 26 | #include"inputcontrol.h" 27 | #include 28 | #include 29 | 30 | 31 | namespace Ui { 32 | class uisales; 33 | } 34 | 35 | class uisales : public QWidget 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | explicit uisales(QWidget *parent = 0); 41 | ~uisales(); 42 | bool check_existence(QString id); 43 | void increment_quantity(int pos); 44 | bool check_existence(QString id, QString object_name); 45 | void increment_quantity(int pos, QString object_name); 46 | void insert_table_items (); 47 | void set_session(int id,QString pwd); 48 | 49 | private slots: 50 | void on_id_seller_com_currentTextChanged(const QString &arg1); 51 | void on_id_product_com_currentTextChanged(const QString &arg1); 52 | void on_id_client_com_currentTextChanged(const QString &arg1); 53 | void on_create_sale_line_clicked(); 54 | void on_seller_enable_toggled(bool checked); 55 | void on_client_enable_toggled(bool checked); 56 | void on_finish_sale_clicked(); 57 | void on_cancel_sale_line_clicked(); 58 | void on_create_sale_line_2_clicked(); 59 | void on_delete_sale_QPB_clicked(); 60 | void on_display_histogram_clicked(); 61 | void on_create_order_line_clicked(); 62 | void on_id_product_com_oder_currentTextChanged(const QString &arg1); 63 | void on_id_client_com_order_currentTextChanged(const QString &arg1); 64 | void on_cancel_order_line_clicked(); 65 | void on_submit_order_clicked(); 66 | void on_QPB_display_order_clicked(); 67 | void on_delete_sale_QPB_2_clicked(); 68 | void on_create_sale_line_3_clicked(); 69 | void on_create_sale_line_6_clicked(); 70 | void on_create_sale_line_5_clicked(); 71 | void on_display_histogram_2_clicked(); 72 | void on_create_sale_line_4_clicked(); 73 | void on_create_sale_line_7_clicked(); 74 | void on_create_sale_line_9_clicked(); 75 | void on_create_sale_line_8_clicked(); 76 | 77 | void on_modify_order_line_clicked(); 78 | 79 | 80 | 81 | void on_Disconnect_clicked(); 82 | 83 | void on_Change_Password_clicked(); 84 | 85 | void on_send_email_clicked(); 86 | 87 | void on_Export_to_excel_2_clicked(); 88 | 89 | void on_send_email_2_clicked(); 90 | 91 | void on_Export_to_excel_clicked(); 92 | 93 | private: 94 | Ui::uisales *ui; 95 | employee *e; 96 | Product *p; 97 | Customer *c; 98 | sale *s; 99 | Order *o; 100 | inputcontrol i; 101 | password *pwd ; 102 | QString pass; 103 | int ide; 104 | int total_product_points_number; 105 | int row_order; 106 | int old_qt; 107 | int choice; 108 | double total_price; 109 | double net_price; 110 | int id_employee; 111 | int id_client; 112 | int id_order; 113 | int id_export_line; 114 | sale tempsale; 115 | Order tempOrder; 116 | QDate date; 117 | int quantityy; 118 | /*------- order infos ------*/ 119 | int order_total_product_points_number; 120 | int order_row_order; 121 | int order_old_qt; 122 | int order_choice; 123 | double order_total_price; 124 | double order_net_price; 125 | int order_id_employee; 126 | int order_id_client; 127 | 128 | }; 129 | 130 | #endif // UISALES_H 131 | -------------------------------------------------------------------------------- /driver.cpp: -------------------------------------------------------------------------------- 1 | #include "driver.h" 2 | 3 | driver::driver(int lisence, bool big_trucks, bool small_trucks, QDate expiration_date, QString name, QString family_name, QDate birthdate, QString social_state, long social_sn, QString zip_code, QString street, QString area, QString city, int phone_number, int Cin, double salary, QString post, QString gender, bool activity, QString contract_type, QString paiment_type, int interveiwer, QString c_v, QString m_l, QString photo, int building):employee(name,family_name,birthdate,social_state,social_sn,zip_code,street,area,city, phone_number,Cin,salary,post ,gender ,activity ,contract_type ,paiment_type ,interveiwer,c_v,m_l, photo,building) 4 | {this->lisence=lisence; 5 | this->big_trucks=big_trucks; 6 | this->small_trucks=small_trucks; 7 | this->expiration_date=expiration_date; 8 | } 9 | driver::driver() 10 | { 11 | this->lisence=0; 12 | this->big_trucks=false; 13 | this->small_trucks=false; 14 | this->expiration_date=QDate::currentDate(); 15 | } 16 | 17 | driver::driver(int lisence, bool big_trucks, bool small_trucks, QDate expiration_date) 18 | { 19 | this->lisence=lisence; 20 | this->big_trucks=big_trucks; 21 | this->small_trucks=small_trucks; 22 | this->expiration_date=expiration_date; 23 | } 24 | driver::~driver() 25 | { 26 | 27 | } 28 | 29 | bool driver::add_driver() 30 | { 31 | QSqlQuery query; 32 | query.prepare("INSERT INTO driver (id_driver,lisence,big_trucks,small_trucks,expiration_date) VALUES (:id_driver,:lisence,:big_trucks,:small_trucks,:expiration_date)"); 33 | add_employee(); 34 | query.bindValue(0,id_employee); 35 | query.bindValue(1,lisence); 36 | query.bindValue(2,big_trucks); 37 | query.bindValue(3,small_trucks); 38 | query.bindValue(4,expiration_date); 39 | qDebug()<<"adding driving into data base... result :"<prepare("select * from driver where id_driver = :id_driver"); 48 | query->bindValue(":id_driver",id); 49 | qDebug()<<"selecting driver from data base "<lastError(); 50 | query->exec(); 51 | model->setQuery(*query); 52 | 53 | 54 | id_employee=model->record(0).value("id_driver").toInt(); 55 | lisence=model->record(0).value("lisence").toInt(); 56 | big_trucks=model->record(0).value("big_trucks").toBool(); 57 | small_trucks=model->record(0).value("small_trucks").toBool(); 58 | expiration_date=model->record(0).value("expiration_date").toDate(); 59 | 60 | 61 | 62 | } 63 | bool driver::modify_driver(int id) 64 | { 65 | QSqlQuery *query=new QSqlQuery(); 66 | query->prepare("update driver set lisence=:lisence,big_trucks=:big_trucks,small_trucks=:small_trucks,expiration_date=:expiration_date where id_driver=:id_driver"); 67 | add_employee(); 68 | query->bindValue(":id_driver",id); 69 | query->bindValue(":lisence",lisence); 70 | query->bindValue(":big_trucks",big_trucks); 71 | query->bindValue(":small_trucks",small_trucks); 72 | query->bindValue(":expiration_date",expiration_date); 73 | qDebug()<<"adding driving into data base... result :"<lastError(); 74 | return query->exec(); 75 | } 76 | 77 | bool driver::delete_driver(int id) 78 | { 79 | QSqlQuery *query=new QSqlQuery(); 80 | query->prepare("delete from driver where id_driver=:id_driver"); 81 | query->bindValue(":id_driver",id); 82 | qDebug()<<"delete driver ... result: "<< query->lastError(); 83 | return query->exec(); 84 | 85 | } 86 | 87 | bool driver::this_employee_became_a_driver(int employee) 88 | { 89 | QSqlQuery *query=new QSqlQuery(); 90 | query->prepare("INSERT INTO driver (id_driver,lisence,big_trucks,small_trucks,expiration_date) VALUES (:id_driver,:lisence,:big_trucks,:small_trucks,:expiration_date)"); 91 | query->bindValue(0,employee); 92 | query->bindValue(1,lisence); 93 | query->bindValue(2,big_trucks); 94 | query->bindValue(3,small_trucks); 95 | query->bindValue(4,expiration_date); 96 | qDebug()<lastError(); 97 | return query->exec(); 98 | } 99 | -------------------------------------------------------------------------------- /refill_order.cpp: -------------------------------------------------------------------------------- 1 | #include "refill_order.h" 2 | #include 3 | #include "inputcontrol.h" 4 | #include 5 | #include 6 | #include 7 | 8 | Refill_Order::Refill_Order() 9 | { 10 | 11 | } 12 | 13 | Refill_Order::Refill_Order(QDate date, QString state, QString type, QDate ETA, int id_building) 14 | { 15 | //this-> id_refill=id_refill; 16 | this-> date=date; 17 | this-> state =state; 18 | this-> type=type; 19 | this-> ETA=ETA; 20 | this-> id_building=id_building; 21 | } 22 | 23 | 24 | 25 | bool Refill_Order::add () 26 | { 27 | QSqlQuery query; 28 | query.prepare("insert into refill_order (id_refill_line,date,state,type,eta,inventory) " 29 | "values(:id_refill_line,:date,:state,:type,:eta,:inventory) "); 30 | inputcontrol p; 31 | id_refill= p.generate_bar_code("product"); 32 | query.bindValue(0,id_refill); 33 | query.bindValue(1,date); 34 | query.bindValue(2,state); 35 | query.bindValue(3,type); 36 | query.bindValue(4,ETA); 37 | query.bindValue(5,id_building); 38 | return query.exec(); 39 | } 40 | 41 | 42 | 43 | QSqlQueryModel *Refill_Order::display_Refill() 44 | { 45 | QSqlQueryModel * model= new QSqlQueryModel(); 46 | 47 | model->setQuery("select * from refill_order"); 48 | return model; 49 | } 50 | 51 | 52 | QSqlQueryModel *Refill_Order::search_Refill(QString value) 53 | { 54 | QSqlQueryModel * model = new QSqlQueryModel(); 55 | if (value == "") 56 | { 57 | return display_Refill(); 58 | } 59 | else 60 | { 61 | 62 | 63 | QString str = "select * from refill_order where id_refill_line like '%" + value + "%'"; 64 | model->setQuery(str); 65 | 66 | model->setHeaderData(0,Qt::Horizontal,QObject::tr("refill_line")); 67 | model->setHeaderData(1,Qt::Horizontal,QObject::tr("date")); 68 | model->setHeaderData(2,Qt::Horizontal,QObject::tr("state")); 69 | model->setHeaderData(3,Qt::Horizontal,QObject::tr("type")); 70 | model->setHeaderData(4,Qt::Horizontal,QObject::tr("eta")); 71 | model->setHeaderData(5,Qt::Horizontal,QObject::tr("inventory")); 72 | 73 | } 74 | return model; 75 | } 76 | 77 | 78 | 79 | bool Refill_Order::archive(int x) 80 | { 81 | 82 | QSqlQuery query; 83 | query.prepare("delete from refill_order where id_refill_line =?"); 84 | query.bindValue(0,x); 85 | query.exec(); 86 | 87 | /*QSqlQuery query; 88 | QString str="delete from refill_line where id_refill_line ="+QString::number(x); 89 | qDebug()<variables_number=variables_number; 13 | this->red=red; 14 | this->blue=blue; 15 | this->green=green; 16 | this->yellow=yellow; 17 | this->black=black; 18 | 19 | 20 | } 21 | void PieChartWidget::insert_values(int variables_number,double red, double blue, double green, double yellow) 22 | {this->variables_number=variables_number; 23 | this->red=red; 24 | this->blue=blue; 25 | this->green=green; 26 | this->yellow=yellow; 27 | this->black=0; 28 | } 29 | void PieChartWidget::insert_values(int variables_number,double red,double blue,double green) 30 | { 31 | this->variables_number=variables_number; 32 | this->red=red; 33 | this->blue=blue; 34 | this->green=green; 35 | this->yellow=0; 36 | this->black=0; 37 | } 38 | void PieChartWidget::insert_values(int variables_number,double red,double blue) 39 | { 40 | this->variables_number=variables_number; 41 | this->red=red; 42 | this->blue=blue; 43 | this->green=0; 44 | 45 | } 46 | void PieChartWidget::paintEvent(QPaintEvent * ) 47 | { 48 | if(variables_number==2) 49 | { 50 | 51 | double a = red+blue; 52 | double p1 = ((((red*100)/a)*360)/100)*16; 53 | double p2 = ((((blue*100)/a)*360)/100)*16; 54 | QPainter painter(this); 55 | 56 | QRectF size = QRectF(10,10,this->width()-20,this->width()-20); 57 | painter.setBrush(Qt::red); 58 | painter.drawPie(size,0,p1); 59 | painter.setBrush(Qt::blue); 60 | painter.drawPie(size,p1,p2); 61 | } 62 | else if(variables_number==3) 63 | { 64 | 65 | double a = red+blue+green; 66 | double p1 = ((((red*100)/a)*360)/100)*16; 67 | double p2 = ((((blue*100)/a)*360)/100)*16; 68 | double p3 = ((((green*100)/a)*360)/100)*16; 69 | QPainter painter(this); 70 | 71 | QRectF size = QRectF(10,10,this->width()-20,this->width()-20); 72 | painter.setBrush(Qt::red); 73 | painter.drawPie(size,0,p1); 74 | painter.setBrush(Qt::blue); 75 | painter.drawPie(size,p1,p2); 76 | painter.setBrush(Qt::green); 77 | painter.drawPie(size,p1+p2,p3); 78 | } 79 | else if(variables_number==4) 80 | { 81 | 82 | double a = red+green+blue+yellow ; 83 | double p1 = ((((red*100)/a)*360)/100)*16; 84 | double p2 = ((((blue*100)/a)*360)/100)*16; 85 | double p3 = ((((green*100)/a)*360)/100)*16; 86 | double p4 = ((((yellow*100)/a)*360)/100)*16; 87 | 88 | 89 | 90 | 91 | QPainter painter(this); 92 | 93 | QRectF size = QRectF(10,10,this->width()-20,this->width()-20); 94 | painter.setBrush(Qt::red); 95 | painter.drawPie(size,0,p1); 96 | painter.setBrush(Qt::blue); 97 | painter.drawPie(size,p1,p2); 98 | painter.setBrush(Qt::green); 99 | painter.drawPie(size,p2+p1,p3); 100 | painter.setBrush(Qt::yellow); 101 | painter.drawPie(size,p3+p2+p1,p4); 102 | } 103 | else if(variables_number==5) 104 | { 105 | 106 | double a = red+green+blue+yellow+black ; 107 | double p1 = ((((red*100)/a)*360)/100)*16; 108 | double p2 = ((((blue*100)/a)*360)/100)*16; 109 | double p3 = ((((green*100)/a)*360)/100)*16; 110 | double p4 = ((((yellow*100)/a)*360)/100)*16; 111 | double p5 = ((((black*100)/a)*360)/100)*16; 112 | 113 | 114 | 115 | 116 | QPainter painter(this); 117 | QRectF size = QRectF(10,10,this->width()-20,this->width()-20); 118 | painter.setBrush(Qt::red); 119 | painter.drawPie(size,0,p1); 120 | painter.setBrush(Qt::blue); 121 | painter.drawPie(size,p1,p2); 122 | painter.setBrush(Qt::green); 123 | painter.drawPie(size,p2+p1,p3); 124 | painter.setBrush(Qt::yellow); 125 | painter.drawPie(size,p3+p2+p1,p4); 126 | painter.setBrush(Qt::black); 127 | painter.drawPie(size,p4+p3+p2+p1,p5); 128 | } 129 | } 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "ui_mainframe.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | using namespace std ; 13 | int main(int argc, char *argv[]) 14 | { 15 | QApplication a(argc, argv); 16 | QFile stylesheet("C:/Qt/Tools/QtCreator/bin/Hamadi/style.qss"); 17 | stylesheet.open(QFile::ReadOnly); 18 | QString setSheet = QLatin1String(stylesheet.readAll()); 19 | a.setStyleSheet(setSheet); 20 | 21 | 22 | 23 | //--------------------------------------------- 24 | 25 | QSplashScreen *splash = new QSplashScreen; 26 | splash->setPixmap(QPixmap("C:/Users/gambler/Desktop/rsz_back_ground_global.PNG")); 27 | splash->show(); 28 | Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop; 29 | splash->showMessage(QObject::tr("Setting up the main window..."),topRight, Qt::white); 30 | /*------- setting main window ------*/ 31 | 32 | Mainframe w; 33 | QThread::sleep(2); 34 | /*------------------done ------------*/ 35 | splash->showMessage(QObject::tr("Loading modules..."),topRight, Qt::white); 36 | QThread::sleep(2); 37 | /*-------------done-------------*/ 38 | splash->showMessage(QObject::tr("Establishing connections..."),topRight, Qt::white); 39 | QThread::sleep(2); 40 | 41 | 42 | 43 | 44 | 45 | splash->finish(&w); 46 | delete splash; 47 | //----------------------------------------------------- 48 | 49 | 50 | QString appTitle("Hamadi");//setting the name of the app title 51 | w.setWindowTitle(appTitle);//setting the app title 52 | 53 | 54 | 55 | QString filename ; 56 | filename="config.txt";//setting file name 57 | QFile file(filename);// setting file 58 | file.open(QIODevice::ReadOnly|QIODevice::Text);//reading file 59 | QTextStream in(&file);//assigning file reference 60 | QString str=in.readLine ();//reading first line from config file 61 | QString str2=in.readLine();//reading second line from config file 62 | QString str3=in.readLine();//reading third line from config file 63 | 64 | if (str=="display:fullscreen" ) 65 | { 66 | w.showFullScreen(); //display in fullscreen 67 | } 68 | 69 | else 70 | { 71 | w.show();//display in custom resolution 72 | if(str3=="resolution:1280*720") 73 | { 74 | int height=720; //setting resolution and repositioning items 75 | int width=1280; 76 | w.resize(width,height); 77 | } 78 | else if(str3=="resolution:1080*720") 79 | { 80 | int height=720; //------------------------------------------ 81 | int width=1080; 82 | w.resize(width,height); 83 | } 84 | else if(str3=="resolution:680*400") 85 | { 86 | int height=400; //--------------------------------------------- 87 | int width=680; 88 | w.resize(width,height); 89 | } 90 | } 91 | 92 | w.reposition();//repositioning widget items 93 | w.move(QApplication::desktop()->screen()->rect().center() - w.rect().center());//centralising the mainframe in the screen 94 | file.close();//closing the config.txt file 95 | 96 | QString filenm ; //setting file name container 97 | filenm="config_ap.txt"; //assigning file name to container 98 | QFile fil(filenm);//setting us a file object 99 | fil.open(QIODevice::ReadOnly|QIODevice::Text);//opening a file to read it 100 | QTextStream ina(&fil);//assigning textstream to file reference 101 | QString strin=ina.readLine();//reading from file 102 | w.set_background(strin);//setting back ground choice from file 103 | fil.close();//closing filenm 104 | 105 | QString filenma ;//preparing a new container 106 | filenma="config_logo.txt";//assigning file name to container 107 | QFile fila(filenma);//setting us a new file object 108 | fila.open(QIODevice::ReadOnly|QIODevice::Text);//opening a file to read 109 | QTextStream inaa(&fila);//assigning textstream to file reference 110 | QString stringa=inaa.readLine();//reading line from config_logo.txt 111 | w.set_logo(stringa);// setting logo choice 112 | fila.close();//closing file 113 | return a.exec();//returning main exit values 114 | 115 | 116 | } 117 | -------------------------------------------------------------------------------- /uipassword.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | password 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 80 20 | 230 21 | 75 22 | 23 23 | 24 | 25 | 26 | change 27 | 28 | 29 | 30 | 31 | 32 | 129 33 | 100 34 | 111 35 | 21 36 | 37 | 38 | 39 | QLabel { 40 | font-weight: bold; 41 | font-size: 15px; 42 | color : black 43 | } 44 | 45 | 46 | old password 47 | 48 | 49 | 50 | 51 | 52 | 260 53 | 230 54 | 75 55 | 23 56 | 57 | 58 | 59 | cancel 60 | 61 | 62 | 63 | 64 | 65 | 230 66 | 190 67 | 113 68 | 20 69 | 70 | 71 | 72 | QLineEdit::Password 73 | 74 | 75 | 76 | 77 | 78 | 21 79 | 190 80 | 211 81 | 20 82 | 83 | 84 | 85 | QLabel { 86 | font-weight: bold; 87 | font-size: 15px; 88 | color : black 89 | } 90 | 91 | 92 | new password confirmation 93 | 94 | 95 | 96 | 97 | 98 | 119 99 | 150 100 | 121 101 | 16 102 | 103 | 104 | 105 | QLabel { 106 | font-weight: bold; 107 | font-size: 15px; 108 | color : black 109 | } 110 | 111 | 112 | new password 113 | 114 | 115 | 116 | 117 | 118 | 212 119 | 59 120 | 71 121 | 21 122 | 123 | 124 | 125 | QLabel { 126 | font-weight: bold; 127 | font-size: 15px; 128 | color : black 129 | } 130 | 131 | 132 | id 133 | 134 | 135 | 136 | 137 | 138 | 231 139 | 150 140 | 113 141 | 20 142 | 143 | 144 | 145 | QLineEdit::Password 146 | 147 | 148 | 149 | 150 | 151 | 231 152 | 60 153 | 113 154 | 20 155 | 156 | 157 | 158 | true 159 | 160 | 161 | 162 | 163 | 164 | 231 165 | 100 166 | 113 167 | 20 168 | 169 | 170 | 171 | QLineEdit::Password 172 | 173 | 174 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /SmtpClient-for-Qt-1.1/src/smtpclient.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-2012 - Tőkés Attila 3 | 4 | This file is part of SmtpClient for Qt. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | See the LICENSE file for more details. 17 | */ 18 | 19 | #ifndef SMTPCLIENT_H 20 | #define SMTPCLIENT_H 21 | 22 | #include 23 | #include 24 | 25 | #include "mimemessage.h" 26 | #include "smtpexports.h" 27 | 28 | class SMTP_EXPORT SmtpClient : public QObject 29 | { 30 | Q_OBJECT 31 | public: 32 | 33 | /* [0] Enumerations */ 34 | 35 | enum AuthMethod 36 | { 37 | AuthPlain, 38 | AuthLogin 39 | }; 40 | 41 | enum SmtpError 42 | { 43 | ConnectionTimeoutError, 44 | ResponseTimeoutError, 45 | SendDataTimeoutError, 46 | AuthenticationFailedError, 47 | ServerError, // 4xx smtp error 48 | ClientError // 5xx smtp error 49 | }; 50 | 51 | enum ConnectionType 52 | { 53 | TcpConnection, 54 | SslConnection, 55 | TlsConnection // STARTTLS 56 | }; 57 | 58 | /* [0] --- */ 59 | 60 | 61 | /* [1] Constructors and Destructors */ 62 | 63 | SmtpClient(const QString & host = "localhost", int port = 25, ConnectionType ct = TcpConnection); 64 | 65 | ~SmtpClient(); 66 | 67 | /* [1] --- */ 68 | 69 | 70 | /* [2] Getters and Setters */ 71 | 72 | const QString& getHost() const; 73 | void setHost(const QString &host); 74 | 75 | int getPort() const; 76 | void setPort(int port); 77 | 78 | const QString& getName() const; 79 | void setName(const QString &name); 80 | 81 | ConnectionType getConnectionType() const; 82 | void setConnectionType(ConnectionType ct); 83 | 84 | const QString & getUser() const; 85 | void setUser(const QString &user); 86 | 87 | const QString & getPassword() const; 88 | void setPassword(const QString &password); 89 | 90 | SmtpClient::AuthMethod getAuthMethod() const; 91 | void setAuthMethod(AuthMethod method); 92 | 93 | const QString & getResponseText() const; 94 | int getResponseCode() const; 95 | 96 | int getConnectionTimeout() const; 97 | void setConnectionTimeout(int msec); 98 | 99 | int getResponseTimeout() const; 100 | void setResponseTimeout(int msec); 101 | 102 | int getSendMessageTimeout() const; 103 | void setSendMessageTimeout(int msec); 104 | 105 | QTcpSocket* getSocket(); 106 | 107 | 108 | /* [2] --- */ 109 | 110 | 111 | /* [3] Public methods */ 112 | 113 | bool connectToHost(); 114 | 115 | bool login(); 116 | bool login(const QString &user, const QString &password, AuthMethod method = AuthLogin); 117 | 118 | bool sendMail(MimeMessage& email); 119 | 120 | void quit(); 121 | 122 | 123 | /* [3] --- */ 124 | 125 | protected: 126 | 127 | /* [4] Protected members */ 128 | 129 | QTcpSocket *socket; 130 | 131 | QString host; 132 | int port; 133 | ConnectionType connectionType; 134 | QString name; 135 | 136 | QString user; 137 | QString password; 138 | AuthMethod authMethod; 139 | 140 | int connectionTimeout; 141 | int responseTimeout; 142 | int sendMessageTimeout; 143 | 144 | 145 | QString responseText; 146 | int responseCode; 147 | 148 | 149 | class ResponseTimeoutException {}; 150 | class SendMessageTimeoutException {}; 151 | 152 | /* [4] --- */ 153 | 154 | 155 | /* [5] Protected methods */ 156 | 157 | void waitForResponse(); 158 | 159 | void sendMessage(const QString &text); 160 | 161 | /* [5] --- */ 162 | 163 | protected slots: 164 | 165 | /* [6] Protected slots */ 166 | 167 | void socketStateChanged(QAbstractSocket::SocketState state); 168 | void socketError(QAbstractSocket::SocketError error); 169 | void socketReadyRead(); 170 | 171 | /* [6] --- */ 172 | 173 | 174 | signals: 175 | 176 | /* [7] Signals */ 177 | 178 | void smtpError(SmtpClient::SmtpError e); 179 | 180 | /* [7] --- */ 181 | 182 | }; 183 | 184 | #endif // SMTPCLIENT_H 185 | -------------------------------------------------------------------------------- /slicepiewidget.cpp: -------------------------------------------------------------------------------- 1 | #include "slicepiewidget.h" 2 | 3 | 4 | 5 | slicepiewidget::slicepiewidget(QWidget *parent) :QWidget(parent) 6 | { 7 | red=0 ; 8 | blue=0 ; 9 | green=0 ; 10 | yellow=0 ; 11 | black=0 ; 12 | } 13 | void slicepiewidget::insert_values(int variables_number,double red, double blue , double green, double yellow, double black) 14 | {this->variables_number=variables_number; 15 | this->red=red; 16 | this->blue=blue; 17 | this->green=green; 18 | this->yellow=yellow; 19 | this->black=black; 20 | 21 | 22 | } 23 | void slicepiewidget::insert_values(int variables_number,double red, double blue, double green, double yellow) 24 | { 25 | this->variables_number=variables_number; 26 | this->red=red; 27 | this->blue=blue; 28 | this->green=green; 29 | this->yellow=yellow; 30 | this->black=0; 31 | } 32 | void slicepiewidget::insert_values(int variables_number,double red,double blue,double green) 33 | { 34 | this->variables_number=variables_number; 35 | this->red=red; 36 | this->blue=blue; 37 | this->green=green; 38 | this->yellow=0; 39 | this->black=0; 40 | } 41 | void slicepiewidget::insert_values(int variables_number,double red,double blue) 42 | { 43 | this->variables_number=variables_number; 44 | this->red=red; 45 | this->blue=blue; 46 | this->green=0; 47 | 48 | } 49 | void slicepiewidget::paintEvent(QPaintEvent * ) 50 | {/* 51 | if(variables_number==2) 52 | { 53 | 54 | double a = red+blue; 55 | double p1 = ((((red*100)/a)*360)/100)*16; 56 | double p2 = ((((blue*100)/a)*360)/100)*16; 57 | QPainter painter(this); 58 | 59 | QRectF size = QRectF(10,10,this->width()-20,this->width()-20); 60 | painter.setBrush(Qt::red); 61 | painter.drawPie(size,0,p1); 62 | painter.setBrush(Qt::blue); 63 | painter.drawPie(size,p1,p2); 64 | } 65 | else if(variables_number==3) 66 | { 67 | 68 | double a = red+blue+green; 69 | double p1 = ((((red*100)/a)*360)/100)*16; 70 | double p2 = ((((blue*100)/a)*360)/100)*16; 71 | double p3 = ((((green*100)/a)*360)/100)*16; 72 | QPainter painter(this); 73 | 74 | QRectF size = QRectF(10,10,this->width()-20,this->width()-20); 75 | painter.setBrush(Qt::red); 76 | painter.drawPie(size,0,p1); 77 | painter.setBrush(Qt::blue); 78 | painter.drawPie(size,p1,p2); 79 | painter.setBrush(Qt::green); 80 | painter.drawPie(size,p1+p2,p3); 81 | } 82 | else if(variables_number==4) 83 | { 84 | 85 | double a = red+green+blue+yellow ; 86 | double p1 = ((((red*100)/a)*360)/100)*16; 87 | double p2 = ((((blue*100)/a)*360)/100)*16; 88 | double p3 = ((((green*100)/a)*360)/100)*16; 89 | double p4 = ((((yellow*100)/a)*360)/100)*16; 90 | 91 | 92 | 93 | 94 | QPainter painter(this); 95 | 96 | QRectF size = QRectF(10,10,this->width()-20,this->width()-20); 97 | painter.setBrush(Qt::red); 98 | painter.drawPie(size,0,p1); 99 | painter.setBrush(Qt::blue); 100 | painter.drawPie(size,p1,p2); 101 | painter.setBrush(Qt::green); 102 | painter.drawPie(size,p2+p1,p3); 103 | painter.setBrush(Qt::yellow); 104 | painter.drawPie(size,p3+p2+p1,p4); 105 | } 106 | else if(variables_number==5) 107 | { 108 | 109 | double a = red+green+blue+yellow+black ; 110 | double p1 = ((((red*100)/a)*360)/100)*16; 111 | double p2 = ((((blue*100)/a)*360)/100)*16; 112 | double p3 = ((((green*100)/a)*360)/100)*16; 113 | double p4 = ((((yellow*100)/a)*360)/100)*16; 114 | double p5 = ((((black*100)/a)*360)/100)*16; 115 | 116 | 117 | 118 | 119 | QPainter painter(this); 120 | 121 | QRectF size = QRectF(10,10,this->width()-20,this->width()-20); 122 | painter.setBrush(Qt::red); 123 | painter.drawPie(size,0,p1); 124 | painter.setBrush(Qt::blue); 125 | painter.drawPie(size,p1,p2); 126 | painter.setBrush(Qt::green); 127 | painter.drawPie(size,p2+p1,p3); 128 | painter.setBrush(Qt::yellow); 129 | painter.drawPie(size,p3+p2+p1,p4); 130 | painter.setBrush(Qt::black); 131 | painter.drawPie(size,p4+p3+p2+p1,p5); 132 | }*/ 133 | 134 | QPainter painter(this); 135 | 136 | // QRectF size = QRectF(40,10,this->width()-80,this->height()-80); 137 | QRectF size2 = QRectF(0,30,this->width()-80,this->height()-80); 138 | painter.setBrush(Qt::black); 139 | painter.drawChord(size2,0,45*16); 140 | painter.setBrush(Qt::blue); 141 | painter.drawArc(size2,45*16,90*16); 142 | 143 | /* painter.setBrush(Qt::red); 144 | painter.drawPie(size,0,45*16); 145 | painter.setBrush(Qt::blue); 146 | painter.drawPie(size,45*16,20*16); 147 | painter.setBrush(Qt::green); 148 | painter.drawPie(size,65*16,25*16); 149 | painter.setBrush(Qt::yellow); 150 | painter.drawPie(size2,90*16,120*16); 151 | painter.setBrush(Qt::black); 152 | painter.drawPie(size2,210*16,150*16);*/ 153 | } 154 | 155 | 156 | 157 | --------------------------------------------------------------------------------