void KstEventMonitorI::vectorChanged(const QString& strVector) { QString str; int iButton; if( _bChanged ) { iButton = QMessageBox::information( this, i18n("Accept changes?"), i18n("You have made changes to the event monitor entries for the vector %1\nDo you wish to accept or discard your changes?").arg( _strVector ), i18n("Accept"), i18n("Discard") ); if( iButton == 0 ) { acceptChanges( ); } } lineEditEquation->setText( "" ); displayEvents( strVector ); if( _eventMonitors.size( ) > 0 ) { enableEditing( TRUE ); tableEvents->setCurrentCell( 0, 0 ); } else { enableEditing( FALSE ); } setChanged( FALSE ); }
void MainWindow::nouvelleTacheUnitairePreemptable() { QList<QTreeWidgetItem*> selected = projets->selectedItems(); if (selected.size() != 0 && (selected.at(0)->text(0) == "Projet" || dynamic_cast<TacheComposite*>(tm->trouverTache(selected.at(0)->text(1))))) { Tache& tach = tm->ajouterTache("preemptable"); if (selected.at(0)->text(0) == "Projet") { QString id = selected.at(0)->text(1); Projet* proj = pm->trouverProjet(id); try{proj->ajouterTache(&tach);}catch(ProjetException e){qDebug()<<e.get_info();} tach.setProjet_conteneur(proj); } else { TacheComposite* task = dynamic_cast<TacheComposite*>(tm->trouverTache(selected.at(0)->text(1))); task->ajouterTache(&tach); tach.setTache_conteneur(task); } try { tm->saveToDB(); } catch (TacheManagerException e) { showError("Project Calendar", e.getInfo()); tm->clearAll(); pm->clearAll(); pm->loadProjets(); tm->loadTaches(); em->clearAll(); em->loadEvents(); displayEvents(this->current_debut,this->current_fin); } displayProjetsAndTasks(); } }
void MainWindow::deleteProjets() { tm->clearAll(); tm->saveToDB(); pm->clearAll(); pm->saveToDB(); em->clearAll(); em->loadEvents(); displayEvents(this->current_debut,this->current_fin); displayProjetsAndTasks(); }
/** * @brief MainWindow::changeCurrentWeek Change la tableau (de la semaine) affiché actuellement * @param date * @param isCurrentDay */ void MainWindow::changeCurrentWeek(QDate* date, bool isCurrentDay) { int dayOfWeek = date->dayOfWeek(); int counter = -dayOfWeek; QString formatter = QString("ddd d MMM"); for (int i = 0 ; i<7; i++) { counter++; agenda_widget->horizontalHeaderItem(i)->setText(date->addDays(counter).toString(formatter)); } QFont font; if (isCurrentDay) font.setBold(true); agenda_widget->horizontalHeaderItem(dayOfWeek-1)->setFont(font); displayEvents(date->addDays(-dayOfWeek+1),date->addDays(-dayOfWeek+7)); }
void MainWindow::newEvent(QDate ddebut, QString lieu, QDate dfin, QTime hdebut, QTime hfin, QString descr, QString title) { try{ em->ajouterEvenement(title,ddebut,hdebut,dfin,hfin,lieu,descr); em->saveToDB(); } catch (EvenementException e){ showError("Project Calendar", "Les dates/heures doivent être valides (début >= fin)"); em->clearAll(); em->loadEvents(); } catch (EvenementManagerException e) { showError("Project Calendar", e.getInfo()+"\nAssurez-vous d'avoir bien rempli tous les champs."); em->clearAll(); em->loadEvents(); } displayEvents(this->current_debut,this->current_fin); }
void MainWindow::nouveauProjet() { Projet& proj = pm->ajouterProjet(); try { pm->saveToDB(); } catch (ProjetManagerException e) { showError("Project Calendar", e.getInfo()); tm->clearAll(); pm->clearAll(); pm->loadProjets(); tm->loadTaches(); em->clearAll(); em->loadEvents(); displayEvents(this->current_debut,this->current_fin); } displayProjetsAndTasks(); }
void MainWindow::editTask(QString id, QString title, QDate ddebut, QDate dfin, QTime hdebut, QTime hfin) { try { Evenement& evnt = em->ajouterEvenement(title,ddebut,hdebut,dfin,hfin); Tache* tmp = tm->trouverTache(id); evnt.setTacheAssociee(tmp); em->saveToDB(); }catch (EvenementException e){ showError("Project Calendar", "Les dates/heures doivent être valides (début >= fin)"); em->clearAll(); em->loadEvents(); } catch (EvenementManagerException e){ showError("Project Calendar", e.getInfo()+"\nAssurez-vous d'avoir bien rempli tous les champs."); em->clearAll(); em->loadEvents(); } displayEvents(this->current_debut,this->current_fin); }
void KstEventMonitorI::discardChanges() { displayEvents( _strVector ); setChanged( FALSE ); }
void MainWindow::deleteEvents() { em->clearAll(); em->saveToDB(); displayEvents(this->current_debut,this->current_fin); }
void MainWindow::onTreeWidgetItemDoubleClicked(QTreeWidgetItem * item, int column) { if (column==1) { // nom QString id = item->text(1); edittitle* edittitre = new edittitle(this); edittitre->setTitle(id); if (edittitre->exec() == QDialog::Accepted) { QString newTitre = edittitre->getTitle(); if(item->text(0)=="Projet"){ Projet* tmp = pm->trouverProjet(id); tmp->setNom(newTitre); } else{ Tache* tmp = tm->trouverTache(id); tmp->setTitre(newTitre); } } delete edittitre; } if (column==2) { // date dispo QString id = item->text(1); popupdispo = new datedispo(this); popupdispo->setDate(QDate::fromString(item->text(2),Qt::TextDate)); if (popupdispo->exec() == QDialog::Accepted) { QDate dateDisponible = popupdispo->getDate(); if(item->text(0)=="Projet"){ Projet* tmp = pm->trouverProjet(id); tmp->setDispo(dateDisponible); } else{ Tache* tmp = tm->trouverTache(id); tmp->setDateDisponibilite(dateDisponible); } } delete popupdispo; } if (column==3 && item->text(0) != "Projet" && item->text(0) != "Tâche Composite") { //durée QString id = item->text(1); editduree* duree = new editduree(this); if (duree->exec() == QDialog::Accepted) { TIME::Duree dur = duree->getDuree(); TacheUnitaire* tmp = dynamic_cast<TacheUnitaire*>(tm->trouverTache(id)); try{tmp->setDuree(dur);}catch(TacheException e){ showError("Project Calendar", "\n Une tache unitaire non preemptable ne peut durer plus de 12h"); } } delete duree; } if (column==4 && item->text(0) != "Projet") { // echeance QString id = item->text(1); editecheance* echeance = new editecheance(this); echeance->setDate(QDate::fromString(item->text(4),Qt::TextDate)); if (echeance->exec() == QDialog::Accepted) { QDate dateEcheance = echeance->getDate(); Tache* tmp = tm->trouverTache(id); tmp->setEcheance(dateEcheance); } delete echeance; } if (column==5 && (item->text(0) == "Tâche unitaire" || item->text(0) == "Tâche unitaire préemptable") && item->text(0) != "Tâche Composite") { // etat QString id = item->text(1); editetat* etat = new editetat(this); TacheUnitaire* tmp = dynamic_cast<TacheUnitaire*>(tm->trouverTache(id)); etat->setTache(tmp); if (etat->exec() == QDialog::Accepted) { // do nothing } delete etat; } try { tm->saveToDB(); pm->saveToDB(); }catch (ProjetManagerException e) { showError("Project Calendar", e.getInfo()+"\nLes noms de projets doivent être uniques."); tm->clearAll(); pm->clearAll(); pm->loadProjets(); tm->loadTaches(); em->clearAll(); em->loadEvents(); displayEvents(this->current_debut,this->current_fin); } catch (TacheManagerException e) { showError("Project Calendar", e.getInfo()+"\nDeux tâches contenues dans la même tache ou le même projet ne peuvent avoir le même nom."); tm->clearAll(); pm->clearAll(); pm->loadProjets(); tm->loadTaches(); em->clearAll(); em->loadEvents(); displayEvents(this->current_debut,this->current_fin); } displayProjetsAndTasks(); }