diff options
Diffstat (limited to 'src/basketfactory.cpp')
-rw-r--r-- | src/basketfactory.cpp | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/src/basketfactory.cpp b/src/basketfactory.cpp index 4006fbb..1873047 100644 --- a/src/basketfactory.cpp +++ b/src/basketfactory.cpp @@ -18,7 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qdir.h> +#include <tqdir.h> #include <klocale.h> #include <kmessagebox.h> @@ -33,16 +33,16 @@ // TODO: Don't create a basket with a name that already exists! -QString BasketFactory::newFolderName() +TQString BasketFactory::newFolderName() { - QString folderName; - QString fullPath; - QDir dir; + TQString folderName; + TQString fullPath; + TQDir dir; for (int i = 1; ; ++i) { - folderName = "basket" + QString::number(i) + "/"; + folderName = "basket" + TQString::number(i) + "/"; fullPath = Global::basketsFolder() + folderName; - dir = QDir(fullPath); + dir = TQDir(fullPath); if ( ! dir.exists() ) // OK : The folder do not yet exists : break; // We've found one ! } @@ -50,85 +50,85 @@ QString BasketFactory::newFolderName() return folderName; } -QString BasketFactory::unpackTemplate(const QString &templateName) +TQString BasketFactory::unpackTemplate(const TQString &templateName) { // Find a name for a new folder and create it: - QString folderName = newFolderName(); - QString fullPath = Global::basketsFolder() + folderName; - QDir dir; + TQString folderName = newFolderName(); + TQString fullPath = Global::basketsFolder() + folderName; + TQDir dir; if (!dir.mkdir(fullPath)) { - KMessageBox::error(/*parent=*/0, i18n("Sorry, but the folder creation for this new basket has failed."), i18n("Basket Creation Failed")); + KMessageBox::error(/*tqparent=*/0, i18n("Sorry, but the folder creation for this new basket has failed."), i18n("Basket Creation Failed")); return ""; } // Unpack the template file to that folder: // TODO: REALLY unpack (this hand-creation is temporary, or it could be used in case the template can't be found) - QFile file(fullPath + "/.basket"); + TQFile file(fullPath + "/.basket"); if (file.open(IO_WriteOnly)) { - QTextStream stream(&file); - stream.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream stream(&file); + stream.setEncoding(TQTextStream::UnicodeUTF8); int nbColumns = (templateName == "mindmap" || templateName == "free" ? 0 : templateName.left(1).toInt()); Basket *currentBasket = Global::bnpView->currentBasket(); int columnWidth = (currentBasket && nbColumns > 0 ? (currentBasket->visibleWidth() - (nbColumns-1)*Note::RESIZER_WIDTH) / nbColumns : 0); - stream << QString( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" + stream << TQString( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" "<!DOCTYPE basket>\n" "<basket>\n" " <properties>\n" " <disposition mindMap=\"%1\" columnCount=\"%2\" free=\"%3\" />\n" " </properties>\n" - " <notes>\n" ).arg( (templateName == "mindmap" ? "true" : "false"), - QString::number(nbColumns), + " <notes>\n" ).tqarg( (templateName == "mindmap" ? "true" : "false"), + TQString::number(nbColumns), (templateName == "free" || templateName == "mindmap" ? "true" : "false") ); if (nbColumns > 0) for (int i = 0; i < nbColumns; ++i) - stream << QString(" <group width=\"%1\"></group>\n").arg(columnWidth); + stream << TQString(" <group width=\"%1\"></group>\n").tqarg(columnWidth); stream << " </notes>\n" "</basket>\n"; file.close(); return folderName; } else { - KMessageBox::error(/*parent=*/0, i18n("Sorry, but the template copying for this new basket has failed."), i18n("Basket Creation Failed")); + KMessageBox::error(/*tqparent=*/0, i18n("Sorry, but the template copying for this new basket has failed."), i18n("Basket Creation Failed")); return ""; } } -void BasketFactory::newBasket(const QString &icon, - const QString &name, - const QString &backgroundImage, - const QColor &backgroundColor, - const QColor &textColor, - const QString &templateName, - Basket *parent) +void BasketFactory::newBasket(const TQString &icon, + const TQString &name, + const TQString &backgroundImage, + const TQColor &backgroundColor, + const TQColor &textColor, + const TQString &templateName, + Basket *tqparent) { // Unpack the templateName file to a new basket folder: - QString folderName = unpackTemplate(templateName); + TQString folderName = unpackTemplate(templateName); if (folderName.isEmpty()) return; // Read the properties, change those that should be customized and save the result: - QDomDocument *document = XMLWork::openFile("basket", Global::basketsFolder() + folderName + "/.basket"); + TQDomDocument *document = XMLWork::openFile("basket", Global::basketsFolder() + folderName + "/.basket"); if (!document) { - KMessageBox::error(/*parent=*/0, i18n("Sorry, but the template customization for this new basket has failed."), i18n("Basket Creation Failed")); + KMessageBox::error(/*tqparent=*/0, i18n("Sorry, but the template customization for this new basket has failed."), i18n("Basket Creation Failed")); return; } - QDomElement properties = XMLWork::getElement(document->documentElement(), "properties"); + TQDomElement properties = XMLWork::getElement(document->documentElement(), "properties"); if (!icon.isEmpty()) { - QDomElement iconElement = XMLWork::getElement(properties, "icon"); + TQDomElement iconElement = XMLWork::getElement(properties, "icon"); if (!iconElement.tagName().isEmpty()) // If there is already an icon, remove it since we will add our own value below iconElement.removeChild(iconElement.firstChild()); XMLWork::addElement(*document, properties, "icon", icon); } if (!name.isEmpty()) { - QDomElement nameElement = XMLWork::getElement(properties, "name"); + TQDomElement nameElement = XMLWork::getElement(properties, "name"); if (!nameElement.tagName().isEmpty()) // If there is already a name, remove it since we will add our own value below nameElement.removeChild(nameElement.firstChild()); XMLWork::addElement(*document, properties, "name", name); } if (backgroundColor.isValid()) { - QDomElement appearanceElement = XMLWork::getElement(properties, "appearance"); + TQDomElement appearanceElement = XMLWork::getElement(properties, "appearance"); if (appearanceElement.tagName().isEmpty()) { // If there is not already an appearance tag, add it since we will access it below appearanceElement = document->createElement("appearance"); properties.appendChild(appearanceElement); @@ -137,7 +137,7 @@ void BasketFactory::newBasket(const QString &icon, } if (!backgroundImage.isEmpty()) { - QDomElement appearanceElement = XMLWork::getElement(properties, "appearance"); + TQDomElement appearanceElement = XMLWork::getElement(properties, "appearance"); if (appearanceElement.tagName().isEmpty()) { // If there is not already an appearance tag, add it since we will access it below appearanceElement = document->createElement("appearance"); properties.appendChild(appearanceElement); @@ -146,7 +146,7 @@ void BasketFactory::newBasket(const QString &icon, } if (textColor.isValid()) { - QDomElement appearanceElement = XMLWork::getElement(properties, "appearance"); + TQDomElement appearanceElement = XMLWork::getElement(properties, "appearance"); if (appearanceElement.tagName().isEmpty()) { // If there is not already an appearance tag, add it since we will access it below appearanceElement = document->createElement("appearance"); properties.appendChild(appearanceElement); @@ -154,6 +154,6 @@ void BasketFactory::newBasket(const QString &icon, appearanceElement.setAttribute("textColor", textColor.name()); } - // Load it in the parent basket (it will save the tree and switch to this new basket): - Global::bnpView->loadNewBasket(folderName, properties, parent); + // Load it in the tqparent basket (it will save the tree and switch to this new basket): + Global::bnpView->loadNewBasket(folderName, properties, tqparent); } |