00001 #include "chooseadditionalchargedialog.h"
00002 #include "../Data/project.h"
00003
00004 ChooseAdditionalChargeDialog::ChooseAdditionalChargeDialog(QWidget *parent, Settings *set) : QDialog(parent)
00005 {
00006 setupUi(this);
00007 setAttribute(Qt::WA_DeleteOnClose, true);
00008
00009 settings = set;
00010
00011 createControls();
00012 }
00013
00014 void ChooseAdditionalChargeDialog::createControls()
00015 {
00016 qDebug()<<"in create controls";
00017 QTreeWidgetItem *projectitem = new QTreeWidgetItem(treeWidgetProjects);
00018 projectitem->setText(0, tr("Projekt: ") + Project::name());
00019 treeWidgetProjects->addTopLevelItem(projectitem);
00020
00021
00022 if(projectitem->childCount() > 0)
00023 {
00024 projectitem->setIcon(0, QIcon(":/project/NonEmpty"));
00025 }
00026 else
00027 {
00028 projectitem->setIcon(0, QIcon(":/project/Empty"));
00029 }
00030
00031 connect(buttonBox, SIGNAL(accepted()), this, SLOT(ok()));
00032 connect(buttonBox, SIGNAL(rejected()), this, SLOT(cancel()));
00033 qDebug()<<"end of create controls";
00034 }
00035
00036 void ChooseAdditionalChargeDialog::fileChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
00037 {
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 }
00074
00075 void ChooseAdditionalChargeDialog::loadFile(QString fileName)
00076 {
00077
00078 }
00079
00080 void ChooseAdditionalChargeDialog::ok()
00081 {
00082 QList<QTreeWidgetItem*> entries = treeWidgetPositions->selectedItems();
00083
00084 QStringList newdata = QStringList();
00085 for(int i = 0; i < entries.size(); i++)
00086 {
00087 if(entries.value(i))
00088 {
00089 QString s = entries.value(i)->text(1);
00090 if(s != "")
00091 {
00092 newdata<<s;
00093 }
00094 else
00095 {
00096 QMessageBox::information(NULL, tr("Fehler"), tr("Bitte wählen Sie eine Kostenstelle aus, die Sie zuschlagen möchten"));
00097 }
00098 }
00099 }
00100 emit sendingData(newdata);
00101 done(0);
00102 }
00103
00104 void ChooseAdditionalChargeDialog::cancel()
00105 {
00106 done(1);
00107 }