+
+
+void FileOperator::addBarToLayout(ProgressBar *bar) {
+ switch (opList.size()) {
+ case 0:
+ case 1:
+ case 2:
+ topRow->addWidget(bar);
+ break;
+ case 4:
+ topRow->addItem(bottomRow->takeAt(0));
+ bottomRow->addWidget(bar);
+ break;
+ case 3:
+ bottomRow->addItem(topRow->takeAt(2));
+ default:
+ bottomRow->addWidget(bar);
+ }
+}
+
+
+void FileOperator::removeBarFromLayout(ProgressBar *bar) {
+ int index = topRow->indexOf(bar);
+ if (index != -1) {
+ topRow->takeAt(index);
+ switch (opList.size()) {
+ case 4:
+ topRow->addItem(bottomRow->takeAt(0));
+ case 6:
+ topRow->addItem(bottomRow->takeAt(0));
+ break;
+ }
+ } else {
+ bottomRow->removeWidget(bar);
+ switch (opList.size()) {
+ case 4:
+ topRow->addItem(bottomRow->takeAt(0));
+ break;
+ case 5:
+ bottomRow->insertWidget(0, topRow->takeAt(2)->widget());
+ }
+ }
+}
+
+
+bool FileOperator::checkMaxOpsNumber() {
+ if (opList.size() == 6) {
+ QMaemo5InformationBox::information(this, tr("The maximum number of file operations is %1.").arg(6));
+ return true;
+ }
+ return false;
+}