Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Public Slots | Public Member Functions
MenuSAT Class Reference

#include <satemplate.h>

List of all members.

Public Slots

void RunSATPlug (ScribusDoc *)

Public Member Functions

 MenuSAT ()
 ~MenuSAT ()

Detailed Description

Definition at line 43 of file satemplate.h.


Constructor & Destructor Documentation

MenuSAT::MenuSAT ( ) [inline]

Definition at line 48 of file satemplate.h.

{};
MenuSAT::~MenuSAT ( ) [inline]

Definition at line 49 of file satemplate.h.

{};

Member Function Documentation

void MenuSAT::RunSATPlug ( ScribusDoc *  doc) [slot]

Definition at line 113 of file satemplate.cpp.

{
       QDir templates(ScPaths::getApplicationDataDir());
       if (!templates.exists("templates"))
       {
              templates.mkdir("templates");
       }
       QString currentDirPath = QDir::currentDirPath();
       QString currentFile = doc->DocName;
       bool hasName = doc->hasName;
       bool isModified = doc->isModified();
       QString userTemplatesDir = PrefsManager::instance()->appPrefs.documentTemplatesDir;
       PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
       QString oldCollect = dirs->get("collect", ".");
       QString templatesDir = ".";
       if (userTemplatesDir.isEmpty())
              templatesDir = ScPaths::getApplicationDataDir() + "templates";
       else
       {
              if (userTemplatesDir.right(1) == "/")
                     userTemplatesDir = userTemplatesDir.left(userTemplatesDir.length() - 1);
              templatesDir = userTemplatesDir;
       }
       dirs->set("collect", templatesDir);
       if (doc->scMW()->Collect().isEmpty())
              return;
       if (oldCollect != ".")
              dirs->set("collect", oldCollect);
       QString docPath = doc->DocName;
       QString docDir = docPath.left(docPath.findRev('/'));
       QString docName = docPath.right(docPath.length() - docPath.findRev('/') - 1);
       docName = docName.left(docName.findRev(".s"));

       if (currentFile !=  doc->DocName)
       {
              satdialog* satdia = new satdialog(doc->scMW(),docName,
                                          static_cast<int>(doc->pageWidth + 0.5),
                                          static_cast<int>(doc->pageHeight + 0.5));
              if (satdia->exec())
              {
                     sat* s = new sat(doc, satdia, docPath.right(docPath.length() - docPath.findRev('/') - 1),docDir);
                     s->createImages();
                     s->createTmplXml();
                     delete s;
              }
              // Restore the state that was before ScMW->Collect()
              doc->DocName = currentFile;
              doc->hasName = hasName;
              doc->setModified(isModified);
              QString newCaption=currentFile;
              if (isModified)
                     newCaption.append('*');
              doc->scMW()->updateActiveWindowCaption(newCaption);
              doc->scMW()->removeRecent(docPath);
              QDir::setCurrent(currentDirPath);
              delete satdia;
       }
}

Here is the call graph for this function:


The documentation for this class was generated from the following files: