118 void PagePlayDemo::renameRecord() |
118 void PagePlayDemo::renameRecord() |
119 { |
119 { |
120 QListWidgetItem * curritem = DemosList->currentItem(); |
120 QListWidgetItem * curritem = DemosList->currentItem(); |
121 if (!curritem) |
121 if (!curritem) |
122 { |
122 { |
123 QMessageBox::critical(this, |
123 QMessageBox recordMsg(this); |
124 tr("Error"), |
124 recordMsg.setIcon(QMessageBox::Warning); |
125 tr("Please select record from the list"), |
125 recordMsg.setWindowTitle(QMessageBox::tr("Record Play - Error")); |
126 tr("OK")); |
126 recordMsg.setText(QMessageBox::tr("Please select record from the list")); |
|
127 recordMsg.setWindowModality(Qt::WindowModal); |
|
128 recordMsg.exec(); |
127 return ; |
129 return ; |
128 } |
130 } |
129 QFile rfile(curritem->data(Qt::UserRole).toString()); |
131 QFile rfile(curritem->data(Qt::UserRole).toString()); |
130 |
132 |
131 QFileInfo finfo(rfile); |
133 QFileInfo finfo(rfile); |
142 .arg(*cProtoVer) |
144 .arg(*cProtoVer) |
143 .arg(finfo.suffix()); |
145 .arg(finfo.suffix()); |
144 |
146 |
145 ok = rfile.rename(newfullname); |
147 ok = rfile.rename(newfullname); |
146 if(!ok) |
148 if(!ok) |
147 QMessageBox::critical(this, tr("Error"), tr("Cannot rename to") + newfullname); |
149 { |
|
150 QMessageBox renameMsg(this); |
|
151 renameMsg.setIcon(QMessageBox::Warning); |
|
152 renameMsg.setWindowTitle(QMessageBox::tr("Record Play - Error")); |
|
153 renameMsg.setText(QMessageBox::tr("Cannot rename to ") + newfullname); |
|
154 renameMsg.setWindowModality(Qt::WindowModal); |
|
155 renameMsg.exec(); |
|
156 } |
148 else |
157 else |
149 FillFromDir(recType); |
158 FillFromDir(recType); |
150 } |
159 } |
151 } |
160 } |
152 |
161 |
153 void PagePlayDemo::removeRecord() |
162 void PagePlayDemo::removeRecord() |
154 { |
163 { |
155 QListWidgetItem * curritem = DemosList->currentItem(); |
164 QListWidgetItem * curritem = DemosList->currentItem(); |
156 if (!curritem) |
165 if (!curritem) |
157 { |
166 { |
158 QMessageBox::critical(this, |
167 QMessageBox recordMsg(this); |
159 tr("Error"), |
168 recordMsg.setIcon(QMessageBox::Warning); |
160 tr("Please select record from the list"), |
169 recordMsg.setWindowTitle(QMessageBox::tr("Record Play - Error")); |
161 tr("OK")); |
170 recordMsg.setText(QMessageBox::tr("Please select record from the list")); |
|
171 recordMsg.setWindowModality(Qt::WindowModal); |
|
172 recordMsg.exec(); |
162 return ; |
173 return ; |
163 } |
174 } |
164 QFile rfile(curritem->data(Qt::UserRole).toString()); |
175 QFile rfile(curritem->data(Qt::UserRole).toString()); |
165 |
176 |
166 bool ok; |
177 bool ok; |
167 |
178 |
168 ok = rfile.remove(); |
179 ok = rfile.remove(); |
169 if(!ok) |
180 if(!ok) |
170 QMessageBox::critical(this, tr("Error"), tr("Cannot delete file")); |
181 { |
|
182 QMessageBox removeMsg(this); |
|
183 removeMsg.setIcon(QMessageBox::Warning); |
|
184 removeMsg.setWindowTitle(QMessageBox::tr("Record Play - Error")); |
|
185 removeMsg.setText(QMessageBox::tr("Cannot delete file ") + rfile.fileName()); |
|
186 removeMsg.setWindowModality(Qt::WindowModal); |
|
187 removeMsg.exec(); |
|
188 } |
171 else |
189 else |
172 { |
190 { |
173 int i = DemosList->row(curritem); |
191 int i = DemosList->row(curritem); |
174 delete curritem; |
192 delete curritem; |
175 DemosList->setCurrentRow(i < DemosList->count() ? i : DemosList->count() - 1); |
193 DemosList->setCurrentRow(i < DemosList->count() ? i : DemosList->count() - 1); |