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

bool KalleryFunctions::saveProject ( const QString &  projectFileName  ) 

Saves the project in a file.

Parameters:
projectFileName points to the project file
Returns:
true in case of success, false in case of failure

Definition at line 237 of file kalleryfunctions.cpp.

References OptionType::afterHtmlFile, OptionType::backColor, OptionType::backPic, OptionType::backStr, OptionType::beforeHtmlFile, OptionType::columnNum, OptionType::convertImages, OptionType::copyright, OptionType::descFile, OptionType::descSetting, OptionType::encoding, OptionType::fullFormat, OptionType::fullHeight, OptionType::fullsizeTemplate, OptionType::fullWidth, OptionType::galleryCSSFile, OptionType::galleryFile, OptionType::galleryTemplate, OptionType::galleryTitle, OptionType::imageBackColor, OptionType::imageCSSFile, OptionType::imageDestDir, OptionType::imageList, OptionType::imageTextColor, OptionType::imageVisitedColor, OptionType::infoSetting, OptionType::insertCopyright, OptionType::keepRatio, OptionType::language, mainWidget, OptionType::nextPic, OptionType::nextStr, OptionType::onlyLarger, KalleryGlobals::options, OptionType::prevPic, OptionType::prevStr, OptionType::projectFileName, OptionType::quality, KalleryGlobals::ref(), OptionType::relativePaths, OptionType::resize, OptionType::tableColor, OptionType::textButtons, OptionType::textColor, OptionType::thumbDestDir, OptionType::thumbFormat, OptionType::thumbHeight, OptionType::thumbList, OptionType::thumbSetting, OptionType::thumbWidth, OptionType::useHtmlImages, and OptionType::visitedColor.

Referenced by Kallery::accept().

{  
  QFile projectFile;
  KSimpleConfig *config;
  OptionType options = KalleryGlobals::ref()->options;

  projectFile.setName(projectFileName);

  if (! projectFile.open(IO_WriteOnly))
  {
    KMessageBox::error(mainWidget,i18n("Cannot create the project file %1.\nSelect another file and try again.").arg(projectFileName),i18n("Error"));
    return false;
  }
  projectFile.close();

  //Here comes the real Save, using the KSimpleConfig class
  config = new KSimpleConfig(projectFileName,false);
  config->setGroup("General");
  config->writeEntry("Encoding",options.encoding);
  config->writeEntry("RelativePaths",options.relativePaths);
  config->writeEntry("kallery_version","Project_Format_1");
  options.projectFileName = projectFileName;
  config->writeEntry("ProjectName",QFileInfo(options.projectFileName).fileName());

  config->setGroup("Gallery");
  config->writeEntry("GalleryTitle",options.galleryTitle);
  config->writeEntry("GalleryFile",options.galleryFile);
  config->writeEntry("ImageDestDir",options.imageDestDir);
  config->writeEntry("ThumbDestDir",options.thumbDestDir);
  config->writeEntry("Language",options.language);

  config->setGroup("Thumbnails");
  config->writeEntry("ThumbSetting",options.thumbSetting);

  config->writeEntry("ThumbWidth",options.thumbWidth);
  config->writeEntry("ThumbHeight",options.thumbHeight);
  config->writeEntry("ThumbFormat",options.thumbFormat);
  config->writeEntry("ThumbList",options.thumbList);

  config->setGroup("Images");
  config->writeEntry("ConvertImages",options.convertImages);
  config->writeEntry("KeepRatio",options.keepRatio);
  config->writeEntry("OnlyLarger", options.onlyLarger);
  config->writeEntry("Resize",options.resize);
  config->writeEntry("FullWidth",options.fullWidth);
  config->writeEntry("FullHeight",options.fullHeight);
  config->writeEntry("InsertCopyright",options.insertCopyright);
  config->writeEntry("Copyright",options.copyright);
  config->writeEntry("FullFormat",options.fullFormat);
  config->writeEntry("Quality",options.quality);
  config->writeEntry("ImageList",options.imageList);

  config->setGroup("HTML options");
  config->writeEntry("ColumnNum",options.columnNum);
  config->writeEntry("UseHtmlImages",options.useHtmlImages);
  config->writeEntry("TextButtons",options.textButtons);
  config->writeEntry("NextStr",options.nextStr);
  config->writeEntry("PrevStr",options.prevStr);
  config->writeEntry("BackStr",options.backStr);
  config->writeEntry("NextPic",options.nextPic);
  config->writeEntry("PrevPic",options.prevPic);
  config->writeEntry("BackPic",options.backPic);
  config->writeEntry("BackColor",options.backColor.name());
  config->writeEntry("TableColor",options.tableColor.name());
  config->writeEntry("TextColor",options.textColor.name());
  config->writeEntry("VisitedColor",options.visitedColor.name());
  config->writeEntry("ImageBackColor",options.imageBackColor.name());
  config->writeEntry("ImageTextColor",options.imageTextColor.name());
  config->writeEntry("ImageVisitedColor",options.imageVisitedColor.name());
  config->writeEntry("FullsizeTemplate",options.fullsizeTemplate);
  config->writeEntry("GalleryTemplate",options.galleryTemplate);
  config->writeEntry("GalleryCSSFile",options.galleryCSSFile);
  config->writeEntry("BeforeHtmlFile",options.beforeHtmlFile);
  config->writeEntry("AfterHtmlFile",options.afterHtmlFile);
  config->writeEntry("ImageCSSFile",options.imageCSSFile);

  config->setGroup("Descriptions");
  KalleryGlobals::ref()->options.descFile = QFileInfo(options.projectFileName).baseName()+".descriptions";
  config->writeEntry("DescFile", KalleryGlobals::ref()->options.descFile);
  config->writeEntry("DescSetting",options.descSetting);
  config->writeEntry("InfoSetting", options.infoSetting); 

  config->sync();
  delete config;

  return true;
}


Generated by  Doxygen 1.6.0   Back to index