TQt4 port knowit

This enables compilation under both Qt3 and Qt4


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knowit@1238876 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 1829a84466
commit e86f8310a9

File diff suppressed because it is too large Load Diff

@ -22,7 +22,7 @@
#include <config.h> #include <config.h>
#endif #endif
#include <qurloperator.h> #include <tqurloperator.h>
#include <keditcl.h> #include <keditcl.h>
#include <klocale.h> #include <klocale.h>
@ -34,8 +34,8 @@
#include "knowitlink.h" #include "knowitlink.h"
#include "notes.h" #include "notes.h"
class QSplitter; class TQSplitter;
class QTimer; class TQTimer;
class KAction; class KAction;
class KConfig; class KConfig;
class KListBox; class KListBox;
@ -51,15 +51,16 @@ class KnowitTree;
class Knowit : public KMainWindow class Knowit : public KMainWindow
{ {
Q_OBJECT Q_OBJECT
TQ_OBJECT
private: private:
static const QString Untitled; static const TQString Untitled;
KConfig *config; KConfig *config;
QSplitter* Layout; TQSplitter* Layout;
KnowitTree* Items; KnowitTree* Items;
KListBox* Links; KListBox* Links;
KnowitEdit* Edit; KnowitEdit* Edit;
KURL filename; KURL filename;
QPixmap pixmapFolder, pixmapFolderText, pixmapText, pixmapEmpty; TQPixmap pixmapFolder, pixmapFolderText, pixmapText, pixmapEmpty;
KEdFind FindDlg; KEdFind FindDlg;
KnowitOptions Options; KnowitOptions Options;
KnowitPreferences PrefDlg; KnowitPreferences PrefDlg;
@ -69,11 +70,11 @@ class Knowit : public KMainWindow
/* data items */ /* data items */
TNotesCollection Notes; TNotesCollection Notes;
bool runMinimized; bool runMinimized;
QListViewItem* lastSought; TQListViewItem* lastSought;
QString soughtText; TQString soughtText;
QTimer* AutosaveTimer; TQTimer* AutosaveTimer;
/* for saving backups */ /* for saving backups */
QUrlOperator URLOperator; TQUrlOperator URLOperator;
/* false by default, set to true on queryClose() */ /* false by default, set to true on queryClose() */
bool shuttingDown; bool shuttingDown;
/* actions */ /* actions */
@ -87,7 +88,7 @@ class Knowit : public KMainWindow
enum {StatusText = 1, StatusOvr = 2}; enum {StatusText = 1, StatusOvr = 2};
public: public:
/** Constructor of main window */ /** Constructor of main window */
Knowit(QWidget* parent=0, const char *name=0); Knowit(TQWidget* tqparent=0, const char *name=0);
/** Standard destructor */ /** Standard destructor */
~Knowit(); ~Knowit();
/** Opens document */ /** Opens document */
@ -108,23 +109,23 @@ class Knowit : public KMainWindow
/** Finds and shows next occurence of currently sought text /** Finds and shows next occurence of currently sought text
- or show message that it couldn't be found */ - or show message that it couldn't be found */
void find(QListViewItem* start = 0); void tqfind(TQListViewItem* start = 0);
/** Returns true if notes or current text were modified */ /** Returns true if notes or current text were modified */
bool modified(); bool modified();
/** Reimplemented from QWidget to prevent from closing when docked */ /** Reimplemented from TQWidget to prevent from closing when docked */
virtual void closeEvent(QCloseEvent* e); virtual void closeEvent(TQCloseEvent* e);
/** Apply current configuration */ /** Apply current configuration */
void applyOptions(const KnowitOptions& O, bool store = true); void applyOptions(const KnowitOptions& O, bool store = true);
/** Returns current note */ /** Returns current note */
TNote* currentNote() const; TNote* currentNote() const;
public slots: public slots:
/** Status bar text has changed - displays it */ /** tqStatus bar text has changed - displays it */
void slotStatusMsg(const QString& text); void slotStatusMsg(const TQString& text);
/** Shows requested popup menu for notes */ /** Shows requested popup menu for notes */
void slotContextMenu(KListView*, QListViewItem*, const QPoint&); void slotContextMenu(KListView*, TQListViewItem*, const TQPoint&);
/** Shows given note */ /** Shows given note */
void slotNoteChanged(QListViewItem* item); void slotNoteChanged(TQListViewItem* item);
/** Add same-level note */ /** Add same-level note */
void slotNoteAdd(); void slotNoteAdd();
/** Adds subnote */ /** Adds subnote */
@ -150,7 +151,7 @@ class Knowit : public KMainWindow
void slotNoteMoveRight(); void slotNoteMoveRight();
/** Current item has changed - updates associated text and shows next */ /** Current item has changed - updates associated text and shows next */
void slotItemChanged(QListViewItem*); void slotItemChanged(TQListViewItem*);
/** Resets to a new file */ /** Resets to a new file */
void slotFileNew(); void slotFileNew();
/** Prompts for a file to open and opens it */ /** Prompts for a file to open and opens it */
@ -179,11 +180,11 @@ class Knowit : public KMainWindow
void slotEditUnderline(); void slotEditUnderline();
/** Changes color of selected/current text */ /** Changes color of selected/current text */
void slotEditColor(); void slotEditColor();
/** Changes vertical alignment to superscript */ /** Changes vertical tqalignment to superscript */
void slotEditSuperscript(); void slotEditSuperscript();
/** Changes vertical alignment to subscript */ /** Changes vertical tqalignment to subscript */
void slotEditSubscript(); void slotEditSubscript();
/** Restores normal vertical alignment */ /** Restores normal vertical tqalignment */
void slotEditNormal(); void slotEditNormal();
/** Prompts for text and shows note containing it */ /** Prompts for text and shows note containing it */
void slotEditFind(); void slotEditFind();
@ -199,7 +200,7 @@ class Knowit : public KMainWindow
void slotEditAlignJustify(); void slotEditAlignJustify();
/** Centers text */ /** Centers text */
void slotEditAlignCenter(); void slotEditAlignCenter();
/** Change selected paragraphs to list. Warning: uses obsolete Qt function */ /** Change selected paragraphs to list. Warning: uses obsolete TQt function */
void slotEditListBullet(); void slotEditListBullet();
void slotEditListNumber(); void slotEditListNumber();
void slotEditListUpper(); void slotEditListUpper();
@ -235,13 +236,13 @@ class Knowit : public KMainWindow
void slotRawTextMode(); void slotRawTextMode();
/** Shows requested popup menu for links */ /** Shows requested popup menu for links */
void slotContextLinksMenu(QListBoxItem* item, const QPoint&); void slotContextLinksMenu(TQListBoxItem* item, const TQPoint&);
/** show current attachment **/ /** show current attachment **/
void slotShowAttachment(QListBoxItem* i); void slotShowAttachment(TQListBoxItem* i);
/** Add link **/ /** Add link **/
void slotLinkAdd(); void slotLinkAdd();
/** Handle dropped link **/ /** Handle dropped link **/
void slotLinkDropped(const QString& s, int flags); void slotLinkDropped(const TQString& s, int flags);
/** Remove link **/ /** Remove link **/
void slotLinkRemove(); void slotLinkRemove();
/** Open link **/ /** Open link **/

@ -26,7 +26,7 @@ KnowitApplication::~KnowitApplication()
{ {
} }
void KnowitApplication::commitData(QSessionManager& sm) void KnowitApplication::commitData(TQSessionManager& sm)
{ {
mcloseByLogout = true; mcloseByLogout = true;
KUniqueApplication::commitData(sm); KUniqueApplication::commitData(sm);

@ -22,18 +22,19 @@
class KnowitApplication : public KUniqueApplication class KnowitApplication : public KUniqueApplication
{ {
Q_OBJECT Q_OBJECT
TQ_OBJECT
public: public:
KnowitApplication(bool allowStyles = true, bool GUIEnabled = true); KnowitApplication(bool allowStyles = true, bool GUIEnabled = true);
~KnowitApplication(); ~KnowitApplication();
/** Commits all Application-relevant data on shutdown. /** Commits all Application-relevant data on shutdown.
* *
* This function is called when the QSessionManager wants to close the * This function is called when the TQSessionManager wants to close the
* Application. It is reimplemented to set the boolean sessionClose flag. * Application. It is reimplemented to set the boolean sessionClose flag.
* *
* @param sm The QSessionManager object. * @param sm The TQSessionManager object.
*/ */
virtual void commitData(QSessionManager& sm); virtual void commitData(TQSessionManager& sm);
/** Returns TRUE if the Application is closed by the session manager. */ /** Returns TRUE if the Application is closed by the session manager. */
bool closeByLogout() {return(mcloseByLogout);} bool closeByLogout() {return(mcloseByLogout);}

@ -17,10 +17,10 @@
#include "knowitchooser.h" #include "knowitchooser.h"
#include <qcheckbox.h> #include <tqcheckbox.h>
#include <qlabel.h> #include <tqlabel.h>
#include <qlayout.h> #include <tqlayout.h>
#include <qvbox.h> #include <tqvbox.h>
#include <kcombobox.h> #include <kcombobox.h>
#include <klocale.h> #include <klocale.h>
@ -29,30 +29,30 @@
KnowitChooser::KnowitChooser(int flags) KnowitChooser::KnowitChooser(int flags)
: KDialogBase(Plain, i18n("Export"), Ok|Cancel, Ok) : KDialogBase(Plain, i18n("Export"), Ok|Cancel, Ok)
{ {
QLabel* l1; TQLabel* l1;
QLabel* l2; TQLabel* l2;
QVBoxLayout* layout = new QVBoxLayout(plainPage()); TQVBoxLayout* tqlayout = new TQVBoxLayout(plainPage());
layout->addWidget(l1 = new QLabel(i18n("&Exported notes:"), plainPage())); tqlayout->addWidget(l1 = new TQLabel(i18n("&Exported notes:"), plainPage()));
layout->addWidget(notes = new KComboBox(plainPage(), "Notes")); tqlayout->addWidget(notes = new KComboBox(plainPage(), "Notes"));
l1->setBuddy(notes); l1->setBuddy(notes);
notes->insertItem(i18n("All")); notes->insertItem(i18n("All"));
notes->insertItem(i18n("Current with children")); notes->insertItem(i18n("Current with tqchildren"));
notes->insertItem(i18n("Current only")); notes->insertItem(i18n("Current only"));
layout->addWidget(l2 = new QLabel(i18n("&Encoding:"), plainPage())); tqlayout->addWidget(l2 = new TQLabel(i18n("&Encoding:"), plainPage()));
layout->addWidget(charset = new KComboBox(plainPage(), "Encoding")); tqlayout->addWidget(charset = new KComboBox(plainPage(), "Encoding"));
l2->setBuddy(charset); l2->setBuddy(charset);
charset->insertItem(i18n("Local (8-bit)")); charset->insertItem(i18n("Local (8-bit)"));
charset->insertItem(i18n("UTF-8")); charset->insertItem(i18n("UTF-8"));
layout->addItem(new QSpacerItem(0, 10)); tqlayout->addItem(new TQSpacerItem(0, 10));
layout->addWidget(enumerate = new QCheckBox(i18n("Numbered titles"), tqlayout->addWidget(enumerate = new TQCheckBox(i18n("Numbered titles"),
plainPage(), "Numbered")); plainPage(), "Numbered"));
layout->addWidget(toc = new QCheckBox(i18n("Table of contents"), tqlayout->addWidget(toc = new TQCheckBox(i18n("Table of contents"),
plainPage(), "TOC")); plainPage(), "TOC"));
layout->addWidget(rule = new QCheckBox(i18n("Rule betweeen notes"), tqlayout->addWidget(rule = new TQCheckBox(i18n("Rule betweeen notes"),
plainPage(), "Rule")); plainPage(), "Rule"));
layout->addWidget(style = new QCheckBox(i18n("Use editor font and colors"), tqlayout->addWidget(style = new TQCheckBox(i18n("Use editor font and colors"),
plainPage(), "Style")); plainPage(), "Style"));
setChoice(flags); setChoice(flags);
} }

@ -20,7 +20,7 @@
#include <kdialogbase.h> #include <kdialogbase.h>
class QCheckBox; class TQCheckBox;
class KComboBox; class KComboBox;
/** /**
@ -29,13 +29,14 @@ class KComboBox;
class KnowitChooser : public KDialogBase { class KnowitChooser : public KDialogBase {
Q_OBJECT Q_OBJECT
TQ_OBJECT
protected: protected:
KComboBox* notes; KComboBox* notes;
KComboBox* charset; KComboBox* charset;
QCheckBox* enumerate; TQCheckBox* enumerate;
QCheckBox* toc; TQCheckBox* toc;
QCheckBox* rule; TQCheckBox* rule;
QCheckBox* style; TQCheckBox* style;
public: public:
enum {SaveCurrent = 0, SaveSubnotes = 0x0001, SaveAll = 0x0002, UseUTF8 = 0x0040, enum {SaveCurrent = 0, SaveSubnotes = 0x0001, SaveAll = 0x0002, UseUTF8 = 0x0040,
Enumerate = 0x0080, AddRule = 0x0100, Style = 0x0200, TOC = 0x0400}; Enumerate = 0x0080, AddRule = 0x0100, Style = 0x0200, TOC = 0x0400};

@ -18,42 +18,42 @@
#include "knowitedit.h" #include "knowitedit.h"
#include <kurldrag.h> #include <kurldrag.h>
KnowitEdit::KnowitEdit(const QString& text, const QString& context, QWidget* parent, KnowitEdit::KnowitEdit(const TQString& text, const TQString& context, TQWidget* tqparent,
const char* name) : KTextEdit(text, context, parent, name), swapEOL(true) const char* name) : KTextEdit(text, context, tqparent, name), swapEOL(true)
{ {
setAcceptDrops(true); setAcceptDrops(true);
} }
KnowitEdit::KnowitEdit(QWidget* parent, const char* name) : KTextEdit(parent, name), KnowitEdit::KnowitEdit(TQWidget* tqparent, const char* name) : KTextEdit(tqparent, name),
swapEOL(true) swapEOL(true)
{ {
} }
void KnowitEdit::keyPressEvent(QKeyEvent* e) void KnowitEdit::keyPressEvent(TQKeyEvent* e)
{ {
if (swapEOL && if (swapEOL &&
(e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) && (e->key() == TQt::Key_Enter || e->key() == TQt::Key_Return) &&
(e->state() | (Qt::NoButton | Qt::ControlButton | Qt::Keypad) == (e->state() | (Qt::NoButton | TQt::ControlButton | TQt::Keypad) ==
(Qt::NoButton | Qt::ControlButton | Qt::Keypad))) { (Qt::NoButton | TQt::ControlButton | TQt::Keypad))) {
QKeyEvent* e1 = new QKeyEvent(QKeyEvent::KeyPress, e->key(), TQKeyEvent* e1 = new TQKeyEvent(TQKeyEvent::KeyPress, e->key(),
e->ascii(), e->state() ^ Qt::ControlButton, e->text(), e->isAutoRepeat(), e->ascii(), e->state() ^ TQt::ControlButton, e->text(), e->isAutoRepeat(),
e->count()); e->count());
e->ignore(); e->ignore();
QTextEdit::keyPressEvent(e1); TQTextEdit::keyPressEvent(e1);
} }
else QTextEdit::keyPressEvent(e); else TQTextEdit::keyPressEvent(e);
} }
void KnowitEdit::contentsDragEnterEvent(QDragEnterEvent* event) void KnowitEdit::contentsDragEnterEvent(TQDragEnterEvent* event)
{ {
if (KURLDrag::canDecode(event)) if (KURLDrag::canDecode(event))
event->accept(true); event->accept(true);
else QTextEdit::contentsDragEnterEvent(event); else TQTextEdit::contentsDragEnterEvent(event);
} }
void KnowitEdit::contentsDropEvent(QDropEvent* event) void KnowitEdit::contentsDropEvent(TQDropEvent* event)
{ {
if (KURLDrag::canDecode(event)) { if (KURLDrag::canDecode(event)) {
KURL::List L; KURL::List L;
@ -61,6 +61,6 @@ void KnowitEdit::contentsDropEvent(QDropEvent* event)
for (uint i=0; i<L.count(); i++) for (uint i=0; i<L.count(); i++)
emit textDropped(L[i].url(), L.count() > 1); emit textDropped(L[i].url(), L.count() > 1);
} }
else QTextEdit::contentsDropEvent(event); else TQTextEdit::contentsDropEvent(event);
} }

@ -21,16 +21,17 @@
class KnowitEdit : public KTextEdit class KnowitEdit : public KTextEdit
{ {
Q_OBJECT Q_OBJECT
TQ_OBJECT
public: public:
bool swapEOL; bool swapEOL;
KnowitEdit(const QString& text, const QString& context=QString::null, KnowitEdit(const TQString& text, const TQString& context=TQString(),
QWidget* parent=0, const char* name = 0); TQWidget* tqparent=0, const char* name = 0);
KnowitEdit(QWidget* parent=0, const char* name = 0); KnowitEdit(TQWidget* tqparent=0, const char* name = 0);
virtual void keyPressEvent(QKeyEvent* e); virtual void keyPressEvent(TQKeyEvent* e);
virtual void contentsDragEnterEvent(QDragEnterEvent* event); virtual void contentsDragEnterEvent(TQDragEnterEvent* event);
virtual void contentsDropEvent(QDropEvent* event); virtual void contentsDropEvent(TQDropEvent* event);
signals: signals:
void textDropped(const QString& s, int flags); void textDropped(const TQString& s, int flags);
}; };

@ -18,10 +18,10 @@
#include "knowitlink.h" #include "knowitlink.h"
#include "notes.h" #include "notes.h"
#include <qtoolbutton.h> #include <tqtoolbutton.h>
#include <qlabel.h> #include <tqlabel.h>
#include <qlayout.h> #include <tqlayout.h>
#include <qvbox.h> #include <tqvbox.h>
#include <kfiledialog.h> #include <kfiledialog.h>
#include <kglobal.h> #include <kglobal.h>
@ -33,30 +33,30 @@
KnowitLinkDialog::KnowitLinkDialog() KnowitLinkDialog::KnowitLinkDialog()
: KDialogBase(Plain, i18n("Modify link"), Ok|Cancel, Ok) : KDialogBase(Plain, i18n("Modify link"), Ok|Cancel, Ok)
{ {
QVBoxLayout* layout = new QVBoxLayout(plainPage()); TQVBoxLayout* tqlayout = new TQVBoxLayout(plainPage());
QHBox* typeBox = new QHBox(plainPage()); TQHBox* typeBox = new TQHBox(plainPage());
layout->addWidget(typeBox); tqlayout->addWidget(typeBox);
new QLabel(i18n("Referenced item:"), typeBox); new TQLabel(i18n("Referenced item:"), typeBox);
linkType = new KComboBox(typeBox, "LinkType"); linkType = new KComboBox(typeBox, "LinkType");
linkType->insertItem(i18n("File or URL")); linkType->insertItem(i18n("File or URL"));
linkType->insertItem(i18n("KnowIt note")); linkType->insertItem(i18n("KnowIt note"));
layout->addItem(new QSpacerItem(0, 5)); tqlayout->addItem(new TQSpacerItem(0, 5));
QHBox* editBox = new QHBox(plainPage()); TQHBox* editBox = new TQHBox(plainPage());
layout->addWidget(editBox); tqlayout->addWidget(editBox);
linkValue = new KLineEdit("Link text", editBox); linkValue = new KLineEdit("Link text", editBox);
linkValue->setMinimumWidth(300); linkValue->setMinimumWidth(300);
browse = new QToolButton(editBox, "Browse"); browse = new TQToolButton(editBox, "Browse");
browse->setIconSet(QIconSet(KGlobal::iconLoader()->loadIcon("fileopen", browse->setIconSet(TQIconSet(KGlobal::iconLoader()->loadIcon("fileopen",
KIcon::Toolbar, KIcon::SizeSmall))); KIcon::Toolbar, KIcon::SizeSmall)));
layout->addItem(new QSpacerItem(0, 5)); tqlayout->addItem(new TQSpacerItem(0, 5));
layout->addWidget(new QLabel(i18n("Link description:"), plainPage())); tqlayout->addWidget(new TQLabel(i18n("Link description:"), plainPage()));
layout->addWidget(linkDescription = new KLineEdit("Link description", plainPage())); tqlayout->addWidget(linkDescription = new KLineEdit("Link description", plainPage()));
connect(browse, SIGNAL(clicked()), this, SLOT(slotBrowse())); connect(browse, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBrowse()));
connect(linkType, SIGNAL(activated(int)), this, SLOT(slotTypeChanged(int))); connect(linkType, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotTypeChanged(int)));
} }
KnowitLinkDialog::~KnowitLinkDialog() KnowitLinkDialog::~KnowitLinkDialog()
@ -72,7 +72,7 @@ bool KnowitLinkDialog::modifyLink(TNoteLink& link)
else else
linkValue->setText(link.link); linkValue->setText(link.link);
slotTypeChanged(linkType->currentItem()); slotTypeChanged(linkType->currentItem());
if (exec() == QDialog::Accepted) { if (exec() == TQDialog::Accepted) {
link.description = linkDescription->text(); link.description = linkDescription->text();
if (linkType->currentItem()) if (linkType->currentItem())
link.link = "knowit://" + linkValue->text(); link.link = "knowit://" + linkValue->text();
@ -86,7 +86,7 @@ bool KnowitLinkDialog::modifyLink(TNoteLink& link)
void KnowitLinkDialog::slotBrowse() void KnowitLinkDialog::slotBrowse()
{ {
KURL url=KFileDialog::getOpenURL(QString::null, KURL url=KFileDialog::getOpenURL(TQString(),
i18n("*|All files"), this, i18n("Choose link...")); i18n("*|All files"), this, i18n("Choose link..."));
if (!url.isEmpty()) { if (!url.isEmpty()) {
linkValue->setText(url.url()); linkValue->setText(url.url());

@ -23,15 +23,16 @@
class KComboBox; class KComboBox;
class KLineEdit; class KLineEdit;
class TNoteLink; class TNoteLink;
class QToolButton; class TQToolButton;
class KnowitLinkDialog : public KDialogBase { class KnowitLinkDialog : public KDialogBase {
Q_OBJECT Q_OBJECT
TQ_OBJECT
protected: protected:
KComboBox* linkType; KComboBox* linkType;
KLineEdit* linkValue; KLineEdit* linkValue;
KLineEdit* linkDescription; KLineEdit* linkDescription;
QToolButton* browse; TQToolButton* browse;
public: public:
KnowitLinkDialog(); KnowitLinkDialog();
~KnowitLinkDialog(); ~KnowitLinkDialog();

@ -16,21 +16,21 @@
***************************************************************************/ ***************************************************************************/
#include "knowitlinks.h" #include "knowitlinks.h"
#include <qevent.h> #include <tqevent.h>
#include <kurldrag.h> #include <kurldrag.h>
KnowitLinks::KnowitLinks(QWidget* parent, const char* name) KnowitLinks::KnowitLinks(TQWidget* tqparent, const char* name)
: KListBox(parent, name) : KListBox(tqparent, name)
{ {
setAcceptDrops(true); setAcceptDrops(true);
} }
void KnowitLinks::dragEnterEvent(QDragEnterEvent* event) void KnowitLinks::dragEnterEvent(TQDragEnterEvent* event)
{ {
event->accept(KURLDrag::canDecode(event)); event->accept(KURLDrag::canDecode(event));
} }
void KnowitLinks::dropEvent(QDropEvent* event) void KnowitLinks::dropEvent(TQDropEvent* event)
{ {
if (KURLDrag::canDecode(event)) { if (KURLDrag::canDecode(event)) {
KURL::List L; KURL::List L;
@ -40,15 +40,15 @@ void KnowitLinks::dropEvent(QDropEvent* event)
} }
} }
void KnowitLinks::keyPressEvent(QKeyEvent* e) void KnowitLinks::keyPressEvent(TQKeyEvent* e)
{ {
if (currentItem() != -1 && (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return)) { if (currentItem() != -1 && (e->key() == TQt::Key_Enter || e->key() == TQt::Key_Return)) {
e->ignore(); e->ignore();
if ((e->state() | Qt::NoButton | Qt::Keypad) == if ((e->state() | Qt::NoButton | TQt::Keypad) ==
(Qt::NoButton | Qt::Keypad)) emit linkOpen(); (Qt::NoButton | TQt::Keypad)) emit linkOpen();
else emit linkOpenWith(); else emit linkOpenWith();
} }
else if (currentItem() != -1 && e->key() == Qt::Key_Delete) { else if (currentItem() != -1 && e->key() == TQt::Key_Delete) {
e->ignore(); e->ignore();
emit linkRemove(); emit linkRemove();
} }

@ -19,21 +19,22 @@
#define __KNOWIT_LINKS_H__ #define __KNOWIT_LINKS_H__
#include <klistbox.h> #include <klistbox.h>
class QDropEvent; class TQDropEvent;
class QKeyEvent; class TQKeyEvent;
class QDragEnterEvent; class TQDragEnterEvent;
class KnowitLinks : public KListBox class KnowitLinks : public KListBox
{ {
Q_OBJECT Q_OBJECT
TQ_OBJECT
public: public:
KnowitLinks(QWidget* parent=0, const char* name = 0); KnowitLinks(TQWidget* tqparent=0, const char* name = 0);
protected: protected:
virtual void dragEnterEvent(QDragEnterEvent* event); virtual void dragEnterEvent(TQDragEnterEvent* event);
virtual void dropEvent(QDropEvent* event); virtual void dropEvent(TQDropEvent* event);
virtual void keyPressEvent(QKeyEvent* e); virtual void keyPressEvent(TQKeyEvent* e);
signals: signals:
void textDropped(const QString& s, int flags); void textDropped(const TQString& s, int flags);
void linkRemove(); void linkRemove();
void linkOpen(); void linkOpen();
void linkOpenWith(); void linkOpenWith();

@ -2,7 +2,7 @@
knowitpref.cpp - description knowitpref.cpp - description
------------------- -------------------
begin : czw lis 28 2002 begin : czw lis 28 2002
copyright : (C) 2002-2004 by Micha³ Rudolf copyright : (C) 2002-2004 by Micha<EFBFBD> Rudolf
email : mrudolf@kdewebdev.org email : mrudolf@kdewebdev.org
***************************************************************************/ ***************************************************************************/
@ -18,16 +18,16 @@
#include "knowitpref.h" #include "knowitpref.h"
#include <qcheckbox.h> #include <tqcheckbox.h>
#include <qcolor.h> #include <tqcolor.h>
#include <qtoolbutton.h> #include <tqtoolbutton.h>
#include <qspinbox.h> #include <tqspinbox.h>
#include <qdatetime.h> #include <tqdatetime.h>
#include <qlayout.h> #include <tqlayout.h>
#include <qwhatsthis.h> #include <tqwhatsthis.h>
#include <qstring.h> #include <tqstring.h>
#include <qlabel.h> #include <tqlabel.h>
#include <qvbox.h> #include <tqvbox.h>
#include <kconfig.h> #include <kconfig.h>
#include <kcombobox.h> #include <kcombobox.h>
@ -95,7 +95,7 @@ void KnowitOptions::read(KConfig* config)
horizontalSplit = config->readNumEntry("HorizontalSplit", true); horizontalSplit = config->readNumEntry("HorizontalSplit", true);
defaultName = config->readEntry("DefaultName", i18n("New note")); defaultName = config->readEntry("DefaultName", i18n("New note"));
alternateTree = config->readBoolEntry("AlternateTree", false); alternateTree = config->readBoolEntry("AlternateTree", false);
alternateColor = config->readEntry("AlternateColor", QString("LightYellow")); alternateColor = config->readEntry("AlternateColor", TQString("LightYellow"));
autoCollapse = config->readBoolEntry("AutoCollapse", false); autoCollapse = config->readBoolEntry("AutoCollapse", false);
unconditionalSave = config->readBoolEntry("UnconditionalSave", false); unconditionalSave = config->readBoolEntry("UnconditionalSave", false);
backup = config->readBoolEntry("Backup", true); backup = config->readBoolEntry("Backup", true);
@ -109,15 +109,15 @@ void KnowitOptions::read(KConfig* config)
enterBreakLine = config->readBoolEntry("EnterBreakLine", true); enterBreakLine = config->readBoolEntry("EnterBreakLine", true);
tabfocus = config->readBoolEntry("TabFocus", false); tabfocus = config->readBoolEntry("TabFocus", false);
customColors = config->readBoolEntry("CustomColors", false); customColors = config->readBoolEntry("CustomColors", false);
foreEditColor = config->readEntry("ForeEditColor", QString("Black")); foreEditColor = config->readEntry("ForeEditColor", TQString("Black"));
backEditColor = config->readEntry("BackEditColor", QString("White")); backEditColor = config->readEntry("BackEditColor", TQString("White"));
customFont = config->readBoolEntry("CustomFont", false); customFont = config->readBoolEntry("CustomFont", false);
fontFamily = config->readEntry("FontFamily", QString("Helvetica")); fontFamily = config->readEntry("FontFamily", TQString("Helvetica"));
fontSize = config->readNumEntry("FontSize", 10); // KDE-Default? fontSize = config->readNumEntry("FontSize", 10); // KDE-Default?
config->setGroup("Templates"); config->setGroup("Templates");
insertDateFormat = config->readEntry("InsertDateFormatString", QString("ddd d MMM yyyy, hh:mm:ss")); insertDateFormat = config->readEntry("InsertDateFormatString", TQString("ddd d MMM yyyy, hh:mm:ss"));
insertDateColor = config->readEntry("InsertDateColor", QString("Blue")); insertDateColor = config->readEntry("InsertDateColor", TQString("Blue"));
insertDateBold = config->readBoolEntry("InsertDateBold", false); insertDateBold = config->readBoolEntry("InsertDateBold", false);
insertDateItalic = config->readBoolEntry("InsertDateItalic", true); insertDateItalic = config->readBoolEntry("InsertDateItalic", true);
insertDateUnderline = config->readBoolEntry("InsertDateUnderline", false); insertDateUnderline = config->readBoolEntry("InsertDateUnderline", false);
@ -131,118 +131,118 @@ void KnowitOptions::read(KConfig* config)
KnowitPreferences::KnowitPreferences() KnowitPreferences::KnowitPreferences()
: KDialogBase(IconList, i18n("KnowIt Preferences"), Ok|Cancel, Ok) : KDialogBase(IconList, i18n("KnowIt Preferences"), Ok|Cancel, Ok)
{ {
QFrame* page; TQFrame* page;
QVBoxLayout* layout; TQVBoxLayout* tqlayout;
/* first page: General */ /* first page: General */
page = addPage(i18n("General"), i18n("General options"), page = addPage(i18n("General"), i18n("General options"),
KGlobal::iconLoader()->loadIcon(QString("configure"), KIcon::Toolbar, KIcon::SizeMedium)); KGlobal::iconLoader()->loadIcon(TQString("configure"), KIcon::Toolbar, KIcon::SizeMedium));
layout = new QVBoxLayout(page, 0, spacingHint()); tqlayout = new TQVBoxLayout(page, 0, spacingHint());
layout->addWidget(docked = new QCheckBox(i18n("&Dock in System tray"), page, "Dock")); tqlayout->addWidget(docked = new TQCheckBox(i18n("&Dock in System tray"), page, "Dock"));
layout->addWidget(reopen = new QCheckBox(i18n("Open &last file on startup"), page, "Reopen")); tqlayout->addWidget(reopen = new TQCheckBox(i18n("Open &last file on startup"), page, "Reopen"));
QHBox* autosaveBox = new QHBox(page); TQHBox* autosaveBox = new TQHBox(page);
layout->addWidget(autosaveBox); tqlayout->addWidget(autosaveBox);
new QLabel(i18n("Autosave:"), autosaveBox); new TQLabel(i18n("Autosave:"), autosaveBox);
autosave = new QSpinBox(0, 120, 5, autosaveBox, "Autosave"); autosave = new TQSpinBox(0, 120, 5, autosaveBox, "Autosave");
autosave->setPrefix(i18n("every ")); autosave->setPrefix(i18n("every "));
autosave->setSuffix(i18n(" min.")); autosave->setSuffix(i18n(" min."));
autosave->setSpecialValueText(i18n("Never")); autosave->setSpecialValueText(i18n("Never"));
QWhatsThis::add(autosave, i18n("Current file will be automatically saved " TQWhatsThis::add(autosave, i18n("Current file will be automatically saved "
"after the specified interval. Set to <i>never</i> to disable autosave.")); "after the specified interval. Set to <i>never</i> to disable autosave."));
layout->addWidget(unconditionalSave = new QCheckBox(i18n("Automatically save file on e&xit"), tqlayout->addWidget(unconditionalSave = new TQCheckBox(i18n("Automatically save file on e&xit"),
page, "UnconditionalSave")); page, "UnconditionalSave"));
QWhatsThis::add(unconditionalSave, i18n("Current file will be automatically saved " TQWhatsThis::add(unconditionalSave, i18n("Current file will be automatically saved "
"on exit without confirmation.")); "on exit without confirmation."));
layout->addWidget(backup = new QCheckBox(i18n("Create &backups"), tqlayout->addWidget(backup = new TQCheckBox(i18n("Create &backups"),
page, "Backup")); page, "Backup"));
QWhatsThis::add(backup, i18n("Create backup of current document before it is saved.")); TQWhatsThis::add(backup, i18n("Create backup of current document before it is saved."));
layout->addWidget(multipleInstances = new QCheckBox(i18n("Allow &multiple instances of KnowIt"), tqlayout->addWidget(multipleInstances = new TQCheckBox(i18n("Allow &multiple instances of KnowIt"),
page, "Instances")); page, "Instances"));
QWhatsThis::add(multipleInstances, i18n("If this option is disabled, only one " TQWhatsThis::add(multipleInstances, i18n("If this option is disabled, only one "
"instance of KnowIt will be allowed. If there is another instance already running, " "instance of KnowIt will be allowed. If there is another instance already running, "
"it will be automatically activated instead of running new one.")); "it will be automatically activated instead of running new one."));
layout->addStretch(1); tqlayout->addStretch(1);
/* second page: Interface */ /* second page: Interface */
page = addPage(i18n("Interface"), i18n("Interface options"), page = addPage(i18n("Interface"), i18n("Interface options"),
KGlobal::iconLoader()->loadIcon(QString("misc"), KIcon::Toolbar, KIcon::SizeMedium)); KGlobal::iconLoader()->loadIcon(TQString("misc"), KIcon::Toolbar, KIcon::SizeMedium));
layout = new QVBoxLayout(page, 0, spacingHint()); tqlayout = new TQVBoxLayout(page, 0, spacingHint());
layout->addWidget(horizontalSplit = new QCheckBox(i18n("Split window &horizontally"), page, "Split")); tqlayout->addWidget(horizontalSplit = new TQCheckBox(i18n("Split window &horizontally"), page, "Split"));
QWhatsThis::add(horizontalSplit, i18n("If this option is set, notes tree will " TQWhatsThis::add(horizontalSplit, i18n("If this option is set, notes tree will "
"be displayed on the left and the editor on the right (this is default).<br>" "be displayed on the left and the editor on the right (this is default).<br>"
"Otherwise notes tree will be displayed at the top and the editor at the bottom.")); "Otherwise notes tree will be displayed at the top and the editor at the bottom."));
QHBox* defaultNameBox = new QHBox(page); TQHBox* defaultNameBox = new TQHBox(page);
layout->addWidget(defaultNameBox); tqlayout->addWidget(defaultNameBox);
new QLabel(i18n("Default note name:"), defaultNameBox); new TQLabel(i18n("Default note name:"), defaultNameBox);
defaultName = new KLineEdit(defaultNameBox, "DefaultName"); defaultName = new KLineEdit(defaultNameBox, "DefaultName");
QWhatsThis::add(defaultName, i18n("Default name for new notes. It would be " TQWhatsThis::add(defaultName, i18n("Default name for new notes. It would be "
"autoselected, so if you often copy text using mouse selection, you may " "autoselected, so if you often copy text using mouse selection, you may "
"consider setting default name to none.")); "consider setting default name to none."));
QHBox* linkBox = new QHBox(page); TQHBox* linkBox = new TQHBox(page);
layout->addWidget(linkBox); tqlayout->addWidget(linkBox);
new QLabel(i18n("Link format:"), linkBox); new TQLabel(i18n("Link format:"), linkBox);
linkFormat = new KComboBox(linkBox, "LinkFormat"); linkFormat = new KComboBox(linkBox, "LinkFormat");
linkFormat->insertItem(i18n("Description (link)")); linkFormat->insertItem(i18n("Description (link)"));
linkFormat->insertItem(i18n("Link (description)")); linkFormat->insertItem(i18n("Link (description)"));
linkFormat->insertItem(i18n("Link only")); linkFormat->insertItem(i18n("Link only"));
linkFormat->insertItem(i18n("Description only")); linkFormat->insertItem(i18n("Description only"));
QHBox* alternateBox = new QHBox(page); TQHBox* alternateBox = new TQHBox(page);
layout->addWidget(alternateBox); tqlayout->addWidget(alternateBox);
alternateTree = new QCheckBox(i18n("Alternate colors in tree"), alternateBox, "Alternate"); alternateTree = new TQCheckBox(i18n("Alternate colors in tree"), alternateBox, "Alternate");
alternateColor = new KColorButton(QColor("White"), alternateBox, "AlternateColor"); alternateColor = new KColorButton(TQColor("White"), alternateBox, "AlternateColor");
layout->addWidget(autoCollapse = new QCheckBox(i18n("Automatically collapse other notes"), page, "AutoCollapse")); tqlayout->addWidget(autoCollapse = new TQCheckBox(i18n("Automatically collapse other notes"), page, "AutoCollapse"));
QWhatsThis::add(autoCollapse, i18n("If this option is set, only current subtree " TQWhatsThis::add(autoCollapse, i18n("If this option is set, only current subtree "
"will be visible, other notes will be automatically collapsed.")); "will be visible, other notes will be automatically collapsed."));
layout->addStretch(1); tqlayout->addStretch(1);
/* third page: Editor */ /* third page: Editor */
page = addPage(i18n("Editor"), i18n("Editor options"), page = addPage(i18n("Editor"), i18n("Editor options"),
KGlobal::iconLoader()->loadIcon(QString("edit"), KIcon::Toolbar, KIcon::SizeMedium)); KGlobal::iconLoader()->loadIcon(TQString("edit"), KIcon::Toolbar, KIcon::SizeMedium));
layout = new QVBoxLayout(page, 0, spacingHint()); tqlayout = new TQVBoxLayout(page, 0, spacingHint());
layout->addWidget(wordwrap = new QCheckBox(i18n("Use &word wrap"), tqlayout->addWidget(wordwrap = new TQCheckBox(i18n("Use &word wrap"),
page, "WordWrap")); page, "WordWrap"));
layout->addWidget(enterBreakLine = new QCheckBox(i18n("'Enter' ends current line, not paragraph"), tqlayout->addWidget(enterBreakLine = new TQCheckBox(i18n("'Enter' ends current line, not paragraph"),
page, "EnterLineBreak")); page, "EnterLineBreak"));
layout->addWidget(tabfocus = new QCheckBox(i18n("'Tab' in editor changes focus"), tqlayout->addWidget(tabfocus = new TQCheckBox(i18n("'Tab' in editor changes focus"),
page, "TabFocus")); page, "TabFocus"));
#if KDE_VERSION_MAJOR == 3 && KDE_VERSION_MINOR < 1 #if KDE_VERSION_MAJOR == 3 && KDE_VERSION_MINOR < 1
tabfocus->hide(); tabfocus->hide();
#endif #endif
QHBox* colorBox = new QHBox(page); TQHBox* colorBox = new TQHBox(page);
layout->addWidget(colorBox); tqlayout->addWidget(colorBox);
customColors = new QCheckBox(i18n("Use &custom colors"), colorBox, "CustomColors"); customColors = new TQCheckBox(i18n("Use &custom colors"), colorBox, "CustomColors");
editColors = new KDualColorButton(colorBox); editColors = new KDualColorButton(colorBox);
const char fontSizes[] = {4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,24,26,28,32,48,64,0}; const char fontSizes[] = {4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,24,26,28,32,48,64,0};
QStringList fontList; TQStringList fontList;
KFontChooser::getFontList(fontList, false); KFontChooser::getFontList(fontList, false);
QHBox* fontBox = new QHBox(page); TQHBox* fontBox = new TQHBox(page);
layout->addWidget(fontBox); tqlayout->addWidget(fontBox);
customFont = new QCheckBox(i18n("Use custom font:"), fontBox, "customFont"); customFont = new TQCheckBox(i18n("Use custom font:"), fontBox, "customFont");
fontFamily = new KComboBox(true, fontBox); fontFamily = new KComboBox(true, fontBox);
fontFamily->insertStringList(fontList); fontFamily->insertStringList(fontList);
fontSize = new KComboBox(true, fontBox); fontSize = new KComboBox(true, fontBox);
for( int i=0; fontSizes[i] != 0; i++ ){ for( int i=0; fontSizes[i] != 0; i++ ){
fontSize->insertItem(QString().setNum(fontSizes[i]),i); fontSize->insertItem(TQString(TQString().setNum(fontSizes[i])),i);
} }
layout->addStretch(1); tqlayout->addStretch(1);
/* fourth page: Templates */ /* fourth page: Templates */
page = addPage(i18n("Templates"), i18n("Templates configuration"), page = addPage(i18n("Templates"), i18n("Templates configuration"),
KGlobal::iconLoader()->loadIcon(QString("wizard"), KIcon::Toolbar, KIcon::SizeMedium)); KGlobal::iconLoader()->loadIcon(TQString("wizard"), KIcon::Toolbar, KIcon::SizeMedium));
layout = new QVBoxLayout(page, 0, spacingHint()); tqlayout = new TQVBoxLayout(page, 0, spacingHint());
QWhatsThis::add(page, i18n("<html>\n" TQWhatsThis::add(page, i18n("<html>\n"
"<p>These expressions may be used: </p>\n" "<p>These expressions may be used: </p>\n"
"<table>\n" "<table>\n"
"<tr><th>d</th><td>the day as number without a leading zero (1-31)</td></tr>\n" "<tr><th>d</th><td>the day as number without a leading zero (1-31)</td></tr>\n"
@ -265,28 +265,28 @@ KnowitPreferences::KnowitPreferences()
"<tr><th>AP</th><td>use am/pm display</td></tr>\n" "<tr><th>AP</th><td>use am/pm display</td></tr>\n"
"</table></html>")); "</table></html>"));
QHBox* topBox = new QHBox(page); TQHBox* topBox = new TQHBox(page);
layout->addWidget(topBox); tqlayout->addWidget(topBox);
QLabel * label1 = new QLabel(i18n("Date Format: "), topBox); TQLabel * label1 = new TQLabel(i18n("Date Format: "), topBox);
label1->setFixedSize(label1->sizeHint()); label1->setFixedSize(label1->tqsizeHint());
insertDatePreview = new QLabel("", topBox); insertDatePreview = new TQLabel("", topBox);
QHBox *tmpBox = new QHBox(page); TQHBox *tmpBox = new TQHBox(page);
layout->addWidget(tmpBox); tqlayout->addWidget(tmpBox);
insertDateColorButton = new KColorButton(QColor("Blue"), tmpBox, "InsertDateColorButton"); insertDateColorButton = new KColorButton(TQColor("Blue"), tmpBox, "InsertDateColorButton");
insertDateFormatEdit = new KLineEdit(tmpBox, "InsertDateFormatEdit"); insertDateFormatEdit = new KLineEdit(tmpBox, "InsertDateFormatEdit");
insertDateItalicButton = new QToolButton(tmpBox,"InsertDateItalicButton"); insertDateItalicButton = new TQToolButton(tmpBox,"InsertDateItalicButton");
insertDateItalicButton->setIconSet(QIconSet(KGlobal::iconLoader()->loadIcon("text_italic", KIcon::Toolbar))); insertDateItalicButton->setIconSet(TQIconSet(KGlobal::iconLoader()->loadIcon("text_italic", KIcon::Toolbar)));
insertDateItalicButton->setToggleButton(true); insertDateItalicButton->setToggleButton(true);
insertDateBoldButton = new QToolButton(tmpBox,"InsertDateBoldButton"); insertDateBoldButton = new TQToolButton(tmpBox,"InsertDateBoldButton");
insertDateBoldButton->setIconSet(QIconSet(KGlobal::iconLoader()->loadIcon("text_bold", KIcon::Toolbar))); insertDateBoldButton->setIconSet(TQIconSet(KGlobal::iconLoader()->loadIcon("text_bold", KIcon::Toolbar)));
insertDateBoldButton->setToggleButton(true); insertDateBoldButton->setToggleButton(true);
insertDateUnderlineButton = new QToolButton(tmpBox, "InsertDateUnderlineButton"); insertDateUnderlineButton = new TQToolButton(tmpBox, "InsertDateUnderlineButton");
insertDateUnderlineButton->setIconSet(QIconSet(KGlobal::iconLoader()->loadIcon("text_under", KIcon::Toolbar))); insertDateUnderlineButton->setIconSet(TQIconSet(KGlobal::iconLoader()->loadIcon("text_under", KIcon::Toolbar)));
insertDateUnderlineButton->setToggleButton(true); insertDateUnderlineButton->setToggleButton(true);
insertDateColorButton->setFixedSize(insertDateBoldButton->sizeHint()); insertDateColorButton->setFixedSize(insertDateBoldButton->tqsizeHint());
insertDateFormatEdit->setMinimumWidth(6*insertDateBoldButton->sizeHint().width()); insertDateFormatEdit->setMinimumWidth(6*insertDateBoldButton->tqsizeHint().width());
layout->addStretch(1); tqlayout->addStretch(1);
setIconListAllVisible(true); setIconListAllVisible(true);
} }
@ -303,7 +303,7 @@ void KnowitPreferences::setOptions(const KnowitOptions& Options)
horizontalSplit->setChecked(Options.horizontalSplit); horizontalSplit->setChecked(Options.horizontalSplit);
defaultName->setText(Options.defaultName); defaultName->setText(Options.defaultName);
alternateTree->setChecked(Options.alternateTree); alternateTree->setChecked(Options.alternateTree);
alternateColor->setColor(QColor(Options.alternateColor)); alternateColor->setColor(TQColor(Options.alternateColor));
autoCollapse->setChecked(Options.autoCollapse); autoCollapse->setChecked(Options.autoCollapse);
linkFormat->setCurrentItem(Options.linkFormat); linkFormat->setCurrentItem(Options.linkFormat);
@ -311,23 +311,23 @@ void KnowitPreferences::setOptions(const KnowitOptions& Options)
enterBreakLine->setChecked(Options.enterBreakLine); enterBreakLine->setChecked(Options.enterBreakLine);
tabfocus->setChecked(Options.tabfocus); tabfocus->setChecked(Options.tabfocus);
customColors->setChecked(Options.customColors); customColors->setChecked(Options.customColors);
editColors->setForeground(QColor(Options.foreEditColor)); editColors->setForeground(TQColor(Options.foreEditColor));
editColors->setBackground(QColor(Options.backEditColor)); editColors->setBackground(TQColor(Options.backEditColor));
customFont->setChecked(Options.customFont); customFont->setChecked(Options.customFont);
fontFamily->setCurrentText(Options.fontFamily); fontFamily->setCurrentText(Options.fontFamily);
fontSize->setCurrentText(QString().setNum(Options.fontSize)); fontSize->setCurrentText(TQString().setNum(Options.fontSize));
insertDateFormatEdit->setText(Options.insertDateFormat); insertDateFormatEdit->setText(Options.insertDateFormat);
insertDateColorButton->setColor(QColor(Options.insertDateColor)); insertDateColorButton->setColor(TQColor(Options.insertDateColor));
insertDateBoldButton->setOn(Options.insertDateBold); insertDateBoldButton->setOn(Options.insertDateBold);
insertDateItalicButton->setOn(Options.insertDateItalic); insertDateItalicButton->setOn(Options.insertDateItalic);
insertDateUnderlineButton->setOn(Options.insertDateUnderline); insertDateUnderlineButton->setOn(Options.insertDateUnderline);
slotUpdateDatePreview(); slotUpdateDatePreview();
connect(insertDateColorButton, SIGNAL(clicked()), this, SLOT(slotUpdateDatePreview())); connect(insertDateColorButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotUpdateDatePreview()));
connect(insertDateFormatEdit, SIGNAL(textChanged (const QString &)), this, SLOT(slotUpdateDatePreview())); connect(insertDateFormatEdit, TQT_SIGNAL(textChanged (const TQString &)), this, TQT_SLOT(slotUpdateDatePreview()));
connect(insertDateItalicButton, SIGNAL(toggled(bool)), this, SLOT(slotUpdateDatePreview())); connect(insertDateItalicButton, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotUpdateDatePreview()));
connect(insertDateBoldButton, SIGNAL(toggled(bool)), this, SLOT(slotUpdateDatePreview())); connect(insertDateBoldButton, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotUpdateDatePreview()));
connect(insertDateUnderlineButton, SIGNAL(toggled(bool)), this, SLOT(slotUpdateDatePreview())); connect(insertDateUnderlineButton, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotUpdateDatePreview()));
/* non-GUI options */ /* non-GUI options */
firstLink = Options.firstLink; firstLink = Options.firstLink;
@ -374,18 +374,18 @@ KnowitOptions KnowitPreferences::getOptions() const
void KnowitPreferences::slotUpdateDatePreview() void KnowitPreferences::slotUpdateDatePreview()
{ {
QString str = "<html><p align=\"center\">"; TQString str = "<html><p align=\"center\">";
if(insertDateBoldButton->isOn()) str += "<b>"; if(insertDateBoldButton->isOn()) str += "<b>";
if(insertDateItalicButton->isOn()) str +="<i>"; if(insertDateItalicButton->isOn()) str +="<i>";
if(insertDateUnderlineButton->isOn()) str += "<u>"; if(insertDateUnderlineButton->isOn()) str += "<u>";
str += "<font COLOR=\""+insertDateColorButton->color().name()+"\">"; str += "<font COLOR=\""+insertDateColorButton->color().name()+"\">";
str += QString("%1").arg(QDateTime::currentDateTime().toString(insertDateFormatEdit->text())); str += TQString("%1").tqarg(TQDateTime::tqcurrentDateTime().toString(insertDateFormatEdit->text()));
str += "</font>"; str += "</font>";
if(insertDateUnderlineButton->isOn()) str += "</u>"; if(insertDateUnderlineButton->isOn()) str += "</u>";
if(insertDateItalicButton->isOn()) str +="</i>"; if(insertDateItalicButton->isOn()) str +="</i>";
if(insertDateBoldButton->isOn()) str += "</b>"; if(insertDateBoldButton->isOn()) str += "</b>";
str += "</p></html>"; str += "</p></html>";
insertDatePreview->setPaletteBackgroundColor(QColor("White")); insertDatePreview->setPaletteBackgroundColor(TQColor("White"));
insertDatePreview->setText(str); insertDatePreview->setText(str);
} }

@ -18,12 +18,12 @@
#ifndef KNOWITPREF_H #ifndef KNOWITPREF_H
#define KNOWITPREF_H #define KNOWITPREF_H
#include <qstring.h> #include <tqstring.h>
#include <kdialogbase.h> #include <kdialogbase.h>
class QCheckBox; class TQCheckBox;
class QSpinBox; class TQSpinBox;
class QToolButton; class TQToolButton;
class KLineEdit; class KLineEdit;
class KColorButton; class KColorButton;
class KDualColorButton; class KDualColorButton;
@ -43,9 +43,9 @@ public:
/* GUI */ /* GUI */
bool horizontalSplit; bool horizontalSplit;
int linkFormat; int linkFormat;
QString defaultName; TQString defaultName;
bool alternateTree; bool alternateTree;
QString alternateColor; TQString alternateColor;
bool autoCollapse; bool autoCollapse;
/* Links */ /* Links */
bool firstLink; bool firstLink;
@ -54,13 +54,13 @@ public:
bool enterBreakLine; bool enterBreakLine;
bool tabfocus; bool tabfocus;
bool customColors; bool customColors;
QString backEditColor; TQString backEditColor;
QString foreEditColor; TQString foreEditColor;
bool customFont; bool customFont;
QString fontFamily; TQString fontFamily;
int fontSize; int fontSize;
/* Date format */ /* Date format */
QString insertDateFormat, insertDateColor; TQString insertDateFormat, insertDateColor;
bool insertDateBold, insertDateItalic, insertDateUnderline; bool insertDateBold, insertDateItalic, insertDateUnderline;
void save(KConfig* config) const; void save(KConfig* config) const;
void read(KConfig* config); void read(KConfig* config);
@ -72,24 +72,25 @@ public:
class KnowitPreferences : public KDialogBase class KnowitPreferences : public KDialogBase
{ {
Q_OBJECT Q_OBJECT
TQ_OBJECT
private: private:
QCheckBox *docked, *reopen, *horizontalSplit, *multipleInstances, *backup; TQCheckBox *docked, *reopen, *horizontalSplit, *multipleInstances, *backup;
QCheckBox *unconditionalSave; TQCheckBox *unconditionalSave;
QCheckBox *wordwrap, *tabfocus, *customColors; TQCheckBox *wordwrap, *tabfocus, *customColors;
KDualColorButton* editColors; KDualColorButton* editColors;
QCheckBox *enterBreakLine; TQCheckBox *enterBreakLine;
KLineEdit *defaultName; KLineEdit *defaultName;
QCheckBox *alternateTree; TQCheckBox *alternateTree;
KColorButton *alternateColor; KColorButton *alternateColor;
QCheckBox* autoCollapse; TQCheckBox* autoCollapse;
QCheckBox* customFont; TQCheckBox* customFont;
KComboBox *fontFamily, *fontSize; KComboBox *fontFamily, *fontSize;
KComboBox *linkFormat; KComboBox *linkFormat;
KLineEdit *insertDateFormatEdit; KLineEdit *insertDateFormatEdit;
KColorButton *insertDateColorButton; KColorButton *insertDateColorButton;
QLabel *insertDatePreview; TQLabel *insertDatePreview;
QSpinBox* autosave; TQSpinBox* autosave;
QToolButton *insertDateItalicButton, *insertDateBoldButton, *insertDateUnderlineButton; TQToolButton *insertDateItalicButton, *insertDateBoldButton, *insertDateUnderlineButton;
bool firstLink; bool firstLink;
int exportFlags; int exportFlags;
public: public:

@ -18,16 +18,16 @@
#include <kpopupmenu.h> #include <kpopupmenu.h>
#include <klocale.h> #include <klocale.h>
KnowitTray::KnowitTray (QWidget* parent, const char* name) : KnowitTray::KnowitTray (TQWidget* tqparent, const char* name) :
KSystemTray(parent, name) KSystemTray(tqparent, name)
{ {
contextMenu()->insertItem(i18n("&Undock"), parent, contextMenu()->insertItem(i18n("&Undock"), tqparent,
SLOT(slotUndock())); TQT_SLOT(slotUndock()));
} }
void KnowitTray::contextMenuAboutToShow (KPopupMenu* menu) void KnowitTray::contextMenuAboutToShow (KPopupMenu* menu)
{ {
menu->removeItemAt(menu->count()-1); menu->removeItemAt(menu->count()-1);
menu->insertItem(i18n("&Quit"), parent(), SLOT(slotFileQuit())); menu->insertItem(i18n("&Quit"), tqparent(), TQT_SLOT(slotFileQuit()));
} }

@ -22,7 +22,7 @@
class KnowitTray : public KSystemTray class KnowitTray : public KSystemTray
{ {
public: public:
KnowitTray(QWidget* parent=0, const char* name=0); KnowitTray(TQWidget* tqparent=0, const char* name=0);
protected: protected:
virtual void contextMenuAboutToShow (KPopupMenu* menu); virtual void contextMenuAboutToShow (KPopupMenu* menu);
}; };

@ -16,14 +16,14 @@
***************************************************************************/ ***************************************************************************/
#include <klocale.h> #include <klocale.h>
#include <qevent.h> #include <tqevent.h>
#include <qdragobject.h> #include <tqdragobject.h>
#include <qheader.h> #include <tqheader.h>
#include <qwhatsthis.h> #include <tqwhatsthis.h>
#include "knowittree.h" #include "knowittree.h"
KnowitTree::KnowitTree(QWidget* parent, const char* name) KnowitTree::KnowitTree(TQWidget* tqparent, const char* name)
: KListView(parent, name) : KListView(tqparent, name)
{ {
setMinimumSize(150, 150); setMinimumSize(150, 150);
addColumn(i18n("Notes")); addColumn(i18n("Notes"));
@ -35,25 +35,25 @@ KnowitTree::KnowitTree(QWidget* parent, const char* name)
setSorting(-1); setSorting(-1);
setDragAutoScroll(true); setDragAutoScroll(true);
prevItem = 0; prevItem = 0;
QWhatsThis::add(this, i18n("<h2>Notes hierarchy</h2>" TQWhatsThis::add(this, i18n("<h2>Notes hierarchy</h2>"
"Here you can browse notes tree. " "Here you can browse notes tree. "
"You can also add notes using right-click menu, or reorganize them using " "You can also add notes using right-click menu, or reorganize them using "
"drag and drop.")); "drag and drop."));
} }
void KnowitTree::takeNode(QListViewItem* item) void KnowitTree::takeNode(TQListViewItem* item)
{ {
if (item->parent()) if (item->tqparent())
item->parent()->takeItem(item); item->tqparent()->takeItem(item);
else else
takeItem(item); takeItem(item);
} }
void KnowitTree::insertNode(QListViewItem* parent, QListViewItem* item, QListViewItem* after) void KnowitTree::insertNode(TQListViewItem* tqparent, TQListViewItem* item, TQListViewItem* after)
{ {
if (parent) if (tqparent)
parent->insertItem(item); tqparent->insertItem(item);
else else
insertItem(item); insertItem(item);
if (after) if (after)
@ -61,9 +61,9 @@ void KnowitTree::insertNode(QListViewItem* parent, QListViewItem* item, QListVie
} }
void KnowitTree::contentsDragMoveEvent(QDragMoveEvent* event) void KnowitTree::contentsDragMoveEvent(TQDragMoveEvent* event)
{ {
QListViewItem* item = itemAt(event->pos()); TQListViewItem* item = itemAt(event->pos());
/* check if on root decoration */ /* check if on root decoration */
if (!item || event->pos().x() > header()->cellPos(header()->mapToActual(0)) + if (!item || event->pos().x() > header()->cellPos(header()->mapToActual(0)) +
treeStepSize() * (item->depth() + 1) + itemMargin() || treeStepSize() * (item->depth() + 1) + itemMargin() ||
@ -75,7 +75,7 @@ void KnowitTree::contentsDragMoveEvent(QDragMoveEvent* event)
void KnowitTree::slotCollapseAll() void KnowitTree::slotCollapseAll()
{ {
QListViewItem* it = firstChild(); TQListViewItem* it = firstChild();
while(it) { while(it) {
it->setOpen(false); it->setOpen(false);
it = it->nextSibling(); it = it->nextSibling();
@ -91,7 +91,7 @@ void KnowitTree::slotCollapse()
void KnowitTree::slotExpandAll() void KnowitTree::slotExpandAll()
{ {
QListViewItem* it = firstChild(); TQListViewItem* it = firstChild();
while(it) { while(it) {
it->setOpen(true); it->setOpen(true);
it = it->nextSibling(); it = it->nextSibling();
@ -123,7 +123,7 @@ void KnowitTree::slotItemBegin()
void KnowitTree::slotItemEnd() void KnowitTree::slotItemEnd()
{ {
QListViewItem* elt = firstChild(); TQListViewItem* elt = firstChild();
if (elt) if (elt)
while (elt->itemBelow()) while (elt->itemBelow())
elt = elt->itemBelow(); elt = elt->itemBelow();
@ -133,7 +133,7 @@ void KnowitTree::slotItemEnd()
void KnowitTree::slotItemLeft() void KnowitTree::slotItemLeft()
{ {
if (currentItem()) if (currentItem())
setCurrentItem(currentItem()->parent()); setCurrentItem(currentItem()->tqparent());
} }
void KnowitTree::slotItemRight() void KnowitTree::slotItemRight()

@ -17,17 +17,18 @@
#ifndef __KNOWIT_TREE_H__ #ifndef __KNOWIT_TREE_H__
#define __KNOWIT_TREE_H__ #define __KNOWIT_TREE_H__
#include <klistview.h> #include <klistview.h>
class QDragMoveEvent; class TQDragMoveEvent;
class KnowitTree : public KListView class KnowitTree : public KListView
{ {
Q_OBJECT Q_OBJECT
TQ_OBJECT
public: public:
KnowitTree(QWidget* parent=0, const char* name = 0); KnowitTree(TQWidget* tqparent=0, const char* name = 0);
QListViewItem* prevItem; TQListViewItem* prevItem;
void takeNode(QListViewItem* item); void takeNode(TQListViewItem* item);
void insertNode(QListViewItem* parent, QListViewItem* item, QListViewItem* after = 0); void insertNode(TQListViewItem* tqparent, TQListViewItem* item, TQListViewItem* after = 0);
protected: protected:
virtual void contentsDragMoveEvent(QDragMoveEvent* event); virtual void contentsDragMoveEvent(TQDragMoveEvent* event);
public slots: public slots:
/** Shows only first-level notes */ /** Shows only first-level notes */
void slotCollapseAll(); void slotCollapseAll();

@ -16,11 +16,11 @@
***************************************************************************/ ***************************************************************************/
#include "notes.h" #include "notes.h"
#include <qstringlist.h> #include <tqstringlist.h>
#include <qfile.h> #include <tqfile.h>
#include <qdatetime.h> #include <tqdatetime.h>
#include <qtextstream.h> #include <tqtextstream.h>
#include <qtextcodec.h> #include <tqtextcodec.h>
#include <klocale.h> #include <klocale.h>
#include <klistview.h> #include <klistview.h>
#include <kglobal.h> #include <kglobal.h>
@ -37,7 +37,7 @@
#endif #endif
void TNoteLink::save(QTextStream& ts) const void TNoteLink::save(TQTextStream& ts) const
{ {
if (!link.isEmpty()) { if (!link.isEmpty()) {
ts << "\\Link " << link << "\n"; ts << "\\Link " << link << "\n";
@ -46,16 +46,16 @@ void TNoteLink::save(QTextStream& ts) const
} }
} }
QString TNoteLink::text(int fmt) const TQString TNoteLink::text(int fmt) const
{ {
if (fmt == LinkOnly || description.isEmpty()) return link; if (fmt == LinkOnly || description.isEmpty()) return link;
else if (fmt == DescriptionOnly) return description; else if (fmt == DescriptionOnly) return description;
else if (fmt == LinkDescription) else if (fmt == LinkDescription)
return QString("%1 (%2)").arg(link).arg(description); return TQString("%1 (%2)").tqarg(link).tqarg(description);
else return QString("%1 (%2)").arg(description).arg(link); else return TQString("%1 (%2)").tqarg(description).tqarg(link);
} }
QPixmap TNoteLink::icon() const TQPixmap TNoteLink::icon() const
{ {
return KGlobal::iconLoader()->loadIcon(KMimeType::iconForURL(KURL(link)), return KGlobal::iconLoader()->loadIcon(KMimeType::iconForURL(KURL(link)),
KIcon::Small); KIcon::Small);
@ -98,40 +98,40 @@ TNotesCollection::TNotesCollection()
TNotesCollection::~TNotesCollection() TNotesCollection::~TNotesCollection()
{} {}
void TNotesCollection::addNote(QListViewItem* item) void TNotesCollection::addNote(TQListViewItem* item)
{ {
insert(item, new TNote(item, this)); insert(item, new TNote(item, this));
QListViewItem* parent = item->parent(); TQListViewItem* tqparent = item->tqparent();
if (parent) find(parent)->updateView(); if (tqparent) tqfind(tqparent)->updateView();
modified = true; modified = true;
} }
void TNotesCollection::addNote(QListViewItem* item, const QString& s) void TNotesCollection::addNote(TQListViewItem* item, const TQString& s)
{ {
insert(item, new TNote(item, this, s)); insert(item, new TNote(item, this, s));
QListViewItem* parent = item->parent(); TQListViewItem* tqparent = item->tqparent();
if (parent) find(parent)->updateView(); if (tqparent) tqfind(tqparent)->updateView();
modified = true; modified = true;
} }
void TNotesCollection::removeNote(QListViewItem* item) void TNotesCollection::removeNote(TQListViewItem* item)
{ {
TNote* note = find(item); TNote* note = tqfind(item);
if (!note) qWarning("Internal error while removing note\n"); if (!note) qWarning("Internal error while removing note\n");
else { else {
QListViewItem* parent = item->parent(); TQListViewItem* tqparent = item->tqparent();
for (QListViewItemIterator it(item); it.current() && for (TQListViewItemIterator it(item); it.current() &&
(it.current() == item || it.current()->depth() > item->depth()); ++it) (it.current() == item || it.current()->depth() > item->depth()); ++it)
find(it.current())->destroy(); tqfind(it.current())->destroy();
delete item; delete item;
if (parent) find(parent)->updateView(); if (tqparent) tqfind(tqparent)->updateView();
modified = true; modified = true;
} }
} }
bool TNotesCollection::changeNote(QListViewItem* item, const QString& s) bool TNotesCollection::changeNote(TQListViewItem* item, const TQString& s)
{ {
TNote* changed = find(item); TNote* changed = tqfind(item);
if (!changed) { if (!changed) {
qWarning("Internal error while changing note\n"); qWarning("Internal error while changing note\n");
return false; return false;
@ -149,9 +149,9 @@ void TNotesCollection::clearNotes()
setAutoDelete(false); setAutoDelete(false);
} }
const QString& TNotesCollection::text(QListViewItem* item) const TQString& TNotesCollection::text(TQListViewItem* item)
{ {
TNote* note = find(item); TNote* note = tqfind(item);
if (!note) if (!note)
qFatal("Internal error while accessing note text\n"); qFatal("Internal error while accessing note text\n");
return note->text; return note->text;
@ -159,7 +159,7 @@ const QString& TNotesCollection::text(QListViewItem* item)
void TNotesCollection::updateNotesView() void TNotesCollection::updateNotesView()
{ {
for (QPtrDictIterator<TNote> it(*this); it.current(); ++it) for (TQPtrDictIterator<TNote> it(*this); it.current(); ++it)
it.current()->updateView(); it.current()->updateView();
} }
@ -167,14 +167,14 @@ void TNotesCollection::updateNotesView()
TNote::TNote(QListViewItem* i, TNotesCollection* coll) : text() TNote::TNote(TQListViewItem* i, TNotesCollection* coll) : text()
{ {
collection = coll; collection = coll;
item = i; item = i;
updateView(); updateView();
} }
TNote::TNote(QListViewItem* i, TNotesCollection* coll, const QString& s) : TNote::TNote(TQListViewItem* i, TNotesCollection* coll, const TQString& s) :
text(s) text(s)
{ {
collection = coll; collection = coll;
@ -187,9 +187,9 @@ bool TNote::isEmpty()
return !text.length(); return !text.length();
} }
bool TNote::contains(const QString& sought, bool case_sensitive) bool TNote::tqcontains(const TQString& sought, bool case_sensitive)
{ {
return text.contains(sought, case_sensitive); return text.tqcontains(sought, case_sensitive);
} }
@ -203,7 +203,7 @@ void TNote::destroy()
delete this; delete this;
} }
bool TNote::change(const QString& s) bool TNote::change(const TQString& s)
{ {
if (text == s) if (text == s)
return false; return false;
@ -226,27 +226,27 @@ void TNote::updateView()
item->setPixmap(0, collection->Pixmaps[state()]); item->setPixmap(0, collection->Pixmaps[state()]);
} }
bool TNote::saveHTML(const KURL& fname, const QString& origname, const QString& style, bool TNote::saveHTML(const KURL& fname, const TQString& origname, const TQString& style,
int flags) int flags)
{ {
QFile file(fname.path()); TQFile file(fname.path());
if (!file.open( IO_WriteOnly)) if (!file.open( IO_WriteOnly))
return false; return false;
QTextStream ts(&file); TQTextStream ts(&file);
if (flags & UseUTF8) ts.setEncoding(QTextStream::UnicodeUTF8); if (flags & UseUTF8) ts.setEncoding(TQTextStream::UnicodeUTF8);
else ts.setEncoding(QTextStream::Locale); else ts.setEncoding(TQTextStream::Locale);
ts << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" ts << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"
"<html>\n<head>\n <title>" << i18n("KnowIt document") << "<html>\n<head>\n <title>" << i18n("KnowIt document") <<
QString("</title>\n <meta http-equiv=\"Content-Type\" " TQString("</title>\n <meta http-equiv=\"Content-Type\" "
"content=\"text/html; charset=%1\">\n").arg(ts.codec()->mimeName()); "content=\"text/html; charset=%1\">\n").tqarg(ts.codec()->mimeName());
if (!style.isEmpty()) if (!style.isEmpty())
ts << " <style type=\"text/css\">\n " << style << "\n </style>\n"; ts << " <style type=\"text/css\">\n " << style << "\n </style>\n";
ts << "</head>\n\n<body>\n"; ts << "</head>\n\n<body>\n";
QValueVector<int> Depths; TQValueVector<int> Depths;
Depths.append(0); Depths.append(0);
if (flags & TOC) { if (flags & TOC) {
ts << QString("<h1>%1</h1>\n").arg(i18n("Table of contents")); ts << TQString("<h1>%1</h1>\n").tqarg(i18n("Table of contents"));
saveHTMLTocEntry(ts, Depths, flags); saveHTMLTocEntry(ts, Depths, flags);
ts << "\n\n"; ts << "\n\n";
} }
@ -255,62 +255,62 @@ bool TNote::saveHTML(const KURL& fname, const QString& origname, const QString&
Depths.append(0); Depths.append(0);
saveHTMLBuf(ts, Depths, flags); saveHTMLBuf(ts, Depths, flags);
QString epilog = i18n("Exported from %1 by KnowIt %2, %3."); TQString epilog = i18n("Exported from %1 by KnowIt %2, %3.");
ts << "<br><br><br><small>" << epilog.arg(origname) ts << "<br><br><br><small>" << epilog.tqarg(origname)
.arg(VERSION) .tqarg(VERSION)
.arg(QDateTime::currentDateTime().toString()) << "</small>\n\n"; .tqarg(TQDateTime::tqcurrentDateTime().toString()) << "</small>\n\n";
ts << "</body>\n</html>\n\n"; ts << "</body>\n</html>\n\n";
return true; return true;
} }
bool TNote::saveHTMLBuf(QTextStream& ts, QValueVector<int>& depths, bool TNote::saveHTMLBuf(TQTextStream& ts, TQValueVector<int>& depths,
int flags) int flags)
{ {
int hlevel = depths.count(); int hlevel = depths.count();
depths.last() = depths.last()+1; depths.last() = depths.last()+1;
if (hlevel < 1) hlevel = 1; if (hlevel < 1) hlevel = 1;
else if (hlevel > 3) hlevel = 3; else if (hlevel > 3) hlevel = 3;
QString id, number; TQString id, number;
for (uint i=0; i<depths.count(); i++) for (uint i=0; i<depths.count(); i++)
id += QString("%1.").arg(depths[i]); id += TQString("%1.").tqarg(depths[i]);
if (flags & Enumerate) if (flags & Enumerate)
number = id + " "; number = id + " ";
ts << QString("<h%1 id=\"S%2\">%3%4</h%5>").arg(hlevel).arg(id).arg(number) ts << TQString("<h%1 id=\"S%2\">%3%4</h%5>").tqarg(hlevel).tqarg(id).tqarg(number)
.arg(item->text(0)).arg(hlevel); .tqarg(item->text(0)).tqarg(hlevel);
QString htmltext = text; TQString htmltext = text;
int begin = htmltext.find("<body"); int begin = htmltext.tqfind("<body");
if (begin >= 0) begin = htmltext.find(">", begin); if (begin >= 0) begin = htmltext.tqfind(">", begin);
int end = htmltext.find("</body>"); int end = htmltext.tqfind("</body>");
if (begin < 0) begin = 0; if (begin < 0) begin = 0;
if (end <= begin) end = htmltext.length(); if (end <= begin) end = htmltext.length();
ts << htmltext.mid(begin+1, end-begin-1); ts << htmltext.mid(begin+1, end-begin-1);
/* save links */ /* save links */
for (QValueList<TNoteLink>::Iterator LinkList = links.begin(); for (TQValueList<TNoteLink>::Iterator LinkList = links.begin();
LinkList != links.end(); ++LinkList) LinkList != links.end(); ++LinkList)
ts << QString("<a href=\"%1\">%2</a><br>\n").arg((*LinkList).link) ts << TQString("<a href=\"%1\">%2</a><br>\n").tqarg((*LinkList).link)
.arg((*LinkList).text(TNoteLink::DescriptionOnly)); .tqarg((*LinkList).text(TNoteLink::DescriptionOnly));
/* save rule */ /* save rule */
if (flags & AddRule) ts << "<hr size=\"1\" noshade>\n\n"; if (flags & AddRule) ts << "<hr size=\"1\" noshade>\n\n";
else ts << "\n\n"; else ts << "\n\n";
/* save children */ /* save tqchildren */
if ((SaveSubnotes | SaveAll) & flags && item->childCount()) { if ((SaveSubnotes | SaveAll) & flags && item->childCount()) {
depths.append(0); depths.append(0);
collection->find(item->firstChild())->saveHTMLBuf(ts, depths, flags); collection->tqfind(item->firstChild())->saveHTMLBuf(ts, depths, flags);
} }
if ((SaveSubnotes | SaveAll) & flags && item->nextSibling()) if ((SaveSubnotes | SaveAll) & flags && item->nextSibling())
collection->find(item->nextSibling())->saveHTMLBuf(ts, depths, flags); collection->tqfind(item->nextSibling())->saveHTMLBuf(ts, depths, flags);
if (!item->nextSibling()) depths.pop_back(); if (!item->nextSibling()) depths.pop_back();
return true; return true;
} }
bool TNote::saveHTMLTocEntry(QTextStream& ts, QValueVector<int>& depths, int flags) bool TNote::saveHTMLTocEntry(TQTextStream& ts, TQValueVector<int>& depths, int flags)
{ {
QString space; TQString space;
space.fill(' ', depths.count()); space.fill(' ', depths.count());
depths.last() = depths.last()+1; depths.last() = depths.last()+1;
if (depths.last() == 1) { if (depths.last() == 1) {
@ -319,20 +319,20 @@ bool TNote::saveHTMLTocEntry(QTextStream& ts, QValueVector<int>& depths, int fla
ts << "<dl>\n"; ts << "<dl>\n";
} }
QString id, number; TQString id, number;
for (uint i=0; i<depths.count(); i++) for (uint i=0; i<depths.count(); i++)
id += QString("%1.").arg(depths[i]); id += TQString("%1.").tqarg(depths[i]);
if (flags & Enumerate) number = id + " "; if (flags & Enumerate) number = id + " ";
ts << space; ts << space;
ts << QString("<dt><a href=\"#S%1\">%2%3</a></dt>\n").arg(id).arg(number). ts << TQString("<dt><a href=\"#S%1\">%2%3</a></dt>\n").tqarg(id).tqarg(number).
arg(item->text(0)); arg(item->text(0));
if ((SaveSubnotes | SaveAll) & flags && item->childCount()) { if ((SaveSubnotes | SaveAll) & flags && item->childCount()) {
depths.append(0); depths.append(0);
collection->find(item->firstChild())->saveHTMLTocEntry(ts, depths, flags); collection->tqfind(item->firstChild())->saveHTMLTocEntry(ts, depths, flags);
} }
if ((SaveSubnotes | SaveAll) & flags && item->nextSibling()) if ((SaveSubnotes | SaveAll) & flags && item->nextSibling())
collection->find(item->nextSibling())->saveHTMLTocEntry(ts, depths, flags); collection->tqfind(item->nextSibling())->saveHTMLTocEntry(ts, depths, flags);
if (!item->nextSibling()) { if (!item->nextSibling()) {
depths.pop_back(); depths.pop_back();
ts << space; ts << space;
@ -343,7 +343,7 @@ bool TNote::saveHTMLTocEntry(QTextStream& ts, QValueVector<int>& depths, int fla
return true; return true;
} }
void TNote::addLink(const QString& s) void TNote::addLink(const TQString& s)
{ {
links.append(TNoteLink(s)); links.append(TNoteLink(s));
collection->modified = true; collection->modified = true;
@ -361,7 +361,7 @@ void TNote::removeLink(int i)
collection->modified = true; collection->modified = true;
} }
void TNote::modifyLink(int i, const QString& s) void TNote::modifyLink(int i, const TQString& s)
{ {
links[i].link = s; links[i].link = s;
collection->modified = true; collection->modified = true;
@ -374,7 +374,7 @@ void TNote::modifyLink(int i, TNoteLink& l)
links[i] = l; links[i] = l;
} }
void TNote::modifyLinkDescription(int i, const QString& s) void TNote::modifyLinkDescription(int i, const TQString& s)
{ {
links[i].description = s; links[i].description = s;
collection->modified = true; collection->modified = true;
@ -391,16 +391,16 @@ const TNoteLink& TNote::link(int i) const
} }
void TNote::save(QTextStream& ts, bool current) void TNote::save(TQTextStream& ts, bool current)
{ {
const QString header = "\\NewEntry %1 %2\n"; const TQString header = "\\NewEntry %1 %2\n";
const QString activeheader = "\\CurrentEntry %1 %2\n"; const TQString activeheader = "\\CurrentEntry %1 %2\n";
if (current) if (current)
ts << activeheader.arg(item->depth()).arg(item->text(0)); ts << activeheader.tqarg(item->depth()).tqarg(item->text(0));
else else
ts << header.arg(item->depth()).arg(item->text(0)); ts << header.tqarg(item->depth()).tqarg(item->text(0));
for (QValueList<TNoteLink>::Iterator LinkList = links.begin(); for (TQValueList<TNoteLink>::Iterator LinkList = links.begin();
LinkList != links.end(); ++LinkList) LinkList != links.end(); ++LinkList)
(*LinkList).save(ts); (*LinkList).save(ts);
ts << text; ts << text;
@ -409,9 +409,9 @@ void TNote::save(QTextStream& ts, bool current)
ts << '\n'; ts << '\n';
} }
void TNote::open(QTextStream& ts) void TNote::open(TQTextStream& ts)
{ {
QString s; TQString s;
text = ""; text = "";
links.clear(); links.clear();

@ -17,13 +17,13 @@
#ifndef KNOWIT_NOTES_H #ifndef KNOWIT_NOTES_H
#define KNOWIT_NOTES_H #define KNOWIT_NOTES_H
#include <qstring.h> #include <tqstring.h>
#include <qpixmap.h> #include <tqpixmap.h>
#include <qvaluelist.h> #include <tqvaluelist.h>
#include <qvaluevector.h> #include <tqvaluevector.h>
#include <qptrdict.h> #include <tqptrdict.h>
class QTextStream; class TQTextStream;
class QListViewItem; class TQListViewItem;
class KURL; class KURL;
class TNote; class TNote;
@ -32,74 +32,74 @@ class TNoteLink
{ {
public: public:
enum {DescriptionLink, LinkDescription, LinkOnly, DescriptionOnly}; enum {DescriptionLink, LinkDescription, LinkOnly, DescriptionOnly};
QString link; TQString link;
QString description; TQString description;
TNoteLink() {} TNoteLink() {}
TNoteLink(const QString& s) {link = s;} TNoteLink(const TQString& s) {link = s;}
TNoteLink(const QString& s1, const QString& s2) {link = s1; description = s2;} TNoteLink(const TQString& s1, const TQString& s2) {link = s1; description = s2;}
int operator==(const TNoteLink& N) const {return link == N.link && int operator==(const TNoteLink& N) const {return link == N.link &&
description == N.description;} description == N.description;}
int operator!=(const TNoteLink& N) const {return link != N.link || int operator!=(const TNoteLink& N) const {return link != N.link ||
description != N.description;} description != N.description;}
void save(QTextStream& ts) const; void save(TQTextStream& ts) const;
void open() const; void open() const;
void openWith() const; void openWith() const;
QString text(int fmt = DescriptionLink) const; TQString text(int fmt = DescriptionLink) const;
QPixmap icon() const; TQPixmap icon() const;
bool isLocalReference() const; bool isLocalReference() const;
}; };
class TNotesCollection : public QPtrDict<TNote> { class TNotesCollection : public TQPtrDict<TNote> {
public: public:
QPixmap Pixmaps[4]; TQPixmap Pixmaps[4];
TNotesCollection(); TNotesCollection();
~TNotesCollection(); ~TNotesCollection();
void addNote(QListViewItem* item); void addNote(TQListViewItem* item);
void addNote(QListViewItem* item, const QString& s); void addNote(TQListViewItem* item, const TQString& s);
void removeNote(QListViewItem* item); void removeNote(TQListViewItem* item);
bool changeNote(QListViewItem* item, const QString& s); bool changeNote(TQListViewItem* item, const TQString& s);
void clearNotes(); void clearNotes();
void updateNotesView(); void updateNotesView();
bool modified; bool modified;
bool autoUpdate; bool autoUpdate;
const QString& text(QListViewItem* item); const TQString& text(TQListViewItem* item);
}; };
class TNote { class TNote {
private: private:
QValueList<TNoteLink> links; TQValueList<TNoteLink> links;
TNotesCollection* collection; TNotesCollection* collection;
bool saveHTMLBuf(QTextStream& ts, QValueVector<int>& depths, bool saveHTMLBuf(TQTextStream& ts, TQValueVector<int>& depths,
int flags = SaveAll); int flags = SaveAll);
bool saveHTMLTocEntry(QTextStream& ts, QValueVector<int>& depths, int flags); bool saveHTMLTocEntry(TQTextStream& ts, TQValueVector<int>& depths, int flags);
public: public:
typedef enum {Empty, Text, EmptyParent, TextParent} State; typedef enum {Empty, Text, EmptyParent, TextParent} State;
enum {SaveCurrent = 0, SaveSubnotes = 0x0001, SaveAll = 0x0002, UseUTF8 = 0x0040, enum {SaveCurrent = 0, SaveSubnotes = 0x0001, SaveAll = 0x0002, UseUTF8 = 0x0040,
Enumerate = 0x0080, AddRule = 0x0100, Style = 0x0200, TOC = 0x0400}; Enumerate = 0x0080, AddRule = 0x0100, Style = 0x0200, TOC = 0x0400};
QListViewItem* item; TQListViewItem* item;
QString text; TQString text;
bool isEmpty(); bool isEmpty();
bool contains(const QString& sought, bool case_sensitive = false); bool tqcontains(const TQString& sought, bool case_sensitive = false);
bool change(const QString& s); bool change(const TQString& s);
void destroy(); void destroy();
void updateView(); void updateView();
State state(); State state();
void open(QTextStream& ts); void open(TQTextStream& ts);
void save(QTextStream& ts, bool current = false); void save(TQTextStream& ts, bool current = false);
bool saveHTML(const KURL& fname, const QString& origname, const QString& style, bool saveHTML(const KURL& fname, const TQString& origname, const TQString& style,
int flags = SaveAll); int flags = SaveAll);
void addLink(const QString& s); void addLink(const TQString& s);
void addLink(const TNoteLink& l); void addLink(const TNoteLink& l);
int linkCount() const; int linkCount() const;
const TNoteLink& link(int i) const; const TNoteLink& link(int i) const;
void removeLink(int i); void removeLink(int i);
void modifyLink(int i, const QString& s); void modifyLink(int i, const TQString& s);
void modifyLink(int i, TNoteLink& l); void modifyLink(int i, TNoteLink& l);
void modifyLinkDescription(int i, const QString& s); void modifyLinkDescription(int i, const TQString& s);
TNote(QListViewItem* i, TNotesCollection* coll); TNote(TQListViewItem* i, TNotesCollection* coll);
TNote(QListViewItem* i, TNotesCollection* coll, const QString& s); TNote(TQListViewItem* i, TNotesCollection* coll, const TQString& s);
~TNote(); ~TNote();
}; };
#endif #endif

Loading…
Cancel
Save