summaryrefslogtreecommitdiffstats
path: root/src/notefactory.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-17 08:20:48 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-17 08:20:48 +0000
commitaa0726b20f398264f0a2abc60215be044b106f9c (patch)
tree070fdbc19a1106cfdd7f651a8ce76bb1b89a513d /src/notefactory.cpp
parentd3cf5b3e75aadc3b02d0b56f030d4c3f8c2c749d (diff)
downloadbasket-aa0726b20f398264f0a2abc60215be044b106f9c.tar.gz
basket-aa0726b20f398264f0a2abc60215be044b106f9c.zip
TQt4 port basket
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/notefactory.cpp')
-rw-r--r--src/notefactory.cpp522
1 files changed, 261 insertions, 261 deletions
diff --git a/src/notefactory.cpp b/src/notefactory.cpp
index 30efc28..91b9a2a 100644
--- a/src/notefactory.cpp
+++ b/src/notefactory.cpp
@@ -18,30 +18,30 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include <qstring.h>
+#include <tqstring.h>
#include <kurl.h>
-#include <qpixmap.h>
-#include <qcolor.h>
-#include <qregexp.h>
+#include <tqpixmap.h>
+#include <tqcolor.h>
+#include <tqregexp.h>
#include <kcolordrag.h>
#include <kurldrag.h>
-#include <qstylesheet.h>
-#include <qdir.h>
+#include <tqstylesheet.h>
+#include <tqdir.h>
#include <kmimetype.h>
#include <kmessagebox.h>
#include <klocale.h>
#include <kdesktopfile.h>
#include <kapplication.h>
#include <kaboutdata.h>
-#include <qfile.h>
+#include <tqfile.h>
#include <kfilemetainfo.h>
#include <kio/jobclasses.h>
-#include <qtextcodec.h>
+#include <tqtextcodec.h>
#include <kopenwith.h>
#include <kfiledialog.h>
#include <kicondialog.h>
#include <kiconloader.h>
-#include <qfileinfo.h>
+#include <tqfileinfo.h>
#include <kpopupmenu.h>
#include <kstandarddirs.h>
#include <kurifilter.h>
@@ -63,73 +63,73 @@
/** Create notes from scratch (just a content) */
-Note* NoteFactory::createNoteText(const QString &text, Basket *parent, bool reallyPlainText/* = false*/)
+Note* NoteFactory::createNoteText(const TQString &text, Basket *tqparent, bool reallyPlainText/* = false*/)
{
- Note *note = new Note(parent);
+ Note *note = new Note(tqparent);
if (reallyPlainText) {
- TextContent *content = new TextContent(note, createFileForNewNote(parent, "txt"));
+ TextContent *content = new TextContent(note, createFileForNewNote(tqparent, "txt"));
content->setText(text);
content->saveToFile();
} else {
- HtmlContent *content = new HtmlContent(note, createFileForNewNote(parent, "html"));
- QString html = "<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>" + Tools::textToHTMLWithoutP(text) + "</body></html>";
+ HtmlContent *content = new HtmlContent(note, createFileForNewNote(tqparent, "html"));
+ TQString html = "<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>" + Tools::textToHTMLWithoutP(text) + "</body></html>";
content->setHtml(html);
content->saveToFile();
}
return note;
}
-Note* NoteFactory::createNoteHtml(const QString &html, Basket *parent)
+Note* NoteFactory::createNoteHtml(const TQString &html, Basket *tqparent)
{
- Note *note = new Note(parent);
- HtmlContent *content = new HtmlContent(note, createFileForNewNote(parent, "html"));
+ Note *note = new Note(tqparent);
+ HtmlContent *content = new HtmlContent(note, createFileForNewNote(tqparent, "html"));
content->setHtml(html);
content->saveToFile();
return note;
}
-Note* NoteFactory::createNoteLink(const KURL &url, Basket *parent)
+Note* NoteFactory::createNoteLink(const KURL &url, Basket *tqparent)
{
- Note *note = new Note(parent);
+ Note *note = new Note(tqparent);
new LinkContent(note, url, titleForURL(url), iconForURL(url), /*autoTitle=*/true, /*autoIcon=*/true);
return note;
}
-Note* NoteFactory::createNoteLink(const KURL &url, const QString &title, Basket *parent)
+Note* NoteFactory::createNoteLink(const KURL &url, const TQString &title, Basket *tqparent)
{
- Note *note = new Note(parent);
+ Note *note = new Note(tqparent);
new LinkContent(note, url, title, iconForURL(url), /*autoTitle=*/false, /*autoIcon=*/true);
return note;
}
-Note* NoteFactory::createNoteImage(const QPixmap &image, Basket *parent)
+Note* NoteFactory::createNoteImage(const TQPixmap &image, Basket *tqparent)
{
- Note *note = new Note(parent);
- ImageContent *content = new ImageContent(note, createFileForNewNote(parent, "png"));
+ Note *note = new Note(tqparent);
+ ImageContent *content = new ImageContent(note, createFileForNewNote(tqparent, "png"));
content->setPixmap(image);
content->saveToFile();
return note;
}
-Note* NoteFactory::createNoteColor(const QColor &color, Basket *parent)
+Note* NoteFactory::createNoteColor(const TQColor &color, Basket *tqparent)
{
- Note *note = new Note(parent);
+ Note *note = new Note(tqparent);
new ColorContent(note, color);
return note;
}
/** Return a string list containing {url1, title1, url2, title2, url3, title3...}
*/
-QStringList NoteFactory::textToURLList(const QString &text)
+TQStringList NoteFactory::textToURLList(const TQString &text)
{
// List to return:
- QStringList list;
+ TQStringList list;
// Split lines:
- QStringList texts = QStringList::split('\n', text);
+ TQStringList texts = TQStringList::split('\n', text);
// For each lines:
- QStringList::iterator it;
+ TQStringList::iterator it;
for (it = texts.begin(); it != texts.end(); ++it) {
// Strip white spaces:
(*it) = (*it).stripWhiteSpace();
@@ -139,11 +139,11 @@ QStringList NoteFactory::textToURLList(const QString &text)
continue;
// Compute lower case equivalent:
- QString ltext = (*it).lower();
+ TQString ltext = (*it).lower();
/* Search for mail address ("*@*.*" ; "*" can contain '_', '-', or '.') and add protocol to it */
- QString mailExpString = "[\\w-\\.]+@[\\w-\\.]+\\.[\\w]+";
- QRegExp mailExp("^"+mailExpString+"$");
+ TQString mailExpString = "[\\w-\\.]+@[\\w-\\.]+\\.[\\w]+";
+ TQRegExp mailExp("^"+mailExpString+"$");
if (mailExp.search(ltext) != -1) {
ltext.insert(0, "mailto:");
(*it).insert(0, "mailto:");
@@ -153,11 +153,11 @@ QStringList NoteFactory::textToURLList(const QString &text)
// TODO: Replace " at " by "@" and " dot " by "." to look for e-mail addresses
/* Search for mail address like "Name <address@provider.net>" */
- QRegExp namedMailExp("^([\\w\\s]+)\\s<("+mailExpString+")>$");
+ TQRegExp namedMailExp("^([\\w\\s]+)\\s<("+mailExpString+")>$");
//namedMailExp.setCaseSensitive(true); // For the name to be keeped with uppercases // DOESN'T WORK !
if (namedMailExp.search(ltext) != -1) {
- QString name = namedMailExp.cap(1);
- QString address = "mailto:" + namedMailExp.cap(2);
+ TQString name = namedMailExp.cap(1);
+ TQString address = "mailto:" + namedMailExp.cap(2);
// Threat it NOW, as it's an exception (it have a title):
list.append(address);
list.append(name);
@@ -186,34 +186,34 @@ QStringList NoteFactory::textToURLList(const QString &text)
list.append(*it);
list.append(""); // We don't have any title
} else
- return QStringList(); // FAILED: treat the text as a text, and not as a URL list!
+ return TQStringList(); // FAILED: treat the text as a text, and not as a URL list!
}
return list;
}
-Note* NoteFactory::createNoteFromText(const QString &text, Basket *parent)
+Note* NoteFactory::createNoteFromText(const TQString &text, Basket *tqparent)
{
/* Search for a color (#RGB , #RRGGBB , #RRRGGGBBB , #RRRRGGGGBBBB) and create a color note */
- QRegExp exp("^#(?:[a-fA-F\\d]{3}){1,4}$");
+ TQRegExp exp("^#(?:[a-fA-F\\d]{3}){1,4}$");
if ( exp.search(text) != -1 )
- return createNoteColor(QColor(text), parent);
+ return createNoteColor(TQColor(text), tqparent);
/* Try to convert the text as a URL or a list of URLs */
- QStringList uriList = textToURLList(text);
+ TQStringList uriList = textToURLList(text);
if ( ! uriList.isEmpty() ) {
// TODO: This code is almost duplicated from fropURLs()!
Note *note;
Note *firstNote = 0;
Note *lastInserted = 0;
- QStringList::iterator it;
+ TQStringList::iterator it;
for (it = uriList.begin(); it != uriList.end(); ++it) {
- QString url = (*it);
+ TQString url = (*it);
++it;
- QString title = (*it);
+ TQString title = (*it);
if (title.isEmpty())
- note = createNoteLinkOrLauncher(KURL(url), parent);
+ note = createNoteLinkOrLauncher(KURL(url), tqparent);
else
- note = createNoteLink(KURL(url), title, parent);
+ note = createNoteLink(KURL(url), title, tqparent);
// If we got a new note, insert it in a linked list (we will return the first note of that list):
if (note) {
@@ -231,55 +231,55 @@ Note* NoteFactory::createNoteFromText(const QString &text, Basket *parent)
return firstNote; // It don't return ALL inserted notes !
}
- //QString newText = text.stripWhiteSpace(); // The text for a new note, without useless spaces
+ //TQString newText = text.stripWhiteSpace(); // The text for a new note, without useless spaces
/* Else, it's a text or an HTML note, so, create it */
- if (QStyleSheet::mightBeRichText(/*newT*/text))
- return createNoteHtml(/*newT*/text, parent);
+ if (TQStyleSheet::mightBeRichText(/*newT*/text))
+ return createNoteHtml(/*newT*/text, tqparent);
else
- return createNoteText(/*newT*/text, parent);
+ return createNoteText(/*newT*/text, tqparent);
}
-Note* NoteFactory::createNoteLauncher(const KURL &url, Basket *parent)
+Note* NoteFactory::createNoteLauncher(const KURL &url, Basket *tqparent)
{
if (url.isEmpty())
- return createNoteLauncher("", "", "", parent);
+ return createNoteLauncher("", "", "", tqparent);
else
- return copyFileAndLoad(url, parent);
+ return copyFileAndLoad(url, tqparent);
}
-Note* NoteFactory::createNoteLauncher(const QString &command, const QString &name, const QString &icon, Basket *parent)
+Note* NoteFactory::createNoteLauncher(const TQString &command, const TQString &name, const TQString &icon, Basket *tqparent)
{
- QString fileName = createNoteLauncherFile(command, name, icon, parent);
+ TQString fileName = createNoteLauncherFile(command, name, icon, tqparent);
if (fileName.isEmpty())
return 0L;
else
- return loadFile(fileName, parent);
+ return loadFile(fileName, tqparent);
}
-QString NoteFactory::createNoteLauncherFile(const QString &command, const QString &name, const QString &icon, Basket *parent)
+TQString NoteFactory::createNoteLauncherFile(const TQString &command, const TQString &name, const TQString &icon, Basket *tqparent)
{
- QString content = QString(
+ TQString content = TQString(
"[Desktop Entry]\n"
"Exec=%1\n"
"Name=%2\n"
"Icon=%3\n"
"Encoding=UTF-8\n"
- "Type=Application\n").arg(command, name, icon.isEmpty() ? QString("exec") : icon);
- QString fileName = fileNameForNewNote(parent, "launcher.desktop");
- QString fullPath = parent->fullPathForFileName(fileName);
-// parent->dontCareOfCreation(fullPath);
- QFile file(fullPath);
+ "Type=Application\n").tqarg(command, name, icon.isEmpty() ? TQString("exec") : icon);
+ TQString fileName = fileNameForNewNote(tqparent, "launcher.desktop");
+ TQString fullPath = tqparent->fullPathForFileName(fileName);
+// tqparent->dontCareOfCreation(fullPath);
+ TQFile file(fullPath);
if ( file.open(IO_WriteOnly) ) {
- QTextStream stream(&file);
- stream.setEncoding(QTextStream::UnicodeUTF8);
+ TQTextStream stream(&file);
+ stream.setEncoding(TQTextStream::UnicodeUTF8);
stream << content;
file.close();
return fileName;
} else
- return QString();
+ return TQString();
}
-Note* NoteFactory::createNoteLinkOrLauncher(const KURL &url, Basket *parent)
+Note* NoteFactory::createNoteLinkOrLauncher(const KURL &url, Basket *tqparent)
{
// IMPORTANT: we create the service ONLY if the extension is ".desktop".
// Otherwise, KService take a long time to analyse all the file
@@ -292,23 +292,23 @@ Note* NoteFactory::createNoteLinkOrLauncher(const KURL &url, Basket *parent)
// If link point to a .desktop file then add a launcher, otherwise it's a link
if (service && service->isValid())
- return createNoteLauncher(url, parent);
+ return createNoteLauncher(url, tqparent);
else
- return createNoteLink(url, parent);
+ return createNoteLink(url, tqparent);
}
-#include <qstrlist.h>
-#include <qimage.h>
+#include <tqstrlist.h>
+#include <tqimage.h>
-bool NoteFactory::movingNotesInTheSameBasket(QMimeSource *source, Basket *parent, QDropEvent::Action action)
+bool NoteFactory::movingNotesInTheSameBasket(TQMimeSource *source, Basket *tqparent, TQDropEvent::Action action)
{
if (NoteDrag::canDecode(source))
- return action == QDropEvent::Move && NoteDrag::basketOf(source) == parent;
+ return action == TQDropEvent::Move && NoteDrag::basketOf(source) == tqparent;
else
return false;
}
-Note* NoteFactory::dropNote(QMimeSource *source, Basket *parent, bool fromDrop, QDropEvent::Action action, Note */*noteSource*/)
+Note* NoteFactory::dropNote(TQMimeSource *source, Basket *tqparent, bool fromDrop, TQDropEvent::Action action, Note */*noteSource*/)
{
Note *note = 0L;
@@ -316,7 +316,7 @@ Note* NoteFactory::dropNote(QMimeSource *source, Basket *parent, bool fromDrop,
if (source->format(0) == 0L) {
// TODO: add a parameter to say if it's from a clipboard paste, a selection paste, or a drop
// To be able to say "The clipboard/selection/drop is empty".
-// KMessageBox::error(parent, i18n("There is no data to insert."), i18n("No Data"));
+// KMessageBox::error(tqparent, i18n("There is no data to insert."), i18n("No Data"));
return 0;
}
@@ -325,45 +325,45 @@ Note* NoteFactory::dropNote(QMimeSource *source, Basket *parent, bool fromDrop,
*Global::debugWindow << "<b>Drop :</b>";
for (int i = 0; source->format(i); ++i)
if ( *(source->format(i)) )
- *Global::debugWindow << "\t[" + QString::number(i) + "] " + QString(source->format(i));
+ *Global::debugWindow << "\t[" + TQString::number(i) + "] " + TQString(source->format(i));
switch (action) { // The source want that we:
- case QDropEvent::Copy: *Global::debugWindow << ">> Drop action: Copy"; break;
- case QDropEvent::Move: *Global::debugWindow << ">> Drop action: Move"; break;
- case QDropEvent::Link: *Global::debugWindow << ">> Drop action: Link"; break;
- case QDropEvent::Private: *Global::debugWindow << ">> Drop action: Private"; break; // What is it? (Copy?)
- case QDropEvent::UserAction: *Global::debugWindow << ">> Drop action: UserAction"; break; // Not currently
- default: *Global::debugWindow << ">> Drop action: Unknown"; // supported by Qt!
+ case TQDropEvent::Copy: *Global::debugWindow << ">> Drop action: Copy"; break;
+ case TQDropEvent::Move: *Global::debugWindow << ">> Drop action: Move"; break;
+ case TQDropEvent::Link: *Global::debugWindow << ">> Drop action: Link"; break;
+ case TQDropEvent::Private: *Global::debugWindow << ">> Drop action: Private"; break; // What is it? (Copy?)
+ case TQDropEvent::UserAction: *Global::debugWindow << ">> Drop action: UserAction"; break; // Not currently
+ default: *Global::debugWindow << ">> Drop action: Unknown"; // supported by TQt!
}
}
/* Copy or move a Note */
if (NoteDrag::canDecode(source)) {
- bool moveFiles = fromDrop && action == QDropEvent::Move;
+ bool moveFiles = fromDrop && action == TQDropEvent::Move;
bool moveNotes = moveFiles;
- return NoteDrag::decode(source, parent, moveFiles, moveNotes); // Filename will be kept
+ return NoteDrag::decode(source, tqparent, moveFiles, moveNotes); // Filename will be kept
}
/* Else : Drop object to note */
- QPixmap pixmap;
- if ( QImageDrag::decode(source, pixmap) )
- return createNoteImage(pixmap, parent);
+ TQPixmap pixmap;
+ if ( TQImageDrag::decode(source, pixmap) )
+ return createNoteImage(pixmap, tqparent);
// KColorDrag::decode() is buggy and can trheat strings like "#include <foo.h>" as a black color
// The correct "ideal" code:
- /*QColor color;
+ /*TQColor color;
if ( KColorDrag::decode(source, color) ) {
- createNoteColor(color, parent);
+ createNoteColor(color, tqparent);
return;
}*/
// And then the hack (if provide color MIME type or a text that contains color), using createNote Color RegExp:
- QString hack;
- QRegExp exp("^#(?:[a-fA-F\\d]{3}){1,4}$");
- if (source->provides("application/x-color") || (QTextDrag::decode(source, hack) && (exp.search(hack) != -1)) ) {
- QColor color;
+ TQString hack;
+ TQRegExp exp("^#(?:[a-fA-F\\d]{3}){1,4}$");
+ if (source->provides("application/x-color") || (TQTextDrag::decode(source, hack) && (exp.search(hack) != -1)) ) {
+ TQColor color;
if (KColorDrag::decode(source, color))
- return createNoteColor(color, parent);
-// if ( (note = createNoteColor(color, parent)) )
+ return createNoteColor(color, tqparent);
+// if ( (note = createNoteColor(color, tqparent)) )
// return note;
// // Theorically it should be returned. If not, continue by dropping other things
}
@@ -372,8 +372,8 @@ Note* NoteFactory::dropNote(QMimeSource *source, Basket *parent, bool fromDrop,
if ( KURLDrag::decode(source, urls) ) {
// If it's a Paste, we should know if files should be copied (copy&paste) or moved (cut&paste):
if (!fromDrop && Tools::isAFileCut(source))
- action = QDropEvent::Move;
- return dropURLs(urls, parent, action, fromDrop);
+ action = TQDropEvent::Move;
+ return dropURLs(urls, tqparent, action, fromDrop);
}
// FIXME: use dropURLs() also from Mozilla?
@@ -398,72 +398,72 @@ Note* NoteFactory::dropNote(QMimeSource *source, Basket *parent, bool fromDrop,
* Thanks to Dave Cridland for having said me that.
*/
if (source->provides("text/x-moz-url")) { // FOR MOZILLA
- // Get the array and create a QChar array of 1/2 of the size
- QByteArray mozilla = source->encodedData("text/x-moz-url");
- QMemArray<QChar> chars( mozilla.count() / 2 );
+ // Get the array and create a TQChar array of 1/2 of the size
+ TQByteArray mozilla = source->tqencodedData("text/x-moz-url");
+ TQMemArray<TQChar> chars( mozilla.count() / 2 );
// A small debug work to know the value of each bytes
if (Global::debugWindow)
for (uint i = 0; i < mozilla.count(); i++)
- *Global::debugWindow << QString("'") + QChar(mozilla[i]) + "' " + QString::number(int(mozilla[i]));
+ *Global::debugWindow << TQString("'") + TQChar(mozilla[i]) + "' " + TQString::number(int(mozilla[i]));
// text/x-moz-url give the URL followed by the link title and separed by OxOA (10 decimal: new line?)
uint size = 0;
- QChar *name = 0L;
- // For each little endian mozilla chars, copy it to the array of QChars
+ TQChar *name = 0L;
+ // For each little endian mozilla chars, copy it to the array of TQChars
for (uint i = 0; i < mozilla.count(); i += 2) {
- chars[i/2] = QChar(mozilla[i], mozilla[i+1]);
+ chars[i/2] = TQChar(mozilla[i], mozilla[i+1]);
if (mozilla[i] == 0x0A) {
size = i/2;
name = &(chars[i/2+1]);
}
}
- // Create a QString that take the address of the first QChar and a length
+ // Create a TQString that take the address of the first TQChar and a length
if (name == 0L) { // We haven't found name (FIXME: Is it possible ?)
- QString normalHtml(&(chars[0]), chars.size());
- return createNoteLink(normalHtml, parent);
+ TQString normalHtml(&(chars[0]), chars.size());
+ return createNoteLink(normalHtml, tqparent);
} else {
- QString normalHtml( &(chars[0]), size );
- QString normalTitle( name, chars.size()-size-1);
- return createNoteLink(normalHtml, normalTitle, parent);
+ TQString normalHtml( &(chars[0]), size );
+ TQString normalTitle( name, chars.size()-size-1);
+ return createNoteLink(normalHtml, normalTitle, tqparent);
}
}
if (source->provides("text/html")) {
- QString html;
- QCString subtype("html");
+ TQString html;
+ TQCString subtype("html");
// If the text/html comes from Mozilla or GNOME it can be UTF-16 encoded: we need ExtendedTextDrag to check that
ExtendedTextDrag::decode(source, html, subtype);
- return createNoteHtml(html, parent);
+ return createNoteHtml(html, tqparent);
}
- QString text;
+ TQString text;
// If the text/plain comes from GEdit or GNOME it can be empty: we need ExtendedTextDrag to check other MIME types
if ( ExtendedTextDrag::decode(source, text) )
- return createNoteFromText(text, parent);
+ return createNoteFromText(text, tqparent);
/* Unsucceful drop */
- note = createNoteUnknown(source, parent);
- QString message = i18n("<p>%1 doesn't support the data you've dropped.<br>"
+ note = createNoteUnknown(source, tqparent);
+ TQString message = i18n("<p>%1 doesn't support the data you've dropped.<br>"
"It however created a generic note, allowing you to drag or copy it to an application that understand it.</p>"
"<p>If you want the support of these data, please contact developer or visit the "
- "<a href=\"http://basket.kde.org/dropdb.php\">BasKet Drop Database</a>.</p>").arg(kapp->aboutData()->programName());
- KMessageBox::information(parent, message, i18n("Unsupported MIME Type(s)"),
+ "<a href=\"http://basket.kde.org/dropdb.php\">BasKet Drop Database</a>.</p>").tqarg(kapp->aboutData()->programName());
+ KMessageBox::information(tqparent, message, i18n("Unsupported MIME Type(s)"),
"unsupportedDropInfo", KMessageBox::AllowLink);
return note;
}
-Note* NoteFactory::createNoteUnknown(QMimeSource *source, Basket *parent/*, const QString &annotations*/)
+Note* NoteFactory::createNoteUnknown(TQMimeSource *source, Basket *tqparent/*, const TQString &annotations*/)
{
// Save the MimeSource in a file: create and open the file:
- QString fileName = createFileForNewNote(parent, "unknown");
- QFile file(parent->fullPath() + fileName);
+ TQString fileName = createFileForNewNote(tqparent, "unknown");
+ TQFile file(tqparent->fullPath() + fileName);
if ( ! file.open(IO_WriteOnly) )
return 0L;
- QDataStream stream(&file);
+ TQDataStream stream(&file);
// Echo MIME types:
for (int i = 0; source->format(i); ++i)
if ( *(source->format(i)) )
- stream << QString(source->format(i)); // Output the '\0'-terminated format name string
+ stream << TQString(source->format(i)); // Output the '\0'-terminated format name string
// Echo end of MIME types list delimiter:
stream << "";
@@ -471,18 +471,18 @@ Note* NoteFactory::createNoteUnknown(QMimeSource *source, Basket *parent/*, cons
// Echo the length (in bytes) and then the data, and then same for next MIME type:
for (int i = 0; source->format(i); ++i)
if ( *(source->format(i)) ) {
- QByteArray data = source->encodedData(source->format(i));
- stream << (Q_UINT32)data.count();
+ TQByteArray data = source->tqencodedData(source->format(i));
+ stream << (TQ_UINT32)data.count();
stream.writeRawBytes(data.data(), data.count());
}
file.close();
- Note *note = new Note(parent);
+ Note *note = new Note(tqparent);
new UnknownContent(note, fileName);
return note;
}
-Note* NoteFactory::dropURLs(KURL::List urls, Basket *parent, QDropEvent::Action action, bool fromDrop)
+Note* NoteFactory::dropURLs(KURL::List urls, Basket *tqparent, TQDropEvent::Action action, bool fromDrop)
{
int shouldAsk = 0; // shouldAsk==0: don't ask ; shouldAsk==1: ask for "file" ; shouldAsk>=2: ask for "files"
bool shiftPressed = Keyboard::shiftPressed();
@@ -499,17 +499,17 @@ Note* NoteFactory::dropURLs(KURL::List urls, Basket *parent, QDropEvent::Action
break;
}
if (shouldAsk) {
- KPopupMenu menu(parent);
+ KPopupMenu menu(tqparent);
menu.insertItem( SmallIconSet("goto"), i18n("&Move Here\tShift"), 0 );
menu.insertItem( SmallIconSet("editcopy"), i18n("&Copy Here\tCtrl"), 1 );
menu.insertItem( SmallIconSet("www"), i18n("&Link Here\tCtrl+Shift"), 2 );
menu.insertSeparator();
menu.insertItem( SmallIconSet("cancel"), i18n("C&ancel\tEscape"), 3 );
- int id = menu.exec(QCursor::pos());
+ int id = menu.exec(TQCursor::pos());
switch (id) {
- case 0: action = QDropEvent::Move; break;
- case 1: action = QDropEvent::Copy; break;
- case 2: action = QDropEvent::Link; break;
+ case 0: action = TQDropEvent::Move; break;
+ case 1: action = TQDropEvent::Copy; break;
+ case 2: action = TQDropEvent::Link; break;
default: return 0;
}
modified = true;
@@ -542,20 +542,20 @@ Note* NoteFactory::dropURLs(KURL::List urls, Basket *parent, QDropEvent::Action
Note *lastInserted = 0;
for (KURL::List::iterator it = urls.begin(); it != urls.end(); ++it) {
if ( ((*it).protocol() == "mailto") ||
- (action == QDropEvent::Link) )
- note = createNoteLinkOrLauncher(*it, parent);
+ (action == TQDropEvent::Link) )
+ note = createNoteLinkOrLauncher(*it, tqparent);
else if (!(*it).isLocalFile()) {
- if ( action != QDropEvent::Link && (maybeImageOrAnimation(*it)/* || maybeSound(*it)*/) )
- note = copyFileAndLoad(*it, parent);
+ if ( action != TQDropEvent::Link && (maybeImageOrAnimation(*it)/* || maybeSound(*it)*/) )
+ note = copyFileAndLoad(*it, tqparent);
else
- note = createNoteLinkOrLauncher(*it, parent);
+ note = createNoteLinkOrLauncher(*it, tqparent);
} else {
- if (action == QDropEvent::Copy)
- note = copyFileAndLoad(*it, parent);
- else if (action == QDropEvent::Move)
- note = moveFileAndLoad(*it, parent);
+ if (action == TQDropEvent::Copy)
+ note = copyFileAndLoad(*it, tqparent);
+ else if (action == TQDropEvent::Move)
+ note = moveFileAndLoad(*it, tqparent);
else
- note = createNoteLinkOrLauncher(*it, parent);
+ note = createNoteLinkOrLauncher(*it, tqparent);
}
// If we got a new note, insert it in a linked list (we will return the first note of that list):
@@ -573,49 +573,49 @@ Note* NoteFactory::dropURLs(KURL::List urls, Basket *parent, QDropEvent::Action
return firstNote;
}
-void NoteFactory::consumeContent(QDataStream &stream, NoteType::Id type)
+void NoteFactory::consumeContent(TQDataStream &stream, NoteType::Id type)
{
if (type == NoteType::Link) {
KURL url;
- QString title, icon;
- Q_UINT64 autoTitle64, autoIcon64;
+ TQString title, icon;
+ TQ_UINT64 autoTitle64, autoIcon64;
stream >> url >> title >> icon >> autoTitle64 >> autoIcon64;
} else if (type == NoteType::Color) {
- QColor color;
+ TQColor color;
stream >> color;
}
}
-Note* NoteFactory::decodeContent(QDataStream &stream, NoteType::Id type, Basket *parent)
+Note* NoteFactory::decodeContent(TQDataStream &stream, NoteType::Id type, Basket *tqparent)
{
/* if (type == NoteType::Text) {
- QString text;
+ TQString text;
stream >> text;
- return NoteFactory::createNoteText(text, parent);
+ return NoteFactory::createNoteText(text, tqparent);
} else if (type == NoteType::Html) {
- QString html;
+ TQString html;
stream >> html;
- return NoteFactory::createNoteHtml(html, parent);
+ return NoteFactory::createNoteHtml(html, tqparent);
} else if (type == NoteType::Image) {
- QPixmap pixmap;
+ TQPixmap pixmap;
stream >> pixmap;
- return NoteFactory::createNoteImage(pixmap, parent);
+ return NoteFactory::createNoteImage(pixmap, tqparent);
} else */
if (type == NoteType::Link) {
KURL url;
- QString title, icon;
- Q_UINT64 autoTitle64, autoIcon64;
+ TQString title, icon;
+ TQ_UINT64 autoTitle64, autoIcon64;
bool autoTitle, autoIcon;
stream >> url >> title >> icon >> autoTitle64 >> autoIcon64;
autoTitle = (bool)autoTitle64;
autoIcon = (bool)autoIcon64;
- Note *note = NoteFactory::createNoteLink(url, parent);
+ Note *note = NoteFactory::createNoteLink(url, tqparent);
((LinkContent*)(note->content()))->setLink(url, title, icon, autoTitle, autoIcon);
return note;
} else if (type == NoteType::Color) {
- QColor color;
+ TQColor color;
stream >> color;
- return NoteFactory::createNoteColor(color, parent);
+ return NoteFactory::createNoteColor(color, tqparent);
} else
return 0; // NoteFactory::loadFile() is sufficient
}
@@ -624,31 +624,31 @@ Note* NoteFactory::decodeContent(QDataStream &stream, NoteType::Id type, Basket
bool NoteFactory::maybeText(const KURL &url)
{
- QString path = url.url().lower();
+ TQString path = url.url().lower();
return path.endsWith(".txt");
}
bool NoteFactory::maybeHtml(const KURL &url)
{
- QString path = url.url().lower();
+ TQString path = url.url().lower();
return path.endsWith(".html") || path.endsWith(".htm");
}
bool NoteFactory::maybeImageOrAnimation(const KURL &url)
{
/* Examples on my machine:
- QImageDrag can understands
+ TQImageDrag can understands
{"image/png", "image/bmp", "image/jpeg", "image/pgm", "image/ppm", "image/xbm", "image/xpm"}
- QImageIO::inputFormats() returns
+ TQImageIO::inputFormats() returns
{"BMP", "GIF", "JPEG", "MNG", "PBM", "PGM", "PNG", "PPM", "XBM", "XPM"}
- QImageDecoder::inputFormats():
+ TQImageDecoder::inputFormats():
{"GIF", "MNG", "PNG"} */
- QStrList list = QImageIO::inputFormats();
- list.prepend("jpg"); // Since QImageDrag return only "JPEG" and extensions can be "JPG"; preprend for heuristic optim.
+ TQStrList list = TQImageIO::inputFormats();
+ list.prepend("jpg"); // Since TQImageDrag return only "JPEG" and extensions can be "JPG"; preprend for heuristic optim.
char *s;
- QString path = url.url().lower();
+ TQString path = url.url().lower();
for (s = list.first(); s; s = list.next())
- if (path.endsWith(QString(".") + QString(s).lower()))
+ if (path.endsWith(TQString(".") + TQString(s).lower()))
return true;
// TODO: Search real MIME type for local files?
return false;
@@ -656,94 +656,94 @@ bool NoteFactory::maybeImageOrAnimation(const KURL &url)
bool NoteFactory::maybeAnimation(const KURL &url)
{
- QString path = url.url().lower();
+ TQString path = url.url().lower();
return path.endsWith(".mng") || path.endsWith(".gif");
}
bool NoteFactory::maybeSound(const KURL &url)
{
- QString path = url.url().lower();
+ TQString path = url.url().lower();
return path.endsWith(".mp3") || path.endsWith(".ogg");
}
bool NoteFactory::maybeLauncher(const KURL &url)
{
- QString path = url.url().lower();
+ TQString path = url.url().lower();
return path.endsWith(".desktop");
}
////////////// NEW:
-Note* NoteFactory::copyFileAndLoad(const KURL &url, Basket *parent)
+Note* NoteFactory::copyFileAndLoad(const KURL &url, Basket *tqparent)
{
- QString fileName = fileNameForNewNote(parent, url.fileName());
- QString fullPath = parent->fullPathForFileName(fileName);
+ TQString fileName = fileNameForNewNote(tqparent, url.fileName());
+ TQString fullPath = tqparent->fullPathForFileName(fileName);
if (Global::debugWindow)
*Global::debugWindow << "copyFileAndLoad: " + url.prettyURL() + " to " + fullPath;
-// QString annotations = i18n("Original file: %1").arg(url.prettyURL());
-// parent->dontCareOfCreation(fullPath);
+// TQString annotations = i18n("Original file: %1").tqarg(url.prettyURL());
+// tqparent->dontCareOfCreation(fullPath);
// KIO::CopyJob *copyJob = KIO::copy(url, KURL(fullPath));
-// parent->connect( copyJob, SIGNAL(copyingDone(KIO::Job *, const KURL &, const KURL &, bool, bool)),
-// parent, SLOT(slotCopyingDone(KIO::Job *, const KURL &, const KURL &, bool, bool)) );
+// tqparent->connect( copyJob, TQT_SIGNAL(copyingDone(KIO::Job *, const KURL &, const KURL &, bool, bool)),
+// tqparent, TQT_SLOT(slotCopyingDone(KIO::Job *, const KURL &, const KURL &, bool, bool)) );
KIO::FileCopyJob *copyJob = new KIO::FileCopyJob(
url, KURL(fullPath), 0666, /*move=*/false,
/*overwrite=*/true, /*resume=*/true, /*showProgress=*/true );
- parent->connect( copyJob, SIGNAL(result(KIO::Job *)),
- parent, SLOT(slotCopyingDone2(KIO::Job *)) );
+ tqparent->connect( copyJob, TQT_SIGNAL(result(KIO::Job *)),
+ tqparent, TQT_SLOT(slotCopyingDone2(KIO::Job *)) );
- NoteType::Id type = typeForURL(url, parent); // Use the type of the original file because the target doesn't exist yet
- return loadFile(fileName, type, parent);
+ NoteType::Id type = typeForURL(url, tqparent); // Use the type of the original file because the target doesn't exist yet
+ return loadFile(fileName, type, tqparent);
}
-Note* NoteFactory::moveFileAndLoad(const KURL &url, Basket *parent)
+Note* NoteFactory::moveFileAndLoad(const KURL &url, Basket *tqparent)
{
// Globally the same as copyFileAndLoad() but move instead of copy (KIO::move())
- QString fileName = fileNameForNewNote(parent, url.fileName());
- QString fullPath = parent->fullPathForFileName(fileName);
+ TQString fileName = fileNameForNewNote(tqparent, url.fileName());
+ TQString fullPath = tqparent->fullPathForFileName(fileName);
if (Global::debugWindow)
*Global::debugWindow << "moveFileAndLoad: " + url.prettyURL() + " to " + fullPath;
-// QString annotations = i18n("Original file: %1").arg(url.prettyURL());
-// parent->dontCareOfCreation(fullPath);
+// TQString annotations = i18n("Original file: %1").tqarg(url.prettyURL());
+// tqparent->dontCareOfCreation(fullPath);
// KIO::CopyJob *copyJob = KIO::move(url, KURL(fullPath));
-// parent->connect( copyJob, SIGNAL(copyingDone(KIO::Job *, const KURL &, const KURL &, bool, bool)),
-// parent, SLOT(slotCopyingDone(KIO::Job *, const KURL &, const KURL &, bool, bool)) );
+// tqparent->connect( copyJob, TQT_SIGNAL(copyingDone(KIO::Job *, const KURL &, const KURL &, bool, bool)),
+// tqparent, TQT_SLOT(slotCopyingDone(KIO::Job *, const KURL &, const KURL &, bool, bool)) );
KIO::FileCopyJob *copyJob = new KIO::FileCopyJob(
url, KURL(fullPath), 0666, /*move=*/true,
/*overwrite=*/true, /*resume=*/true, /*showProgress=*/true );
- parent->connect( copyJob, SIGNAL(result(KIO::Job *)),
- parent, SLOT(slotCopyingDone2(KIO::Job *)) );
+ tqparent->connect( copyJob, TQT_SIGNAL(result(KIO::Job *)),
+ tqparent, TQT_SLOT(slotCopyingDone2(KIO::Job *)) );
- NoteType::Id type = typeForURL(url, parent); // Use the type of the original file because the target doesn't exist yet
- return loadFile(fileName, type, parent);
+ NoteType::Id type = typeForURL(url, tqparent); // Use the type of the original file because the target doesn't exist yet
+ return loadFile(fileName, type, tqparent);
}
-Note* NoteFactory::loadFile(const QString &fileName, Basket *parent)
+Note* NoteFactory::loadFile(const TQString &fileName, Basket *tqparent)
{
// The file MUST exists
- QFileInfo file( KURL(parent->fullPathForFileName(fileName)).path() );
+ TQFileInfo file( KURL(tqparent->fullPathForFileName(fileName)).path() );
if ( ! file.exists() )
return 0L;
- NoteType::Id type = typeForURL(parent->fullPathForFileName(fileName), parent);
- Note *note = loadFile(fileName, type, parent);
+ NoteType::Id type = typeForURL(tqparent->fullPathForFileName(fileName), tqparent);
+ Note *note = loadFile(fileName, type, tqparent);
return note;
}
-Note* NoteFactory::loadFile(const QString &fileName, NoteType::Id type, Basket *parent)
+Note* NoteFactory::loadFile(const TQString &fileName, NoteType::Id type, Basket *tqparent)
{
- Note *note = new Note(parent);
+ Note *note = new Note(tqparent);
switch (type) {
case NoteType::Text: new TextContent( note, fileName ); break;
case NoteType::Html: new HtmlContent( note, fileName ); break;
@@ -763,11 +763,11 @@ Note* NoteFactory::loadFile(const QString &fileName, NoteType::Id type, Basket *
return note;
}
-NoteType::Id NoteFactory::typeForURL(const KURL &url, Basket */*parent*/)
+NoteType::Id NoteFactory::typeForURL(const KURL &url, Basket */*tqparent*/)
{
/* KMimeType::Ptr kMimeType = KMimeType::findByURL(url);
if (Global::debugWindow)
- *Global::debugWindow << "typeForURL: " + kMimeType->parentMimeType();//property("MimeType").toString();*/
+ *Global::debugWindow << "typeForURL: " + kMimeType->tqparentMimeType();//property("MimeType").toString();*/
bool viewText = Settings::viewTextFileContent();
bool viewHTML = Settings::viewHtmlFileContent();
bool viewImage = Settings::viewImageFileContent();
@@ -779,13 +779,13 @@ NoteType::Id NoteFactory::typeForURL(const KURL &url, Basket */*parent*/)
if (metaInfo.isEmpty()) { // metaInfo is empty for GIF files on my machine !
if (viewText && maybeText(url)) return NoteType::Text;
else if (viewHTML && (maybeHtml(url))) return NoteType::Html;
- else if (viewImage && maybeAnimation(url)) return NoteType::Animation; // See Note::movieStatus(int)
+ else if (viewImage && maybeAnimation(url)) return NoteType::Animation; // See Note::movietqStatus(int)
else if (viewImage && maybeImageOrAnimation(url)) return NoteType::Image; // for more explanations
else if (viewSound && maybeSound(url)) return NoteType::Sound;
else if (maybeLauncher(url)) return NoteType::Launcher;
else return NoteType::File;
}
- QString mimeType = metaInfo.mimeType();
+ TQString mimeType = metaInfo.mimeType();
if (Global::debugWindow)
*Global::debugWindow << "typeForURL: " + url.prettyURL() + " ; MIME type = " + mimeType;
@@ -800,38 +800,38 @@ NoteType::Id NoteFactory::typeForURL(const KURL &url, Basket */*parent*/)
else return NoteType::File;
}
-QString NoteFactory::fileNameForNewNote(Basket *parent, const QString &wantedName)
+TQString NoteFactory::fileNameForNewNote(Basket *tqparent, const TQString &wantedName)
{
- return Tools::fileNameForNewFile(wantedName, parent->fullPath());
+ return Tools::fileNameForNewFile(wantedName, tqparent->fullPath());
}
-// Create a file to store a new note in Basket parent and with extension extension.
+// Create a file to store a new note in Basket tqparent and with extension extension.
// If wantedName is provided, the function will first try to use this file name, or derive it if it's impossible
// (extension willn't be used for that case)
-QString NoteFactory::createFileForNewNote(Basket *parent, const QString &extension, const QString &wantedName)
+TQString NoteFactory::createFileForNewNote(Basket *tqparent, const TQString &extension, const TQString &wantedName)
{
static int nb = 1;
- QString fileName;
- QString fullName;
+ TQString fileName;
+ TQString fullName;
- if (wantedName.isEmpty()) { // TODO: fileNameForNewNote(parent, "note1."+extension);
- QDir dir;
+ if (wantedName.isEmpty()) { // TODO: fileNameForNewNote(tqparent, "note1."+extension);
+ TQDir dir;
for (/*int nb = 1*/; ; ++nb) { // TODO: FIXME: If overflow ???
- fileName = "note" + QString::number(nb)/*.rightJustify(5, '0')*/ + "." + extension;
- fullName = parent->fullPath() + fileName;
- dir = QDir(fullName);
+ fileName = "note" + TQString::number(nb)/*.rightJustify(5, '0')*/ + "." + extension;
+ fullName = tqparent->fullPath() + fileName;
+ dir = TQDir(fullName);
if ( ! dir.exists(fullName) )
break;
}
} else {
- fileName = fileNameForNewNote(parent, wantedName);
- fullName = parent->fullPath() + fileName;
+ fileName = fileNameForNewNote(tqparent, wantedName);
+ fullName = tqparent->fullPath() + fileName;
}
// Create the file
-// parent->dontCareOfCreation(fullName);
- QFile file(fullName);
+// tqparent->dontCareOfCreation(fullName);
+ TQFile file(fullName);
file.open(IO_WriteOnly);
file.close();
@@ -844,7 +844,7 @@ KURL NoteFactory::filteredURL(const KURL &url)
// So, we don't use that function is that case:
bool isSlow = true;
for (uint i = 0; i < url.url().length(); ++i) {
- QChar c = url.url()[i];
+ TQChar c = url.url()[i];
if (!c.isLetterOrNumber() && c != '-' && c != '+') {
isSlow = false;
break;
@@ -856,10 +856,10 @@ KURL NoteFactory::filteredURL(const KURL &url)
return KURIFilter::self()->filteredURI(url);
}
-QString NoteFactory::titleForURL(const KURL &url)
+TQString NoteFactory::titleForURL(const KURL &url)
{
- QString title = url.prettyURL();
- QString home = "file:" + QDir::homeDirPath() + "/";
+ TQString title = url.prettyURL();
+ TQString home = "file:" + TQDir::homeDirPath() + "/";
if (title.startsWith("mailto:"))
return title.remove(0, 7);
@@ -868,31 +868,31 @@ QString NoteFactory::titleForURL(const KURL &url)
title = "~/" + title.remove(0, home.length());
if (title.startsWith("file://"))
- title = title.remove(0, 7); // 7 == QString("file://").length() - 1
+ title = title.remove(0, 7); // 7 == TQString("file://").length() - 1
else if (title.startsWith("file:"))
- title = title.remove(0, 5); // 5 == QString("file:").length() - 1
+ title = title.remove(0, 5); // 5 == TQString("file:").length() - 1
else if (title.startsWith("http://www."))
- title = title.remove(0, 11); // 11 == QString("http://www.").length() - 1
+ title = title.remove(0, 11); // 11 == TQString("http://www.").length() - 1
else if (title.startsWith("http://"))
- title = title.remove(0, 7); // 7 == QString("http://").length() - 1
+ title = title.remove(0, 7); // 7 == TQString("http://").length() - 1
if ( ! url.isLocalFile() ) {
if (title.endsWith("/index.html") && title.length() > 11)
- title.truncate(title.length() - 11); // 11 == QString("/index.html").length()
+ title.truncate(title.length() - 11); // 11 == TQString("/index.html").length()
else if (title.endsWith("/index.htm") && title.length() > 10)
- title.truncate(title.length() - 10); // 10 == QString("/index.htm").length()
+ title.truncate(title.length() - 10); // 10 == TQString("/index.htm").length()
else if (title.endsWith("/index.xhtml") && title.length() > 12)
- title.truncate(title.length() - 12); // 12 == QString("/index.xhtml").length()
+ title.truncate(title.length() - 12); // 12 == TQString("/index.xhtml").length()
else if (title.endsWith("/index.php") && title.length() > 10)
- title.truncate(title.length() - 10); // 10 == QString("/index.php").length()
+ title.truncate(title.length() - 10); // 10 == TQString("/index.php").length()
else if (title.endsWith("/index.asp") && title.length() > 10)
- title.truncate(title.length() - 10); // 10 == QString("/index.asp").length()
+ title.truncate(title.length() - 10); // 10 == TQString("/index.asp").length()
else if (title.endsWith("/index.php3") && title.length() > 11)
- title.truncate(title.length() - 11); // 11 == QString("/index.php3").length()
+ title.truncate(title.length() - 11); // 11 == TQString("/index.php3").length()
else if (title.endsWith("/index.php4") && title.length() > 11)
- title.truncate(title.length() - 11); // 11 == QString("/index.php4").length()
+ title.truncate(title.length() - 11); // 11 == TQString("/index.php4").length()
else if (title.endsWith("/index.php5") && title.length() > 11)
- title.truncate(title.length() - 11); // 11 == QString("/index.php5").length()
+ title.truncate(title.length() - 11); // 11 == TQString("/index.php5").length()
}
if (title.length() > 2 && title.endsWith("/")) // length > 2 because "/" and "~/" shouldn't be transformed to "" and "~"
@@ -901,9 +901,9 @@ QString NoteFactory::titleForURL(const KURL &url)
return title;
}
-QString NoteFactory::iconForURL(const KURL &url)
+TQString NoteFactory::iconForURL(const KURL &url)
{
- QString icon = KMimeType::iconForURL(url.url());
+ TQString icon = KMimeType::iconForURL(url.url());
if ( url.protocol() == "mailto" )
icon = "message";
return icon;
@@ -915,19 +915,19 @@ QString NoteFactory::iconForURL(const KURL &url)
* eg. "/usr/bin/kwrite-3.2 ~/myfile.txt /home/other/file.xml"
* will give the "kwrite" icon!
*/
-QString NoteFactory::iconForCommand(const QString &command)
+TQString NoteFactory::iconForCommand(const TQString &command)
{
- QString icon;
+ TQString icon;
// 1. Use first word as icon (typically the program without argument)
- icon = QStringList::split(' ', command).first();
+ icon = TQStringList::split(' ', command).first();
// 2. If the command is a full path, take only the program file name
- icon = icon.mid(icon.findRev('/') + 1); // strip path if given [But it doesn't care of such
+ icon = icon.mid(icon.tqfindRev('/') + 1); // strip path if given [But it doesn't care of such
// "myprogram /my/path/argument" -> return "argument". Would
// must first strip first word and then strip path... Useful ??
// 3. Use characters before any '-' (e.g. use "gimp" icon if run command is "gimp-1.3")
if ( ! isIconExist(icon) )
- icon = QStringList::split('-', icon).first();
+ icon = TQStringList::split('-', icon).first();
// 4. If the icon still not findable, use a generic icon
if ( ! isIconExist(icon) )
icon = "exec";
@@ -935,30 +935,30 @@ QString NoteFactory::iconForCommand(const QString &command)
return icon;
}
-bool NoteFactory::isIconExist(const QString &icon)
+bool NoteFactory::isIconExist(const TQString &icon)
{
return ! kapp->iconLoader()->loadIcon(icon, KIcon::NoGroup, 16, KIcon::DefaultState, 0L, true).isNull();
}
-Note* NoteFactory::createEmptyNote(NoteType::Id type, Basket *parent)
+Note* NoteFactory::createEmptyNote(NoteType::Id type, Basket *tqparent)
{
- QPixmap *pixmap;
+ TQPixmap *pixmap;
switch (type) {
case NoteType::Text:
- return NoteFactory::createNoteText("", parent, /*reallyPlainText=*/true);
+ return NoteFactory::createNoteText("", tqparent, /*reallyPlainText=*/true);
case NoteType::Html:
- return NoteFactory::createNoteHtml("", parent);
+ return NoteFactory::createNoteHtml("", tqparent);
case NoteType::Image:
- pixmap = new QPixmap( QSize(Settings::defImageX(), Settings::defImageY()) );
+ pixmap = new TQPixmap( TQSize(Settings::defImageX(), Settings::defImageY()) );
pixmap->fill();
pixmap->setMask(pixmap->createHeuristicMask());
- return NoteFactory::createNoteImage(*pixmap, parent);
+ return NoteFactory::createNoteImage(*pixmap, tqparent);
case NoteType::Link:
- return NoteFactory::createNoteLink(KURL(), parent);
+ return NoteFactory::createNoteLink(KURL(), tqparent);
case NoteType::Launcher:
- return NoteFactory::createNoteLauncher(KURL(), parent);
+ return NoteFactory::createNoteLauncher(KURL(), tqparent);
case NoteType::Color:
- return NoteFactory::createNoteColor(Qt::black, parent);
+ return NoteFactory::createNoteColor(TQt::black, tqparent);
default:
case NoteType::Animation:
case NoteType::Sound:
@@ -968,41 +968,41 @@ Note* NoteFactory::createEmptyNote(NoteType::Id type, Basket *parent)
}
}
-Note* NoteFactory::importKMenuLauncher(Basket *parent)
+Note* NoteFactory::importKMenuLauncher(Basket *tqparent)
{
- KOpenWithDlg dialog(parent);
+ KOpenWithDlg dialog(tqparent);
dialog.setSaveNewApplications(true); // To create temp file, needed by createNoteLauncher()
dialog.exec();
if (dialog.service()) {
// * locateLocal() return a local file even if it is a system wide one (local one doesn't exists)
// * desktopEntryPath() returns the full path for system wide ressources, but relative path if in home
- QString serviceUrl = dialog.service()->desktopEntryPath();
+ TQString serviceUrl = dialog.service()->desktopEntryPath();
if ( ! serviceUrl.startsWith("/") )
serviceUrl = dialog.service()->locateLocal(); //locateLocal("xdgdata-apps", serviceUrl);
- return createNoteLauncher(serviceUrl, parent);
+ return createNoteLauncher(serviceUrl, tqparent);
}
return 0;
}
-Note* NoteFactory::importIcon(Basket *parent)
+Note* NoteFactory::importIcon(Basket *tqparent)
{
- QString iconName = KIconDialog::getIcon( KIcon::Desktop, KIcon::Application, false, Settings::defIconSize() );
+ TQString iconName = KIconDialog::getIcon( KIcon::Desktop, KIcon::Application, false, Settings::defIconSize() );
if ( ! iconName.isEmpty() ) {
IconSizeDialog dialog(i18n("Import Icon as Image"), i18n("Choose the size of the icon to import as an image:"), iconName, Settings::defIconSize(), 0);
dialog.exec();
if (dialog.iconSize() > 0) {
Settings::setDefIconSize(dialog.iconSize());
Settings::saveConfig();
- return createNoteImage( DesktopIcon(iconName, dialog.iconSize()), parent ); // TODO: wantedName = iconName !
+ return createNoteImage( DesktopIcon(iconName, dialog.iconSize()), tqparent ); // TODO: wantedName = iconName !
}
}
return 0;
}
-Note* NoteFactory::importFileContent(Basket *parent)
+Note* NoteFactory::importFileContent(Basket *tqparent)
{
- KURL url = KFileDialog::getOpenURL( QString::null, QString::null, parent, i18n("Load File Content into a Note") );
+ KURL url = KFileDialog::getOpenURL( TQString(), TQString(), tqparent, i18n("Load File Content into a Note") );
if ( ! url.isEmpty() )
- return copyFileAndLoad(url, parent);
+ return copyFileAndLoad(url, tqparent);
return 0;
}