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

bool TargetPath::processPage (  )  [virtual]

Reads the settings from the page.

Returns:
true if everything's ok, and the user can go to the next page, otherwise returns false.

Implements WizardPageBase.

Definition at line 78 of file targetpath.cpp.

References checkAndCreateDir(), OptionType::galleryFile, OptionType::GenerateThumbnails, OptionType::imageDestDir, KalleryGlobals::options, KalleryGlobals::ref(), OptionType::relativePaths, KalleryGlobals::setProjectBaseDir(), OptionType::thumbDestDir, and OptionType::thumbSetting.

{
  /*Read the directory and file strings from the edit boxes*/
  KalleryGlobals::ref()->options.galleryFile = GalleryText->text();
  QString baseDir = QFileInfo(KalleryGlobals::ref()->options.galleryFile).dirPath() + "/";

  QString s = QDir::cleanDirPath(ThumbDirText->text());
  if (!s.startsWith("/"))
  {
    s.prepend(baseDir + "/");
  } 
  KalleryGlobals::ref()->options.thumbDestDir = s + "/";
  s = QDir::cleanDirPath(ImageDirText->text());
  if (!s.startsWith("/"))
  {
    s.prepend(baseDir + "/");
  } 
  KalleryGlobals::ref()->options.imageDestDir = s + "/";
  KalleryGlobals::ref()->setProjectBaseDir(baseDir);

  if ( (KalleryGlobals::ref()->options.thumbSetting == OptionType::GenerateThumbnails) && (KalleryGlobals::ref()->options.thumbDestDir == KalleryGlobals::ref()->options.imageDestDir) )
  {
    KMessageBox::error(this, i18n("The fullsize image and thumbnail destination directory cannot be the same!"), i18n("Error"));
    return false;
  }

  /*Create the missing directories and set the relative paths if needed */

  if ( !checkAndCreateDir(KalleryGlobals::ref()->projectBaseDir()) ||
       !checkAndCreateDir(KalleryGlobals::ref()->options.imageDestDir) ||
        ( (KalleryGlobals::ref()->options.thumbSetting == OptionType::GenerateThumbnails) && (!checkAndCreateDir(KalleryGlobals::ref()->options.thumbDestDir)) )||
        (KalleryGlobals::ref()->options.galleryFile == "") )
  {
    KMessageBox::error(this,i18n("The directories are invalid, or there is no gallery file specified!\n")+
                             i18n("Check them and try again."),i18n("Error"));
    return false;
  }

  KalleryGlobals::ref()->options.relativePaths = !AbsolutePaths->isChecked();

  return true;
}


Generated by  Doxygen 1.6.0   Back to index