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

void DCOptions::slotSave (  )  [private, slot]

Definition at line 362 of file dcoptions.cpp.

Referenced by InitDocument().

{
      int tcpport, udpport;
      bool ok;

      // check if mode change
      if ( ((RadioButton_ACTIVEMODE->isOn() == TRUE) && (g_pConfig->GetMode(TRUE) == ecmPASSIVE)) ||
           ((RadioButton_ACTIVEMODE->isOn() == FALSE) && (g_pConfig->GetMode(TRUE) == ecmACTIVE)) )
      {
            QMessageBox::warning( 0, "Valknut",
                  QString(tr("You changed the client mode! Please restart Valknut!")));
      }

      if ( LineEdit_DOWNLOADFOLDER->text() == "" )
      {
            QMessageBox::critical( 0, "Valknut",
            QString(tr("You must set a Download Folder!")));
            return;
      }

      if ( LineEdit_DOWNLOADFINISHEDFOLDER->text() == LineEdit_DOWNLOADFOLDER->text() )
      {
            QMessageBox::critical( 0, "Valknut",
            QString(tr("Download Finished Folder and Download Folder must be different!")));
            return;
      }

      // check active mode settings
      if ( RadioButton_ACTIVEMODE->isOn() == TRUE )
      {
            // check fake host
            if ( (RadioButton_IPHOSTNAME->isOn() == TRUE) &&
                 (LineEdit_IP->text() == "") )

            {
                  QMessageBox::critical( 0, "Valknut",
                  QString(tr("You must enter a valid 'Fake Host'!")));
                  return;
            }

            // check interface
            if ( (RadioButton_INTERFACE->isOn() == TRUE) &&
                 (LineEdit_IP->text() == "") )

            {
                  QMessageBox::critical( 0, "Valknut",
                  QString(tr("You must enter a valid interface!")));
                  return;
            }

            // check ports
            tcpport = LineEdit_TCPLISTENPORT->text().toInt(&ok);

            if ( (ok == FALSE) || (tcpport == 0) )
            {
                  QMessageBox::critical( 0, "Valknut",
                  QString(tr("You must enter a valid tcp listen port!")));
                  return;
            }

            udpport = LineEdit_UDPLISTENPORT->text().toInt(&ok);

            if ( (ok == FALSE) || (udpport == 0) )
            {
                  QMessageBox::critical( 0, "Valknut",
                  QString(tr("You must enter a valid udp listen port!")));
                  return;
            }

#ifndef WIN32
            if ( (tcpport < 1024) || (udpport < 1024) )
            {
                  QMessageBox::critical( 0, "Valknut",
                  QString(tr("You have set Valknut to listen on a port < 1024! You can run Valknut only as root in active mode!")));
            }
#endif
      }

      // no nick is given
      if ( LineEdit_NICK->text() == "" )
      {
            QMessageBox::critical( 0, "Valknut",
            QString(tr("You must enter a valid nick!")));
            return;
      }

      // no search nick is given
      if ( (LineEdit_SEARCHNICK->text() == "") || (LineEdit_SEARCHNICK->text() == "nick_search") )
      {
            QMessageBox::critical( 0, "Valknut",
            QString(tr("You must enter a valid search nick!")));
            return;
      }

      if (LineEdit_APPFONT->text() != "")
      {
            QFont font;
            if (font.fromString(LineEdit_APPFONT->text()) == TRUE)
            {
                  QApplication::setFont(font, TRUE);
            }
      }

      accept();
}


Generated by  Doxygen 1.6.0   Back to index