-rw-r--r-- | korganizer/kolistview.h | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index be9b09c..78004fe 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h | |||
@@ -39,12 +39,146 @@ | |||
39 | 39 | ||
40 | #include "koeventview.h" | 40 | #include "koeventview.h" |
41 | #include "customlistviewitem.h" | 41 | #include "customlistviewitem.h" |
42 | 42 | ||
43 | using namespace KCal; | 43 | using namespace KCal; |
44 | 44 | ||
45 | |||
46 | |||
47 | #include <qpushbutton.h> | ||
48 | #include <qlayout.h> | ||
49 | #include <qdialog.h> | ||
50 | #include <qcombobox.h> | ||
51 | #include <qspinbox.h> | ||
52 | #include <qtooltip.h> | ||
53 | #include <qcheckbox.h> | ||
54 | #include <qhbox.h> | ||
55 | #include <qlabel.h> | ||
56 | #include <kiconloader.h> | ||
57 | #include "kfiledialog.h" | ||
58 | #include "koprefs.h" | ||
59 | class KOAlarmPrefs : public QDialog | ||
60 | { | ||
61 | Q_OBJECT | ||
62 | public: | ||
63 | KOAlarmPrefs( QWidget *par=0, const char *name=0 ) : | ||
64 | QDialog( par, name, true ) | ||
65 | { | ||
66 | setCaption( i18n("Alarm Options") ); | ||
67 | QVBoxLayout* alarmLayout = new QVBoxLayout( this ); | ||
68 | alarmLayout->setSpacing( 3 ); | ||
69 | alarmLayout->setMargin( 3 ); | ||
70 | QWidget *parent = this; | ||
71 | mAlarmButton = new QCheckBox(i18n("Set reminder offset to:"),parent); | ||
72 | alarmLayout->addWidget(mAlarmButton); | ||
73 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; | ||
74 | mAlarmTimeEdit->setValue( 15 ); | ||
75 | alarmLayout->addWidget(mAlarmTimeEdit); | ||
76 | mAlarmIncrCombo = new QComboBox(false, parent); | ||
77 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); | ||
78 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); | ||
79 | mAlarmIncrCombo->insertItem(i18n("day(s)")); | ||
80 | alarmLayout->addWidget(mAlarmIncrCombo); | ||
81 | QHBox * hb = new QHBox ( parent ); | ||
82 | alarmLayout->addWidget(hb); | ||
83 | mAlarmSoundButton = new QPushButton(hb); | ||
84 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); | ||
85 | mAlarmSoundButton->setToggleButton(true); | ||
86 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); | ||
87 | mAlarmProgramButton = new QPushButton(hb); | ||
88 | mAlarmProgramButton->setPixmap(SmallIcon("run")); | ||
89 | mAlarmProgramButton->setToggleButton(true); | ||
90 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); | ||
91 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); | ||
92 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); | ||
93 | mAlarmLabel = new QLabel( this ); | ||
94 | alarmLayout->addWidget( mAlarmLabel ); | ||
95 | mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) ); | ||
96 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | ||
97 | mAlarmSoundButton->setOn( true ); | ||
98 | QPushButton * ok = new QPushButton( i18n("Set Alarm!"), this ); | ||
99 | alarmLayout->addWidget( ok ); | ||
100 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | ||
101 | alarmLayout->addWidget( cancel ); | ||
102 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | ||
103 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | ||
104 | resize( 200, 200 ); | ||
105 | |||
106 | } | ||
107 | |||
108 | |||
109 | |||
110 | QString mAlarmSound, mAlarmProgram ; | ||
111 | QCheckBox* mAlarmButton; | ||
112 | QSpinBox* mAlarmTimeEdit; | ||
113 | QLabel* mAlarmLabel; | ||
114 | QComboBox* mAlarmIncrCombo ; | ||
115 | QPushButton* mAlarmSoundButton ,*mAlarmProgramButton; | ||
116 | private slots: | ||
117 | |||
118 | void pickAlarmSound() | ||
119 | { | ||
120 | //QString prefix = mAlarmSound; | ||
121 | if (!mAlarmSoundButton->isOn()) { | ||
122 | //mAlarmSound = ""; | ||
123 | QToolTip::remove(mAlarmSoundButton); | ||
124 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | ||
125 | mAlarmProgramButton->setOn(true); | ||
126 | mAlarmSoundButton->setOn(false); | ||
127 | } else { | ||
128 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, | ||
129 | i18n("*.wav|Wav Files"), 0)); | ||
130 | if (!fileName.isEmpty()) { | ||
131 | mAlarmSound = fileName; | ||
132 | mAlarmLabel->setText( "..."+fileName.right( 30 ) ); | ||
133 | QToolTip::remove(mAlarmSoundButton); | ||
134 | QString dispStr = i18n("Playing '%1'").arg(fileName); | ||
135 | QToolTip::add(mAlarmSoundButton, dispStr); | ||
136 | mAlarmProgramButton->setOn(false); | ||
137 | mAlarmSoundButton->setOn(true); | ||
138 | } else { | ||
139 | mAlarmProgramButton->setOn(true); | ||
140 | mAlarmSoundButton->setOn(false); | ||
141 | |||
142 | } | ||
143 | } | ||
144 | }; | ||
145 | |||
146 | void pickAlarmProgram() | ||
147 | { | ||
148 | if (!mAlarmProgramButton->isOn()) { | ||
149 | //mAlarmProgram = ""; | ||
150 | QToolTip::remove(mAlarmProgramButton); | ||
151 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | ||
152 | mAlarmProgramButton->setOn(false); | ||
153 | mAlarmSoundButton->setOn(true); | ||
154 | } else { | ||
155 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm.: ") , 0)); | ||
156 | if (!fileName.isEmpty()) { | ||
157 | mAlarmProgram = fileName; | ||
158 | mAlarmLabel->setText( "..."+fileName.right( 30 ) ); | ||
159 | QToolTip::remove(mAlarmProgramButton); | ||
160 | QString dispStr = i18n("Running '%1'").arg(fileName); | ||
161 | QToolTip::add(mAlarmProgramButton, dispStr); | ||
162 | mAlarmSoundButton->setOn(false); | ||
163 | mAlarmProgramButton->setOn(true); | ||
164 | } else { | ||
165 | mAlarmProgramButton->setOn(false); | ||
166 | mAlarmSoundButton->setOn(true); | ||
167 | } | ||
168 | } | ||
169 | }; | ||
170 | |||
171 | }; | ||
172 | |||
173 | |||
174 | |||
175 | |||
176 | |||
177 | |||
178 | |||
45 | typedef CustomListViewItem<Incidence *> KOListViewItem; | 179 | typedef CustomListViewItem<Incidence *> KOListViewItem; |
46 | 180 | ||
47 | /** | 181 | /** |
48 | This class provides the initialisation of a KOListViewItem for calendar | 182 | This class provides the initialisation of a KOListViewItem for calendar |
49 | components using the Incidence::Visitor. | 183 | components using the Incidence::Visitor. |
50 | */ | 184 | */ |
@@ -139,12 +273,13 @@ class KOListView : public KOEventView | |||
139 | void saveToFile(); | 273 | void saveToFile(); |
140 | void saveDescriptionToFile(); | 274 | void saveDescriptionToFile(); |
141 | void beamSelected(); | 275 | void beamSelected(); |
142 | void updateConfig(); | 276 | void updateConfig(); |
143 | void addCat(); | 277 | void addCat(); |
144 | void setCat(); | 278 | void setCat(); |
279 | void setAlarm(); | ||
145 | void setCategories( bool removeOld ); | 280 | void setCategories( bool removeOld ); |
146 | void changeEventDisplay(Event *, int); | 281 | void changeEventDisplay(Event *, int); |
147 | 282 | ||
148 | void defaultItemAction(QListViewItem *item); | 283 | void defaultItemAction(QListViewItem *item); |
149 | void popupMenu(QListViewItem *item,const QPoint &,int); | 284 | void popupMenu(QListViewItem *item,const QPoint &,int); |
150 | 285 | ||