Skip to content

Commit

Permalink
started implementing the ordering process. still closing the program if
Browse files Browse the repository at this point in the history
account is blocked does not work
  • Loading branch information
euklid committed Oct 2, 2011
1 parent b808164 commit 6ac9b5f
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 41 deletions.
73 changes: 65 additions & 8 deletions cuedussmann.cpp
Expand Up @@ -29,16 +29,37 @@ cuedussmann::cuedussmann(QWidget *parent) :
int cuedussmann::initialize() int cuedussmann::initialize()
{ {
loadPWDUID(); loadPWDUID();
while(loginandcookie(uid, pwd)==0) int log;
while((log=loginandcookie(uid, pwd))!=1)
{ {
QMessageBox msg; if(log==0)
msg.setText("Falsche Nutzernummer/Passwort Kombination");
msg.setWindowTitle("Fehler beim Login");
msg.addButton("Benutzername und Passwort neu setzen",QMessageBox::AcceptRole);
int ret = msg.exec();
if(ret==QMessageBox::AcceptRole)
{ {
cuedussmann::on_actionUID_PWD_ndern_triggered(); QMessageBox msg;
msg.setText("Falsche Nutzernummer/Passwort Kombination");
msg.setWindowTitle("Fehler beim Login");
msg.addButton("Benutzername und Passwort neu setzen",QMessageBox::AcceptRole);
int ret = msg.exec();
if(ret==QMessageBox::AcceptRole)
{
cuedussmann::on_actionUID_PWD_ndern_triggered();
}
}
if(log==2)
{
QMessageBox msg;
msg.setText(QString("Der Account für die eingegebene Benutzernummer ist gesperrt. Tut mir sehr leid."));
msg.setWindowTitle("Fehler beim Login");
msg.setStandardButtons(QMessageBox::Abort);
msg.addButton("Anderen Account einstellen",QMessageBox::AcceptRole);
int ret = msg.exec();
if(ret==QMessageBox::AcceptRole)
{
cuedussmann::on_actionUID_PWD_ndern_triggered();
}
if(ret==QMessageBox::RejectRole)
{
QApplication::exit(0);
}
} }
} }
if(initialized==0) if(initialized==0)
Expand Down Expand Up @@ -73,6 +94,36 @@ int cuedussmann::initialize()
} }
setcombobox(startwoche, startwoche+anzwoche-1); setcombobox(startwoche, startwoche+anzwoche-1);
parsemenufile(0); parsemenufile(0);
hidden=(char***)calloc(anzwoche,sizeof(char**));
bergruen=(char***)calloc(anzwoche, sizeof(char**));
bergruend=(char***)calloc(anzwoche,sizeof(char**));
for(int i = 0 ; i < anzwoche; i++)
{
hidden[i]=(char**)calloc(35,sizeof(char*));
bergruen[i]=(char**)calloc(35,sizeof(char*));
bergruend[i]=(char**)calloc(35,sizeof(char*));

for(int k=0;k<35;k++)
{
hidden[i][k]=(char*)malloc(50); strcpy(hidden[i][k],"\0");
bergruen[i][k]=(char*)malloc(50);strcpy(bergruen[i][k],"\0");
bergruend[i][k]=(char*)malloc(50);strcpy(bergruend[i][k],"\0");
}
}
wocheplustagplusdaten=(char****)calloc(anzwoche,sizeof(char***));
for(int i=0;i<anzwoche;i++)
{
wocheplustagplusdaten[i]=(char***)calloc(7,sizeof(char**));
for(int j=0;j<7;j++)
{
wocheplustagplusdaten[i][j]=(char**)calloc(9,sizeof(char*));
for(int k=0;k<9;k++)
{
wocheplustagplusdaten[i][j][k]=(char*)malloc(150*sizeof(char));
strcpy(wocheplustagplusdaten[i][j][k],"\0");
}
}
}
return 1; return 1;
} }
} }
Expand Down Expand Up @@ -652,3 +703,9 @@ void cuedussmann::on_tableWidget_cellDoubleClicked(int row, int column)
} }
} }
} }

void cuedussmann::on_actionEssen_bestellen_lassen_triggered() //now big fat routines are following
{
gethiddenandbestellt(); //save data in the hidden, bergruen and bergruend arrays

}
4 changes: 3 additions & 1 deletion cuedussmann.h
Expand Up @@ -8,7 +8,7 @@ class cuedussmann : public QMainWindow, public Ui::cuedussmann
Q_OBJECT Q_OBJECT


public: public:
explicit cuedussmann(QWidget *parent = 0);; explicit cuedussmann(QWidget *parent = 0);


private slots: private slots:


Expand All @@ -33,6 +33,8 @@ private slots:


void on_tableWidget_cellDoubleClicked(int row, int column); void on_tableWidget_cellDoubleClicked(int row, int column);


void on_actionEssen_bestellen_lassen_triggered();

