Esempio n. 1
0
void ProjectNavigator::new_project() {
    QString fileName = QFileDialog::getSaveFileName(this, tr("new project"),
                                "", tr("Project index database (*.db)"));
    if (fileName.isEmpty())
        return;
    pm.add_project(fileName);
    refresh_projects();
}
Esempio n. 2
0
void MainWindow::customer_selection_changed()
{
    ui->pushHour->setEnabled(TRUE);
    this->cusid=customer_model->data(customer_model->index(ui->tableCustomers->currentIndex().row(),0)).toString();
    ui->label_customer->setText(customer_model->data(customer_model->index(ui->tableCustomers->currentIndex().row(),1)).toString());
    refresh_places();
    refresh_projects();
    ui->comboproject->setCurrentIndex(-1);
}
Esempio n. 3
0
void ProjectNavigator::rename_project() {
    bool ok;
    //QString old_name = ui->comboBox->currentText();
    QList<QTreeWidgetItem*> selection = ui->treeWidget->selectedItems();
    if (selection.size() == 0)
        return;
    QString old_name = selection[0]->data(0, 0).toString();
    QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
                                         tr("Give the new name:"), QLineEdit::Normal,
                                         QDir::home().dirName(), &ok);
    if (ok && !text.isEmpty()) {
        pm.rename_project(old_name, text);
    }
    refresh_projects();
}
Esempio n. 4
0
void ProjectNavigator::delete_project() {
    QString curr_project = ui->treeWidget->currentItem()->text(0);
    pm.remove_project(curr_project);
    refresh_projects();
}
Esempio n. 5
0
void MainWindow::context_menu(const QPoint& pos)
{
    // for most widgets
       QPoint globalPos = ui->tableView->mapToGlobal(pos);
               //myWidget->mapToGlobal(pos);
       // for QAbstractScrollArea and derived classes you would use:
       // QPoint globalPos = myWidget->viewport()->mapToGlobal(pos);

       QMenu myMenu;
       myMenu.setFocusPolicy(Qt::NoFocus);
       myMenu.addAction(trUtf8("Συνέχιση εργασίας"));

       myMenu.addAction(trUtf8("Kλήση πελάτη"));
       // ...

       QAction* selectedItem = myMenu.exec(globalPos);
       if (selectedItem)
       {

           QSqlQuery query(db1);
           QString t_id=tasks_model->data(tasks_model->index(ui->tableView->currentIndex().row(),0)).toString();
           query.exec("select t.cusid,t.placeid,t.projectid,t.comment from tasks t where id="+t_id);
           query.next();
           this->cusid=query.value(0).toString();
           QString t_cusid=cusid=query.value(0).toString();

           if(selectedItem->text()==trUtf8("Συνέχιση εργασίας"))
           {

           refresh_places();
           refresh_projects();

           ui->label_customer->setText(tasks_model->data(tasks_model->index(ui->tableView->currentIndex().row(),1)).toString());
           ui->textEdit->setPlainText(query.value(3).toString());
           for (int i=0;i<ui->comboplace->count();++i)
           {
               ui->comboplace->setCurrentIndex(i);

               if (places_model->data(places_model->index(ui->comboplace->currentIndex(),0))==query.value(1).toInt())

                   break;

           }
           for (int i=0;i<ui->comboproject->count();++i)
           {
               ui->comboproject->setCurrentIndex(i);

               if (project_model->data(project_model->index(ui->comboproject->currentIndex(),0))==query.value(2).toInt())

                   break;

           }
           ui->pushHour->setEnabled(TRUE);
           }
           else
           {
               query.exec("select phone from customers where id="+t_cusid);
               query.next();
               QString phone=query.value(0).toString();
               dial(phone);

           }

       }

       return;

}