int main(int argc, char** argv) { DataManager* data = DataManager::instanceOf(); if(argc >=2) { if(strcmp(argv[1],"-o")==0) { string file_name(argv[2]); data->loadFile(file_name); } } string input; do { cout << endl; if(data->getList().size() > 0) { data->getList().getTaskList(); cout << endl; } cout << "opcje do wyboru:" << endl; cout << "open" << endl; cout << "create" << endl; cout << "exit" << endl; if(data->getList().size() > 0) { cout << "save" << endl; cout << "setdate" << endl; cout << "settime" << endl; cout << "setdescription" << endl; cout << "settitle" << endl; cout << "setpriority" << endl; cout << "setseverity" << endl; } cout << endl << "->"; getline(cin,input); if(input == "open") { getline(cin,input); data->loadFile(input); if(data->auth_required()) { for(int i = 0; i < 3; ++i) { cout << "password:"******"Welcome" << endl; else cout << "access danied" << endl; input = ""; } continue; } } int i = 0; if(input == "save") { cout << "Podaj nazwe pliku:" << endl; getline(cin,input); if( data->saveToFile(input) ) { cout << "Zapisano" << endl; } else { cerr << "Nie udało się zapisać" << endl; } } string tmp; if(input == "create") { cout << "podaj tytul" << endl; getline(cin,tmp); int id = data->addTask(tmp); data->getList(); set_date(id); set_time(id); } if(input == "setpass") { bool fine = true; string opass, npass; if(data->auth_required()) { cout << "podaj aktualne haslo:" << endl; getline(cin,opass); fine = data->auth(opass); if(!fine) cout << "haslo nieprawidlowe" << endl; } if(fine) { cout << "podaj nowe haslo" << endl; getline(cin,npass); data->setPasscode(opass,npass); } } if(input == "setdate") { i = get_task_id(); set_date(i); } if(input == "settime") { i = get_task_id(); set_time(i); } if(input == "setdescription") { Todos::iterator it = get_task_by_id(); if(it != data->getList().end()) { cout << "podaj opis" << endl; getline(cin,tmp); it->setDescription(tmp); } } if(input == "settitle") { Todos::iterator it = get_task_by_id(); if(it != data->getList().end()) { cout << "podaj tytul" << endl; getline (cin,tmp); it->setTitle(tmp); } } if(input == "setpriority") { Todos::iterator it = get_task_by_id(); if(it != data->getList().end()) { cout << "podaj priorytet" << endl; getline (cin,tmp); it->setPriority(tmp); } } if(input == "setseverity") { Todos::iterator it = get_task_by_id(); if(it != data->getList().end()) { cout << "podaj severity" << endl; getline (cin,tmp); it->setSeverity(tmp); } } } while(input != "exit" && input != "quit"); }