private: private:
int initialized; int initialized;
int initialize(); int initialize();
Expand Down
20 changes: 17 additions & 3 deletions cuedussmann.pro
Expand Up @@ -13,10 +13,24 @@ TEMPLATE = app
SOURCES += main.cpp\ SOURCES += main.cpp\
cuedussmann.cpp \ cuedussmann.cpp \
dussmanbot.cpp \ dussmanbot.cpp \
pwduidialog.cpp pwduidialog.cpp \
ratedialog.cpp


HEADERS += cuedussmann.h \ HEADERS += cuedussmann.h \
pwduidialog.h pwduidialog.h \
ratedialog.h


FORMS += cuedussmann.ui \ FORMS += cuedussmann.ui \
pwduidialog.ui pwduidialog.ui \
ratedialog.ui











60 changes: 32 additions & 28 deletions dussmanbot.cpp
Expand Up @@ -439,7 +439,9 @@ int loginandcookie(char* userid, char* passwd)
ret = curl_easy_perform(hnd); ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd); curl_easy_cleanup(hnd);
fclose(essen); fclose(essen);
if(find("kalendera","falsches Passwort")) return 0; else return 1; if(find("kalendera","falsches Passwort")) return 0; //0- simply wrong password
else if(find("kalendera","Fehleingabe des Passwortes")) return 2; //account is blocked for maximum 30 minutes
else return 1;//alright
//return (int)ret; //return (int)ret;




