Logo Search packages:      
Sourcecode: ultracopier version File versions  Download package

int Main_window::errorManagement ( int  ButtonActivated,
const QString &  fileOrDir,
const QString &  errorMessage = tr("Unkown error") 
) [private]

Open window error management.

Parameters:
ButtonActivatedChoise the button activated, see env.h
fileOrDirWhat file or folder is the subject of this error
errorMessageThe error message
Returns:
Return the action code, see env.h
See also:
env.h

For store the action requested

See also:
env.h

< on the Error Window

Definition at line 2113 of file Mwindow.cpp.

References actionInDialog, aErrorHasOccurred, cancel_copy_window(), ErrorWindow::error(), ErrorWindow::file(), GetAction(), numberOfFilePutAtTheEnd, OrderUpdateStyle(), ErrorWindow::setButtonActivated(), and UpdateStyle().

Referenced by copyThreadError(), and writeThreadError().

{
      /** \brief For store the action requested
      \see env.h */
      aErrorHasOccurred=true;
      switch(comboBox_copyErrors->currentIndex())
      {
            DEBUGCONSOLE(90,"Main_window::errorManagement","ButtonActivated="+QString::number(ButtonActivated));
            case COMBO_ERROR_ASK:
            {
                  ErrorWindow *TheFileWindow;         ///< on the Error Window
                  TheFileWindow = new ErrorWindow(this);
                  connect(TheFileWindow, SIGNAL(ActionClicked(int)), this, SLOT(GetAction(int)));
                  connect(this, SIGNAL(OrderUpdateStyle()), TheFileWindow, SLOT(UpdateStyle()));
                  TheFileWindow->file(fileOrDir);
                  TheFileWindow->error(errorMessage);
                  TheFileWindow->setButtonActivated(ButtonActivated);
                  //default action if window is close for example
                  actionInDialog=FILEEXIST_CANCEL;
                  TheFileWindow->exec();
                  disconnect(TheFileWindow, SIGNAL(ActionClicked(int)));
                  disconnect(TheFileWindow, SLOT(UpdateStyle()));
                  delete TheFileWindow;
                  switch(actionInDialog)
                  {
                        case UC_ERROR_RETRY:
                              DEBUGCONSOLE(50,"Main_window::errorManagement","Action returned: ERRORACTION_RETRY");
                              return ERRORACTION_RETRY;
                        break;
                        case UC_ERROR_SKIP_ALL:
                              if(ButtonActivated!=ERROR_DEF_NOSKIPNOENDOF)
                                    comboBox_copyErrors->setCurrentIndex(COMBO_ERROR_SKIP);
                              else
                              {
                                    DEBUGCONSOLE(10,"Main_window::errorManagement","internal error, the button ERROR_SKIP_ALL is disabled, then it can be clicked!");
                              }
                        case UC_ERROR_SKIP:
                              if(ButtonActivated!=ERROR_DEF_NOSKIPNOENDOF)
                              {
                                    DEBUGCONSOLE(50,"Main_window::errorManagement","Action returned: ERRORACTION_SKIP");
                                    return ERRORACTION_SKIP;
                              }
                              else
                              {
                                    DEBUGCONSOLE(10,"Main_window::errorManagement","internal error, the button ERROR_SKIP is disabled, then it can be clicked!");
                              }
                        break;
                        case UC_ERROR_ENDOFLIST_ALL:
                              if(ButtonActivated!=ERROR_DEF_NOSKIPNOENDOF && ButtonActivated!=ERROR_DEF_NOENDOF)
                              {
                                    comboBox_copyErrors->setCurrentIndex(COMBO_ERROR_ATEND);
                              }
                              else
                              {
                                    DEBUGCONSOLE(10,"Main_window::errorManagement","internal error, the button ERROR_ENDOFLIST_ALL is disabled, then it can be clicked!");
                              }
                        case UC_ERROR_ENDOFLIST:
                              if(ButtonActivated!=ERROR_DEF_NOSKIPNOENDOF && ButtonActivated!=ERROR_DEF_NOENDOF)
                              {
                                    DEBUGCONSOLE(50,"Main_window::errorManagement","Action returned: ERRORACTION_ENDOF");
                                    return ERRORACTION_ENDOF;
                              }
                              else
                              {
                                    DEBUGCONSOLE(10,"Main_window::errorManagement","internal error, the button ERROR_ENDOFLIST is disabled, then it can be clicked!");
                              }
                        break;
                        case UC_ERROR_CANCEL:
                              cancel_copy_window();
                              DEBUGCONSOLE(50,"Main_window::errorManagement","Action returned: ERRORACTION_CLOSE");
                              return ERRORACTION_CLOSE;
                        break;
                  }
            }
            break;
            case COMBO_ERROR_SKIP:
                  if(ButtonActivated!=ERROR_DEF_NOSKIPNOENDOF)
                  {
                        DEBUGCONSOLE(50,"Main_window::errorManagement","Action returned: ERRORACTION_SKIP");
                        return ERRORACTION_SKIP;
                  }
                  else
                  {
                        comboBox_copyErrors->setCurrentIndex(COMBO_ERROR_ASK);
                        int tempr=errorManagement(ButtonActivated,fileOrDir,errorMessage);
                        DEBUGCONSOLE(50,"Main_window::errorManagement","Action returned: "+QString::number(tempr));
                        return tempr;
                  }
            break;
            case COMBO_ERROR_ATEND:
                  if(ButtonActivated!=ERROR_DEF_NOSKIPNOENDOF && ButtonActivated!=ERROR_DEF_NOENDOF)
                  {
                        numberOfFilePutAtTheEnd++;
                        if(CopyList->topLevelItemCount()<(numberOfFilePutAtTheEnd)+2)
                        {
                              numberOfFilePutAtTheEnd=0;
                              comboBox_copyErrors->setCurrentIndex(COMBO_ERROR_ASK);
                              DEBUGCONSOLE(90,"Main_window::errorManagement","Action returned: ERRORACTION_RETRY");
                              return ERRORACTION_RETRY;
                        }
                        else
                        {
                              DEBUGCONSOLE(50,"Main_window::errorManagement","Action returned: ERRORACTION_ENDOF");
                              return ERRORACTION_ENDOF;
                        }
                  }
                  else
                  {
                        comboBox_copyErrors->setCurrentIndex(COMBO_ERROR_ASK);
                        int tempr=errorManagement(ButtonActivated,fileOrDir,errorMessage);
                        DEBUGCONSOLE(50,"Main_window::errorManagement","Action returned: "+QString::number(tempr));
                        return tempr;
                  }
            break;
            default:
                  DEBUGCONSOLE(10,"Main_window::errorManagement","internal error, the number sould not be "+QString::number(comboBox_copyErrors->currentIndex())+"!");
            break;
      }
      DEBUGCONSOLE(10,"Main_window::errorManagement","internal error, out of switch!");
      return ERRORACTION_SKIP;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index