1 #include "edittaskdialog.h"
2 #include "ui_edittaskdialog.h"
3 #include "historydialog.h"
5 #include "ktimetrackerutility.h"
8 QVector
<QCheckBox
*> desktopcheckboxes
;
10 EditTaskDialog::EditTaskDialog(TaskView
*parent
, const QString
&caption
, DesktopList
* desktopList
)
12 m_ui(new Ui::EditTaskDialog
)
14 setWindowTitle(caption
);
18 { // Set the desktop checkboxes
19 QCheckBox
* desktopcheckbox
;
20 desktopcheckboxes
.clear();
22 for (int i
=0; i
<desktopcount(); ++i
)
24 desktopcheckbox
= new QCheckBox(m_ui
->autotrackinggroupbox
);
25 desktopcheckbox
->setObjectName(QString::fromUtf8("desktop_").append(i
));
26 desktopcheckbox
->setText(KWindowSystem::desktopName( i
+ 1 ));
27 m_ui
->gridLayout_2
->addWidget(desktopcheckbox
, i
% lines
, i
/ lines
+ 1);
28 desktopcheckboxes
.push_back(desktopcheckbox
);
30 if ( desktopList
&& ( desktopList
->size() > 0 ) )
32 DesktopList::iterator it
= desktopList
->begin();
33 while ( it
!= desktopList
->end() )
35 desktopcheckboxes
[*it
]->setChecked( true );
38 m_ui
->autotrackinggroupbox
->setChecked(true);
41 for ( int i
= 0; i
< desktopcheckboxes
.count(); i
++ )
42 desktopcheckboxes
[i
]->setEnabled(false);
46 EditTaskDialog::~EditTaskDialog()
51 void EditTaskDialog::changeEvent(QEvent
*e
)
53 QDialog::changeEvent(e
);
56 case QEvent::LanguageChange
:
57 m_ui
->retranslateUi(this);
64 QString
EditTaskDialog::taskName()
66 return m_ui
->tasknamelineedit
->text();
69 QString
EditTaskDialog::timeChange()
71 return m_ui
->letimechange
->text();
74 void EditTaskDialog::setTask( const QString
&name
)
76 m_ui
->tasknamelineedit
->setText( name
);
79 void EditTaskDialog::status(DesktopList
*desktopList
) const
84 for ( int i
= 0; i
< desktopcheckboxes
.count(); i
++ )
86 if ( desktopcheckboxes
[i
]->isEnabled() && desktopcheckboxes
[i
]->isChecked() ) desktopList
->append( i
);
91 void EditTaskDialog::on_edittimespushbutton_clicked()
93 historydialog
* historydialog1
=new historydialog(m_parent
);
95 historydialog1
->exec();
98 void EditTaskDialog::on_autotrackinggroupbox_clicked()
100 for ( int i
= 0; i
< desktopcheckboxes
.count(); i
++ )
101 desktopcheckboxes
[i
]->setEnabled(m_ui
->autotrackinggroupbox
->isChecked());