Expand Down Expand Up @@ -616,7 +618,7 @@ void gethiddenandbestellt()
{ {
char menufilename[8]; char menufilename[8];
char menunumber[2]; char menunumber[2];
hidden=(char***)calloc(anzwoche,sizeof(char**));
for(int i=0;i<anzwoche; i++) for(int i=0;i<anzwoche; i++)
{ {
int numlines=0; int numlines=0;
Expand All @@ -625,8 +627,8 @@ void gethiddenandbestellt()
char* tmp2=(char*)malloc(sizeof(char)*300); char* tmp2=(char*)malloc(sizeof(char)*300);
char* puffer=(char*)malloc(sizeof(char)*50); char* puffer=(char*)malloc(sizeof(char)*50);
FILE* listhidden; FILE* listhidden;
hidden[i]=(char**)calloc(35,sizeof(char*)); //hidden[i]=(char**)calloc(35,sizeof(char*));
for(int k=0;k<35;k++) {hidden[i][k]=(char*)malloc(50);strcpy(hidden[i][k],"\0");} //for(int k=0;k<35;k++) {hidden[i][k]=(char*)malloc(50);strcpy(hidden[i][k],"\0");}
if(strlen(slynmbwochen[i])>2) if(strlen(slynmbwochen[i])>2)
{ {
strcpy(menufilename,"menu"); strcpy(menufilename,"menu");
Expand Down Expand Up @@ -655,7 +657,7 @@ void gethiddenandbestellt()
free(tmp2); free(tmp2);
free(puffer); free(puffer);
} }
bergruen=(char***)calloc(anzwoche,sizeof(char**)); //bergruen=(char***)calloc(anzwoche,sizeof(char**));
for(int i=0;i<anzwoche; i++) for(int i=0;i<anzwoche; i++)
{ {
int numlines=0; int numlines=0;
Expand All @@ -664,8 +666,8 @@ void gethiddenandbestellt()
char* tmp2=(char*)malloc(sizeof(char)*300); char* tmp2=(char*)malloc(sizeof(char)*300);
char* puffer=(char*)malloc(sizeof(char)*50); char* puffer=(char*)malloc(sizeof(char)*50);
FILE* listgruen; FILE* listgruen;
bergruen[i]=(char**)calloc(35,sizeof(char*));
for(int k=0;k<35;k++) {bergruen[i][k]=(char*)malloc(50);strcpy(bergruen[i][k],"\0");} // for(int k=0;k<35;k++) {bergruen[i][k]=(char*)malloc(50);strcpy(bergruen[i][k],"\0");}
if(strlen(slynmbwochen[i])>2) if(strlen(slynmbwochen[i])>2)
{ {
strcpy(menufilename,"menu"); strcpy(menufilename,"menu");
Expand Down Expand Up @@ -695,7 +697,7 @@ void gethiddenandbestellt()
free(tmp2); free(tmp2);
free(puffer); free(puffer);
} }
bergruend=(char***)calloc(anzwoche,sizeof(char**)); //bergruend=(char***)calloc(anzwoche,sizeof(char**));
for(int i=0;i<anzwoche; i++) for(int i=0;i<anzwoche; i++)
{ {
int numlines=0; int numlines=0;
Expand All @@ -704,13 +706,12 @@ void gethiddenandbestellt()
char* tmp2=(char*)malloc(sizeof(char)*300); char* tmp2=(char*)malloc(sizeof(char)*300);
char* puffer=(char*)malloc(sizeof(char)*50); char* puffer=(char*)malloc(sizeof(char)*50);
FILE* listgruend; FILE* listgruend;
bergruend[i]=(char**)calloc(35,sizeof(char*)); // for(int k=0;k<35;k++) {bergruend[i][k]=(char*)malloc(50);strcpy(bergruend[i][k],"\0");}
for(int k=0;k<35;k++) {bergruend[i][k]=(char*)malloc(50);strcpy(bergruend[i][k],"\0");}
if(strlen(slynmbwochen[i])>2) if(strlen(slynmbwochen[i])>2)
{ {
strcpy(menufilename,"menu"); strcpy(menufilename,"menu");
menunumber[0]=48+i; menunumber[1]='\0'; menunumber[0]=48+i; menunumber[1]='\0';
strcat(menufilename,menunumber); strcat(menufilename,"\0"); strcat(menufilename,menunumber); strcat(menufilename,"\0");
find(menufilename,"gruen pointer\"",3); find(menufilename,"gruen pointer\"",3);
find("findoutput","type=\"hidden\" name=\"fld_"); find("findoutput","type=\"hidden\" name=\"fld_");
listgruend=fopen("findoutput","r"); listgruend=fopen("findoutput","r");
Expand All @@ -722,12 +723,15 @@ void gethiddenandbestellt()
for(int j=0;j<numlines;j++) for(int j=0;j<numlines;j++)
{ {
fgets(tmp,300,listgruend); fgets(tmp,300,listgruend);
if(strstr(tmp,"checkbox")!=NULL)
{
tmp2=strcpy(tmp2,tmp); tmp2=strcpy(tmp2,tmp);
strcpy(puffer,cut2(tmp2,"\"",12,12)); strcpy(puffer,cut2(tmp2,"\"",12,12));
tmp2=strcpy(tmp2,tmp); tmp2=strcpy(tmp2,tmp);
strcat(puffer,"="); strcat(puffer,"=");
strcat(puffer,cut2(tmp2,"\"",14,14)); strcat(puffer,cut2(tmp2,"\"",14,14));
bergruend[i][j]=strcpy(bergruend[i][j],puffer); bergruend[i][j]=strcpy(bergruend[i][j],puffer);
}
} }
fclose(listgruend); fclose(listgruend);
} }
Expand All @@ -739,30 +743,30 @@ void gethiddenandbestellt()


void getdatensatz() void getdatensatz()
{ {
wirkbestellen=(int**)calloc(anzwoche,sizeof(int*)); //wirkbestellen=(int**)calloc(anzwoche,sizeof(int*));
for(int i=0;i<anzwoche;i++) for(int i=0;i<anzwoche;i++)
{ {
wirkbestellen[i]=(int*)malloc(7*sizeof(int)); //wirkbestellen[i]=(int*)malloc(7*sizeof(int));
for(int j=0;j<7;j++) for(int j=0;j<7;j++)
{ {
wirkbestellen[i][j]=0; //wirkbestellen[i][j]=0;
if(setdates[i][j]==1) wirkbestellen[i][j]=1; //ACHTUNG: Das kann noch zu viel sein!! if(setdates[i][j]==1) wirkbestellen[i][j]=1; //ACHTUNG: Das kann noch zu viel sein!!
} }
} }
wocheplustagplusdaten=(char****)calloc(anzwoche,sizeof(char***)); // wocheplustagplusdaten=(char****)calloc(anzwoche,sizeof(char***));
for(int i=0;i<anzwoche;i++) // for(int i=0;i<anzwoche;i++)
{ // {
wocheplustagplusdaten[i]=(char***)calloc(7,sizeof(char**)); // wocheplustagplusdaten[i]=(char***)calloc(7,sizeof(char**));
for(int j=0;j<7;j++) // for(int j=0;j<7;j++)
{ // {
wocheplustagplusdaten[i][j]=(char**)calloc(9,sizeof(char*)); // wocheplustagplusdaten[i][j]=(char**)calloc(9,sizeof(char*));
for(int k=0;k<9;k++) // for(int k=0;k<9;k++)
{ // {
wocheplustagplusdaten[i][j][k]=(char*)malloc(150*sizeof(char)); // wocheplustagplusdaten[i][j][k]=(char*)malloc(150*sizeof(char));
strcpy(wocheplustagplusdaten[i][j][k],"\0"); // strcpy(wocheplustagplusdaten[i][j][k],"\0");
} // }
} // }
} // }
char menufilename[8]; char menufilename[8];
char menunumber[2]; char menunumber[2];
for(int i=0;i<anzwoche;i++) for(int i=0;i<anzwoche;i++)
Expand Down
1 change: 0 additions & 1 deletion pwduidialog.cpp
@@ -1,5 +1,4 @@
#include "pwduidialog.h" #include "pwduidialog.h"

PwduiDialog::PwduiDialog(QWidget *parent, int u, int p) : PwduiDialog::PwduiDialog(QWidget *parent, int u, int p) :
QDialog(parent) QDialog(parent)
{ {
Expand Down

0 comments on commit 6ac9b5f

Please sign in to comment.