diff options
Diffstat (limited to 'knotes/knote.cpp')
-rw-r--r-- | knotes/knote.cpp | 348 |
1 files changed, 174 insertions, 174 deletions
diff --git a/knotes/knote.cpp b/knotes/knote.cpp index 795da8a16..1e55dd14c 100644 --- a/knotes/knote.cpp +++ b/knotes/knote.cpp @@ -18,18 +18,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *******************************************************************/ -#include <qlabel.h> -#include <qdrawutil.h> -#include <qsize.h> -#include <qsizegrip.h> -#include <qbitmap.h> -#include <qcursor.h> -#include <qpainter.h> -#include <qpaintdevicemetrics.h> -#include <qsimplerichtext.h> -#include <qobjectlist.h> -#include <qfile.h> -#include <qcheckbox.h> +#include <tqlabel.h> +#include <tqdrawutil.h> +#include <tqsize.h> +#include <tqsizegrip.h> +#include <tqbitmap.h> +#include <tqcursor.h> +#include <tqpainter.h> +#include <tqpaintdevicemetrics.h> +#include <tqsimplerichtext.h> +#include <tqobjectlist.h> +#include <tqfile.h> +#include <tqcheckbox.h> #include <kapplication.h> #include <kdebug.h> @@ -80,8 +80,8 @@ extern Time qt_x_time; int KNote::s_ppOffset = 0; -KNote::KNote( QDomDocument buildDoc, Journal *j, QWidget *parent, const char *name ) - : QFrame( parent, name, WStyle_Customize | WStyle_NoBorder | WDestructiveClose ), +KNote::KNote( TQDomDocument buildDoc, Journal *j, TQWidget *parent, const char *name ) + : TQFrame( parent, name, WStyle_Customize | WStyle_NoBorder | WDestructiveClose ), m_label( 0 ), m_pushpin( 0 ), m_fold( 0 ), m_button( 0 ), m_tool( 0 ), m_editor( 0 ), m_config( 0 ), m_journal( j ), m_find( 0 ), m_kwinConf( KSharedConfig::openConfig( "kwinrc", true ) ) @@ -98,70 +98,70 @@ KNote::KNote( QDomDocument buildDoc, Journal *j, QWidget *parent, const char *na // (KOrganizer's journals don't have titles but a valid start date) if ( m_journal->summary().isNull() && m_journal->dtStart().isValid() ) { - QString s = KGlobal::locale()->formatDateTime( m_journal->dtStart() ); + TQString s = KGlobal::locale()->formatDateTime( m_journal->dtStart() ); m_journal->setSummary( s ); } // create the menu items for the note - not the editor... // rename, mail, print, save as, insert date, alarm, close, delete, new note new KAction( i18n("New"), "filenew", 0, - this, SIGNAL(sigRequestNewNote()), actionCollection(), "new_note" ); + this, TQT_SIGNAL(sigRequestNewNote()), actionCollection(), "new_note" ); new KAction( i18n("Rename..."), "text", 0, - this, SLOT(slotRename()), actionCollection(), "rename_note" ); + this, TQT_SLOT(slotRename()), actionCollection(), "rename_note" ); m_readOnly = new KToggleAction( i18n("Lock"), "lock" , 0, - this, SLOT(slotUpdateReadOnly()), actionCollection(), "lock_note" ); + this, TQT_SLOT(slotUpdateReadOnly()), actionCollection(), "lock_note" ); m_readOnly->setCheckedState( KGuiItem( i18n("Unlock"), "unlock" ) ); new KAction( i18n("Hide"), "fileclose" , Key_Escape, - this, SLOT(slotClose()), actionCollection(), "hide_note" ); + this, TQT_SLOT(slotClose()), actionCollection(), "hide_note" ); new KAction( i18n("Delete"), "knotes_delete", 0, - this, SLOT(slotKill()), actionCollection(), "delete_note" ); + this, TQT_SLOT(slotKill()), actionCollection(), "delete_note" ); new KAction( i18n("Insert Date"), "knotes_date", 0 , - this, SLOT(slotInsDate()), actionCollection(), "insert_date" ); + this, TQT_SLOT(slotInsDate()), actionCollection(), "insert_date" ); new KAction( i18n("Set Alarm..."), "knotes_alarm", 0 , - this, SLOT(slotSetAlarm()), actionCollection(), "set_alarm" ); + this, TQT_SLOT(slotSetAlarm()), actionCollection(), "set_alarm" ); new KAction( i18n("Send..."), "network", 0, - this, SLOT(slotSend()), actionCollection(), "send_note" ); + this, TQT_SLOT(slotSend()), actionCollection(), "send_note" ); new KAction( i18n("Mail..."), "mail_send", 0, - this, SLOT(slotMail()), actionCollection(), "mail_note" ); + this, TQT_SLOT(slotMail()), actionCollection(), "mail_note" ); new KAction( i18n("Save As..."), "filesaveas", 0, - this, SLOT(slotSaveAs()), actionCollection(), "save_note" ); - KStdAction::print( this, SLOT(slotPrint()), actionCollection(), "print_note" ); + this, TQT_SLOT(slotSaveAs()), actionCollection(), "save_note" ); + KStdAction::print( this, TQT_SLOT(slotPrint()), actionCollection(), "print_note" ); new KAction( i18n("Preferences..."), "configure", 0, - this, SLOT(slotPreferences()), actionCollection(), "configure_note" ); + this, TQT_SLOT(slotPreferences()), actionCollection(), "configure_note" ); m_keepAbove = new KToggleAction( i18n("Keep Above Others"), "up", 0, - this, SLOT(slotUpdateKeepAboveBelow()), actionCollection(), "keep_above" ); + this, TQT_SLOT(slotUpdateKeepAboveBelow()), actionCollection(), "keep_above" ); m_keepAbove->setExclusiveGroup( "keepAB" ); m_keepBelow = new KToggleAction( i18n("Keep Below Others"), "down", 0, - this, SLOT(slotUpdateKeepAboveBelow()), actionCollection(), "keep_below" ); + this, TQT_SLOT(slotUpdateKeepAboveBelow()), actionCollection(), "keep_below" ); m_keepBelow->setExclusiveGroup( "keepAB" ); m_toDesktop = new KListAction( i18n("To Desktop"), 0, - this, SLOT(slotPopupActionToDesktop(int)), actionCollection(), "to_desktop" ); - connect( m_toDesktop->popupMenu(), SIGNAL(aboutToShow()), this, SLOT(slotUpdateDesktopActions()) ); + this, TQT_SLOT(slotPopupActionToDesktop(int)), actionCollection(), "to_desktop" ); + connect( m_toDesktop->popupMenu(), TQT_SIGNAL(aboutToShow()), this, TQT_SLOT(slotUpdateDesktopActions()) ); // invisible action to walk through the notes to make this configurable new KAction( i18n("Walk Through Notes"), 0, SHIFT+Key_BackTab, - this, SIGNAL(sigShowNextNote()), actionCollection(), "walk_notes" ); + this, TQT_SIGNAL(sigShowNextNote()), actionCollection(), "walk_notes" ); // create the note header, button and label... - m_label = new QLabel( this ); + m_label = new TQLabel( this ); m_label->setFrameStyle( NoFrame ); m_label->setLineWidth( 0 ); m_label->installEventFilter( this ); // receive events (for dragging & action menu) setName( m_journal->summary() ); // don't worry, no signals are connected at this stage yet m_button = new KNoteButton( "knotes_close", this ); - connect( m_button, SIGNAL(clicked()), this, SLOT(slotClose()) ); + connect( m_button, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotClose()) ); // create the note editor m_editor = new KNoteEdit( actionCollection(), this ); m_editor->installEventFilter( this ); // receive events (for modified) m_editor->viewport()->installEventFilter( this ); - connect( m_editor, SIGNAL(contentsMoving( int, int )), this, SLOT(slotUpdateViewport( int, int ))); + connect( m_editor, TQT_SIGNAL(contentsMoving( int, int )), this, TQT_SLOT(slotUpdateViewport( int, int ))); KXMLGUIBuilder builder( this ); KXMLGUIFactory factory( &builder, this ); @@ -177,12 +177,12 @@ KNote::KNote( QDomDocument buildDoc, Journal *j, QWidget *parent, const char *na m_tool->setIconText( KToolBar::IconOnly ); // if there was just a way of making KComboBox adhere the toolbar height... - QObjectList *list = m_tool->queryList( "KComboBox" ); - QObjectListIt it( *list ); + TQObjectList *list = m_tool->queryList( "KComboBox" ); + TQObjectListIt it( *list ); while ( it.current() != 0 ) { KComboBox *combo = (KComboBox *)it.current(); - QFont font = combo->font(); + TQFont font = combo->font(); font.setPointSize( 7 ); combo->setFont( font ); combo->setFixedHeight( 14 ); @@ -196,15 +196,15 @@ KNote::KNote( QDomDocument buildDoc, Journal *j, QWidget *parent, const char *na setFocusProxy( m_editor ); // create the resize handle - m_editor->setCornerWidget( new QSizeGrip( this ) ); + m_editor->setCornerWidget( new TQSizeGrip( this ) ); uint width = m_editor->cornerWidget()->width(); uint height = m_editor->cornerWidget()->height(); - QBitmap mask; + TQBitmap mask; mask.resize( width, height ); mask.fill( color0 ); - QPointArray array; + TQPointArray array; array.setPoints( 3, 0, height, width, height, width, 0 ); - QPainter p; + TQPainter p; p.begin( &mask ); p.setBrush( color1 ); p.drawPolygon( array ); @@ -213,7 +213,7 @@ KNote::KNote( QDomDocument buildDoc, Journal *j, QWidget *parent, const char *na m_editor->cornerWidget()->setBackgroundMode( PaletteBase ); // the config file location - QString configFile = KGlobal::dirs()->saveLocation( "appdata", "notes/" ); + TQString configFile = KGlobal::dirs()->saveLocation( "appdata", "notes/" ); configFile += m_journal->uid(); // no config file yet? -> use the default display config if available @@ -265,21 +265,21 @@ KNote::KNote( QDomDocument buildDoc, Journal *j, QWidget *parent, const char *na if ( m_kwinConf->readBoolEntry( "CustomButtonPositions" ) ) closeLeft = m_kwinConf->readEntry( "ButtonsOnLeft" ).find( 'X' ) > -1; - QPixmap pushpin_pix; + TQPixmap pushpin_pix; if ( closeLeft ) - pushpin_pix = QPixmap( QPixmap( pushpin_xpm ).convertToImage().mirror( true, false ) ); + pushpin_pix = TQPixmap( TQPixmap( pushpin_xpm ).convertToImage().mirror( true, false ) ); else - pushpin_pix = QPixmap( pushpin_xpm ); + pushpin_pix = TQPixmap( pushpin_xpm ); // the pushpin label at the top left or right corner - m_pushpin = new QLabel( this ); + m_pushpin = new TQLabel( this ); m_pushpin->setScaledContents( true ); m_pushpin->setBackgroundMode( NoBackground ); m_pushpin->setPixmap( pushpin_pix ); m_pushpin->resize( pushpin_pix.size() ); // fold label at bottom right corner - m_fold = new QLabel( this ); + m_fold = new TQLabel( this ); m_fold->setScaledContents( true ); m_fold->setBackgroundMode( NoBackground ); @@ -290,22 +290,22 @@ KNote::KNote( QDomDocument buildDoc, Journal *j, QWidget *parent, const char *na // let KWin do the placement if the position is illegal--at least 10 pixels // of a note need to be visible - const QPoint& position = m_config->position(); - QRect desk = kapp->desktop()->rect(); + const TQPoint& position = m_config->position(); + TQRect desk = kapp->desktop()->rect(); desk.addCoords( 10, 10, -10, -10 ); - if ( desk.intersects( QRect( position, QSize( width, height ) ) ) ) + if ( desk.intersects( TQRect( position, TQSize( width, height ) ) ) ) move( position ); // do before calling show() to avoid flicker // config items in the journal have priority - QString property = m_journal->customProperty( "KNotes", "FgColor" ); + TQString property = m_journal->customProperty( "KNotes", "FgColor" ); if ( !property.isNull() ) - m_config->setFgColor( QColor( property ) ); + m_config->setFgColor( TQColor( property ) ); else m_journal->setCustomProperty( "KNotes", "FgColor", m_config->fgColor().name() ); property = m_journal->customProperty( "KNotes", "BgColor" ); if ( !property.isNull() ) - m_config->setBgColor( QColor( property ) ); + m_config->setBgColor( TQColor( property ) ); else m_journal->setCustomProperty( "KNotes", "BgColor", m_config->bgColor().name() ); @@ -320,7 +320,7 @@ KNote::KNote( QDomDocument buildDoc, Journal *j, QWidget *parent, const char *na // create the mask for the fold---to be done after slotApplyConfig(), // which calls createFold() - m_fold->setMask( QRegion( m_fold->pixmap()->createHeuristicMask() ) ); + m_fold->setMask( TQRegion( m_fold->pixmap()->createHeuristicMask() ) ); // if this is a new note put on current desktop - we can't use defaults // in KConfig XT since only _changes_ will be stored in the config file @@ -359,8 +359,8 @@ KNote::KNote( QDomDocument buildDoc, Journal *j, QWidget *parent, const char *na // HACK: update the icon color - again after showing the note, to make kicker aware of the new colors KIconEffect effect; - QPixmap icon = effect.apply( kapp->icon(), KIconEffect::Colorize, 1, m_config->bgColor(), false ); - QPixmap miniIcon = effect.apply( kapp->miniIcon(), KIconEffect::Colorize, 1, m_config->bgColor(), false ); + TQPixmap icon = effect.apply( kapp->icon(), KIconEffect::Colorize, 1, m_config->bgColor(), false ); + TQPixmap miniIcon = effect.apply( kapp->miniIcon(), KIconEffect::Colorize, 1, m_config->bgColor(), false ); KWin::setIcons( winId(), icon, miniIcon ); } @@ -389,7 +389,7 @@ void KNote::slotKill( bool force ) delete m_config; m_config = 0; - QString configFile = KGlobal::dirs()->saveLocation( "appdata", "notes/" ); + TQString configFile = KGlobal::dirs()->saveLocation( "appdata", "notes/" ); configFile += m_journal->uid(); if ( !KIO::NetAccess::del( KURL::fromPathOrURL( configFile ), this ) ) @@ -430,26 +430,26 @@ void KNote::saveConfig() const m_config->writeConfig(); } -QString KNote::noteId() const +TQString KNote::noteId() const { return m_journal->uid(); } -QString KNote::name() const +TQString KNote::name() const { return m_label->text(); } -QString KNote::text() const +TQString KNote::text() const { return m_editor->text(); } -QString KNote::plainText() const +TQString KNote::plainText() const { if ( m_editor->textFormat() == RichText ) { - QTextEdit conv; + TQTextEdit conv; conv.setTextFormat( RichText ); conv.setText( m_editor->text() ); conv.setTextFormat( PlainText ); @@ -459,7 +459,7 @@ QString KNote::plainText() const return m_editor->text(); } -void KNote::setName( const QString& name ) +void KNote::setName( const TQString& name ) { m_label->setText( name ); updateLabelAlignment(); @@ -474,23 +474,23 @@ void KNote::setName( const QString& name ) emit sigNameChanged(); } -void KNote::setText( const QString& text ) +void KNote::setText( const TQString& text ) { m_editor->setText( text ); saveData(); } -QColor KNote::fgColor() const +TQColor KNote::fgColor() const { return m_config->fgColor(); } -QColor KNote::bgColor() const +TQColor KNote::bgColor() const { return m_config->bgColor(); } -void KNote::setColor( const QColor& fg, const QColor& bg ) +void KNote::setColor( const TQColor& fg, const TQColor& bg ) { m_journal->setCustomProperty( "KNotes", "FgColor", fg.name() ); m_journal->setCustomProperty( "KNotes", "BgColor", bg.name() ); @@ -501,25 +501,25 @@ void KNote::setColor( const QColor& fg, const QColor& bg ) emit sigDataChanged(); m_config->writeConfig(); - QPalette newpalette = palette(); - newpalette.setColor( QColorGroup::Background, bg ); - newpalette.setColor( QColorGroup::Foreground, fg ); - newpalette.setColor( QColorGroup::Base, bg ); // text background - newpalette.setColor( QColorGroup::Text, fg ); // text color - newpalette.setColor( QColorGroup::Button, bg ); - newpalette.setColor( QColorGroup::ButtonText, fg ); + TQPalette newpalette = palette(); + newpalette.setColor( TQColorGroup::Background, bg ); + newpalette.setColor( TQColorGroup::Foreground, fg ); + newpalette.setColor( TQColorGroup::Base, bg ); // text background + newpalette.setColor( TQColorGroup::Text, fg ); // text color + newpalette.setColor( TQColorGroup::Button, bg ); + newpalette.setColor( TQColorGroup::ButtonText, fg ); -// newpalette.setColor( QColorGroup::Highlight, bg ); -// newpalette.setColor( QColorGroup::HighlightedText, fg ); +// newpalette.setColor( TQColorGroup::Highlight, bg ); +// newpalette.setColor( TQColorGroup::HighlightedText, fg ); // the shadow - newpalette.setColor( QColorGroup::Midlight, bg.light(150) ); - newpalette.setColor( QColorGroup::Shadow, bg.dark(116) ); - newpalette.setColor( QColorGroup::Light, bg.light(180) ); + newpalette.setColor( TQColorGroup::Midlight, bg.light(150) ); + newpalette.setColor( TQColorGroup::Shadow, bg.dark(116) ); + newpalette.setColor( TQColorGroup::Light, bg.light(180) ); if ( s_ppOffset ) - newpalette.setColor( QColorGroup::Dark, bg.dark(200) ); + newpalette.setColor( TQColorGroup::Dark, bg.dark(200) ); else - newpalette.setColor( QColorGroup::Dark, bg.dark(108) ); + newpalette.setColor( TQColorGroup::Dark, bg.dark(108) ); setPalette( newpalette ); // set the text color @@ -529,20 +529,20 @@ void KNote::setColor( const QColor& fg, const QColor& bg ) updateBackground(); // set darker value for the hide button... - QPalette darker = palette(); - darker.setColor( QColorGroup::Button, bg.dark(116) ); + TQPalette darker = palette(); + darker.setColor( TQColorGroup::Button, bg.dark(116) ); m_button->setPalette( darker ); // update the icon color KIconEffect effect; - QPixmap icon = effect.apply( kapp->icon(), KIconEffect::Colorize, 1, bg, false ); - QPixmap miniIcon = effect.apply( kapp->miniIcon(), KIconEffect::Colorize, 1, bg, false ); + TQPixmap icon = effect.apply( kapp->icon(), KIconEffect::Colorize, 1, bg, false ); + TQPixmap miniIcon = effect.apply( kapp->miniIcon(), KIconEffect::Colorize, 1, bg, false ); KWin::setIcons( winId(), icon, miniIcon ); // set the color for the selection used to highlight the find stuff - QColor sel = palette().color( QPalette::Active, QColorGroup::Base ).dark(); + TQColor sel = palette().color( TQPalette::Active, TQColorGroup::Base ).dark(); if ( sel == Qt::black ) - sel = palette().color( QPalette::Active, QColorGroup::Base ).light(); + sel = palette().color( TQPalette::Active, TQColorGroup::Base ).light(); m_editor->setSelectionAttributes( 1, sel, true ); @@ -554,14 +554,14 @@ void KNote::setColor( const QColor& fg, const QColor& bg ) emit sigColorChanged(); } -void KNote::find( const QString& pattern, long options ) +void KNote::find( const TQString& pattern, long options ) { delete m_find; m_find = new KFind( pattern, options, this ); - connect( m_find, SIGNAL(highlight( const QString &, int, int )), - this, SLOT(slotHighlight( const QString &, int, int )) ); - connect( m_find, SIGNAL(findNext()), this, SLOT(slotFindNext()) ); + connect( m_find, TQT_SIGNAL(highlight( const TQString &, int, int )), + this, TQT_SLOT(slotHighlight( const TQString &, int, int )) ); + connect( m_find, TQT_SIGNAL(findNext()), this, TQT_SLOT(slotFindNext()) ); m_find->setData( plainText() ); slotFindNext(); @@ -589,7 +589,7 @@ void KNote::slotFindNext() } } -void KNote::slotHighlight( const QString& str, int idx, int len ) +void KNote::slotHighlight( const TQString& str, int idx, int len ) { int paraFrom = 0, idxFrom = 0, p = 0; for ( ; p < idx; ++p ) @@ -623,13 +623,13 @@ bool KNote::isModified() const } // FIXME KDE 4.0: remove sync(), isNew() and isModified() -void KNote::sync( const QString& app ) +void KNote::sync( const TQString& app ) { - QByteArray sep( 1 ); + TQByteArray sep( 1 ); sep[0] = '\0'; KMD5 hash; - QCString result; + TQCString result; hash.update( m_label->text().utf8() ); hash.update( sep ); @@ -642,17 +642,17 @@ void KNote::sync( const QString& app ) config->writeEntry( app, result.data() ); } -bool KNote::isNew( const QString& app ) const +bool KNote::isNew( const TQString& app ) const { KConfig *config = m_config->config(); config->setGroup( "Synchronisation" ); - QString hash = config->readEntry( app ); + TQString hash = config->readEntry( app ); return hash.isEmpty(); } -bool KNote::isModified( const QString& app ) const +bool KNote::isModified( const TQString& app ) const { - QByteArray sep( 1 ); + TQByteArray sep( 1 ); sep[0] = '\0'; KMD5 hash; @@ -663,7 +663,7 @@ bool KNote::isModified( const QString& app ) const KConfig *config = m_config->config(); config->setGroup( "Synchronisation" ); - QString orig = config->readEntry( app ); + TQString orig = config->readEntry( app ); if ( hash.verify( orig.utf8() ) ) // returns false on error! return false; @@ -686,7 +686,7 @@ void KNote::slotRename() { // pop up dialog to get the new name bool ok; - QString newName = KInputDialog::getText( QString::null, + TQString newName = KInputDialog::getText( TQString::null, i18n("Please enter the new name:"), m_label->text(), &ok, this ); if ( !ok ) // handle cancel return; @@ -731,7 +731,7 @@ void KNote::slotClose() void KNote::slotInsDate() { - m_editor->insert( KGlobal::locale()->formatDateTime(QDateTime::currentDateTime()) ); + m_editor->insert( KGlobal::locale()->formatDateTime(TQDateTime::currentDateTime()) ); } void KNote::slotSetAlarm() @@ -739,7 +739,7 @@ void KNote::slotSetAlarm() KNoteAlarmDlg dlg( name(), this ); dlg.setIncidence( m_journal ); - if ( dlg.exec() == QDialog::Accepted ) + if ( dlg.exec() == TQDialog::Accepted ) emit sigDataChanged(); } @@ -751,8 +751,8 @@ void KNote::slotPreferences() // create a new preferences dialog... KNoteConfigDlg *dialog = new KNoteConfigDlg( m_config, name(), this, noteId().utf8() ); - connect( dialog, SIGNAL(settingsChanged()), this, SLOT(slotApplyConfig()) ); - connect( this, SIGNAL(sigNameChanged()), dialog, SLOT(slotUpdateCaption()) ); + connect( dialog, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(slotApplyConfig()) ); + connect( this, TQT_SIGNAL(sigNameChanged()), dialog, TQT_SLOT(slotUpdateCaption()) ); dialog->show(); } @@ -760,8 +760,8 @@ void KNote::slotSend() { // pop up dialog to get the IP KNoteHostDlg hostDlg( i18n("Send \"%1\"").arg( name() ), this ); - bool ok = (hostDlg.exec() == QDialog::Accepted); - QString host = hostDlg.host(); + bool ok = (hostDlg.exec() == TQDialog::Accepted); + TQString host = hostDlg.host(); if ( !ok ) // handle cancel return; @@ -782,10 +782,10 @@ void KNote::slotSend() void KNote::slotMail() { // get the mail action command - QStringList cmd_list = QStringList::split( QChar(' '), KNotesGlobalConfig::mailAction() ); + TQStringList cmd_list = TQStringList::split( TQChar(' '), KNotesGlobalConfig::mailAction() ); KProcess mail; - for ( QStringList::Iterator it = cmd_list.begin(); + for ( TQStringList::Iterator it = cmd_list.begin(); it != cmd_list.end(); ++it ) { if ( *it == "%f" ) @@ -804,9 +804,9 @@ void KNote::slotPrint() { saveData(); - QString content; + TQString content; if ( m_editor->textFormat() == PlainText ) - content = QStyleSheet::convertFromPlainText( m_editor->text() ); + content = TQStyleSheet::convertFromPlainText( m_editor->text() ); else content = m_editor->text(); @@ -816,33 +816,33 @@ void KNote::slotPrint() printer.setContext( m_editor->context() ); printer.setStyleSheet( m_editor->styleSheet() ); printer.setColorGroup( colorGroup() ); - printer.printNote( QString(), content ); + printer.printNote( TQString(), content ); } void KNote::slotSaveAs() { - QCheckBox *convert = 0; + TQCheckBox *convert = 0; if ( m_editor->textFormat() == RichText ) { - convert = new QCheckBox( 0 ); + convert = new TQCheckBox( 0 ); convert->setText( i18n("Save note as plain text") ); } - KFileDialog dlg( QString::null, QString::null, this, "filedialog", true, convert ); + KFileDialog dlg( TQString::null, TQString::null, this, "filedialog", true, convert ); dlg.setOperationMode( KFileDialog::Saving ); dlg.setCaption( i18n("Save As") ); dlg.exec(); - QString fileName = dlg.selectedFile(); + TQString fileName = dlg.selectedFile(); if ( fileName.isEmpty() ) return; - QFile file( fileName ); + TQFile file( fileName ); if ( file.exists() && KMessageBox::warningContinueCancel( this, i18n("<qt>A file named <b>%1</b> already exists.<br>" - "Are you sure you want to overwrite it?</qt>").arg( QFileInfo(file).fileName() ) ) + "Are you sure you want to overwrite it?</qt>").arg( TQFileInfo(file).fileName() ) ) != KMessageBox::Continue ) { return; @@ -850,7 +850,7 @@ void KNote::slotSaveAs() if ( file.open( IO_WriteOnly ) ) { - QTextStream stream( &file ); + TQTextStream stream( &file ); // convert rich text to plain text first if ( convert && convert->isChecked() ) stream << plainText(); @@ -929,13 +929,13 @@ void KNote::slotUpdateDesktopActions() NETRootInfo wm_root( qt_xdisplay(), NET::NumberOfDesktops | NET::DesktopNames ); NETWinInfo wm_client( qt_xdisplay(), winId(), qt_xrootwin(), NET::WMDesktop ); - QStringList desktops; + TQStringList desktops; desktops.append( i18n("&All Desktops") ); - desktops.append( QString::null ); // Separator + desktops.append( TQString::null ); // Separator int count = wm_root.numberOfDesktops(); for ( int n = 1; n <= count; n++ ) - desktops.append( QString("&%1 %2").arg( n ).arg( QString::fromUtf8(wm_root.desktopName( n )) ) ); + desktops.append( TQString("&%1 %2").arg( n ).arg( TQString::fromUtf8(wm_root.desktopName( n )) ) ); m_toDesktop->setItems( desktops ); @@ -966,11 +966,11 @@ void KNote::toDesktop( int desktop ) void KNote::createFold() { - QPixmap fold( 15, 15 ); - QPainter foldp( &fold ); + TQPixmap fold( 15, 15 ); + TQPainter foldp( &fold ); foldp.setPen( Qt::NoPen ); foldp.setBrush( palette().active().dark() ); - QPointArray foldpoints( 3 ); + TQPointArray foldpoints( 3 ); foldpoints.putPoints( 0, 3, 0, 0, 14, 0, 0, 14 ); foldp.drawPolygon( foldpoints ); foldp.end(); @@ -980,7 +980,7 @@ void KNote::createFold() void KNote::updateLabelAlignment() { // if the name is too long to fit, left-align it, otherwise center it (#59028) - QString labelText = m_label->text(); + TQString labelText = m_label->text(); if ( m_label->fontMetrics().boundingRect( labelText ).width() > m_label->width() ) m_label->setAlignment( AlignLeft ); else @@ -997,7 +997,7 @@ void KNote::updateFocus() if ( !m_editor->isReadOnly() ) { - if ( m_tool && m_tool->isHidden() && m_editor->textFormat() == QTextEdit::RichText ) + if ( m_tool && m_tool->isHidden() && m_editor->textFormat() == TQTextEdit::RichText ) { m_tool->show(); setGeometry( x(), y(), width(), height() + m_tool->height() ); @@ -1044,18 +1044,18 @@ void KNote::updateMask() int w = width(); int h = height(); - QRegion reg( 0, s_ppOffset, w, h - s_ppOffset ); + TQRegion reg( 0, s_ppOffset, w, h - s_ppOffset ); - const QBitmap *pushpin_bitmap = m_pushpin->pixmap()->mask(); - QRegion pushpin_reg( *pushpin_bitmap ); + const TQBitmap *pushpin_bitmap = m_pushpin->pixmap()->mask(); + TQRegion pushpin_reg( *pushpin_bitmap ); m_pushpin->setMask( pushpin_reg ); pushpin_reg.translate( m_pushpin->x(), m_pushpin->y() ); if ( !hasFocus() ) { - QPointArray foldpoints( 3 ); + TQPointArray foldpoints( 3 ); foldpoints.putPoints( 0, 3, w-15, h, w, h-15, w, h ); - QRegion fold( foldpoints, false ); + TQRegion fold( foldpoints, false ); setMask( reg.unite( pushpin_reg ).subtract( fold ) ); } else @@ -1066,7 +1066,7 @@ void KNote::updateBackground( int y_offset ) { if ( !s_ppOffset ) { - m_editor->setPaper( QBrush( colorGroup().background() ) ); + m_editor->setPaper( TQBrush( colorGroup().background() ) ); return; } @@ -1081,9 +1081,9 @@ void KNote::updateBackground( int y_offset ) y_offset = y_offset % h; - QImage grad_img( w, h, 32 ); + TQImage grad_img( w, h, 32 ); QRgb rgbcol; - QColor bg = palette().active().background(); + TQColor bg = palette().active().background(); for ( int i = 0; i < h; ++i ) { @@ -1100,8 +1100,8 @@ void KNote::updateBackground( int y_offset ) grad_img.setPixel( j, i, rgbcol ); } - // setPaletteBackgroundPixmap makes QTextEdit::color() stop working!! - m_editor->setPaper( QBrush( Qt::black, QPixmap( grad_img ) ) ); + // setPaletteBackgroundPixmap makes TQTextEdit::color() stop working!! + m_editor->setPaper( TQBrush( Qt::black, TQPixmap( grad_img ) ) ); } void KNote::updateLayout() @@ -1149,10 +1149,10 @@ void KNote::updateLayout() contentsRect().width(), headerHeight ); - m_editor->setGeometry( QRect( - QPoint( contentsRect().x(), + m_editor->setGeometry( TQRect( + TQPoint( contentsRect().x(), contentsRect().y() + headerHeight + s_ppOffset ), - QPoint( contentsRect().right(), + TQPoint( contentsRect().right(), contentsRect().bottom() - ( m_tool ? (m_tool->isHidden() ? 0 : m_tool->height()) : 0 ) ) ) ); @@ -1181,9 +1181,9 @@ void KNote::updateLayout() // -------------------- protected methods -------------------- // -void KNote::drawFrame( QPainter *p ) +void KNote::drawFrame( TQPainter *p ) { - QRect r = frameRect(); + TQRect r = frameRect(); r.setTop( s_ppOffset ); if ( s_ppOffset ) qDrawShadePanel( p, r, colorGroup(), false, lineWidth() ); @@ -1191,7 +1191,7 @@ void KNote::drawFrame( QPainter *p ) qDrawWinPanel( p, r, colorGroup(), false ); } -void KNote::showEvent( QShowEvent * ) +void KNote::showEvent( TQShowEvent * ) { if ( m_config->hideNote() ) { @@ -1204,29 +1204,29 @@ void KNote::showEvent( QShowEvent * ) } } -void KNote::resizeEvent( QResizeEvent *qre ) +void KNote::resizeEvent( TQResizeEvent *qre ) { - QFrame::resizeEvent( qre ); + TQFrame::resizeEvent( qre ); updateLayout(); } -void KNote::closeEvent( QCloseEvent * ) +void KNote::closeEvent( TQCloseEvent * ) { slotClose(); } -void KNote::dragEnterEvent( QDragEnterEvent *e ) +void KNote::dragEnterEvent( TQDragEnterEvent *e ) { if ( !m_config->readOnly() ) e->accept( KColorDrag::canDecode( e ) ); } -void KNote::dropEvent( QDropEvent *e ) +void KNote::dropEvent( TQDropEvent *e ) { if ( m_config->readOnly() ) return; - QColor bg; + TQColor bg; if ( KColorDrag::decode( e, bg ) ) setColor( paletteForegroundColor(), bg ); } @@ -1236,41 +1236,41 @@ bool KNote::focusNextPrevChild( bool ) return true; } -bool KNote::event( QEvent *ev ) +bool KNote::event( TQEvent *ev ) { - if ( ev->type() == QEvent::LayoutHint ) + if ( ev->type() == TQEvent::LayoutHint ) { updateLayout(); return true; } else - return QFrame::event( ev ); + return TQFrame::event( ev ); } -bool KNote::eventFilter( QObject *o, QEvent *ev ) +bool KNote::eventFilter( TQObject *o, TQEvent *ev ) { - if ( ev->type() == QEvent::DragEnter && - KColorDrag::canDecode( static_cast<QDragEnterEvent *>(ev) ) ) + if ( ev->type() == TQEvent::DragEnter && + KColorDrag::canDecode( static_cast<TQDragEnterEvent *>(ev) ) ) { - dragEnterEvent( static_cast<QDragEnterEvent *>(ev) ); + dragEnterEvent( static_cast<TQDragEnterEvent *>(ev) ); return true; } - if ( ev->type() == QEvent::Drop && - KColorDrag::canDecode( static_cast<QDropEvent *>(ev) ) ) + if ( ev->type() == TQEvent::Drop && + KColorDrag::canDecode( static_cast<TQDropEvent *>(ev) ) ) { - dropEvent( static_cast<QDropEvent *>(ev) ); + dropEvent( static_cast<TQDropEvent *>(ev) ); return true; } if ( o == m_label ) { - QMouseEvent *e = (QMouseEvent *)ev; + TQMouseEvent *e = (TQMouseEvent *)ev; - if ( ev->type() == QEvent::MouseButtonDblClick ) + if ( ev->type() == TQEvent::MouseButtonDblClick ) slotRename(); - if ( ev->type() == QEvent::MouseButtonPress && + if ( ev->type() == TQEvent::MouseButtonPress && (e->button() == LeftButton || e->button() == MidButton)) { e->button() == LeftButton ? KWin::raiseWindow( winId() ) @@ -1283,7 +1283,7 @@ bool KNote::eventFilter( QObject *o, QEvent *ev ) } #if KDE_IS_VERSION( 3, 5, 1 ) - if ( ev->type() == QEvent::MouseButtonRelease ) + if ( ev->type() == TQEvent::MouseButtonRelease ) { NETRootInfo wm_root( qt_xdisplay(), NET::WMMoveResize ); wm_root.moveResizeRequest( winId(), e->globalX(), e->globalY(), NET::MoveResizeCancel ); @@ -1291,10 +1291,10 @@ bool KNote::eventFilter( QObject *o, QEvent *ev ) } #endif - if ( m_menu && ( ev->type() == QEvent::MouseButtonPress ) + if ( m_menu && ( ev->type() == TQEvent::MouseButtonPress ) && ( e->button() == RightButton ) ) { - m_menu->popup( QCursor::pos() ); + m_menu->popup( TQCursor::pos() ); return true; } @@ -1303,18 +1303,18 @@ bool KNote::eventFilter( QObject *o, QEvent *ev ) if ( o == m_editor ) { - if ( ev->type() == QEvent::FocusOut ) + if ( ev->type() == TQEvent::FocusOut ) { - QFocusEvent *fe = static_cast<QFocusEvent *>(ev); - if ( fe->reason() != QFocusEvent::Popup && - fe->reason() != QFocusEvent::Mouse ) + TQFocusEvent *fe = static_cast<TQFocusEvent *>(ev); + if ( fe->reason() != TQFocusEvent::Popup && + fe->reason() != TQFocusEvent::Mouse ) { updateFocus(); if ( m_editor->isModified() ) saveData(); } } - else if ( ev->type() == QEvent::FocusIn ) + else if ( ev->type() == TQEvent::FocusIn ) updateFocus(); return false; @@ -1323,10 +1323,10 @@ bool KNote::eventFilter( QObject *o, QEvent *ev ) if ( o == m_editor->viewport() ) { if ( m_edit_menu && - ev->type() == QEvent::MouseButtonPress && - ((QMouseEvent *)ev)->button() == RightButton ) + ev->type() == TQEvent::MouseButtonPress && + ((TQMouseEvent *)ev)->button() == RightButton ) { - m_edit_menu->popup( QCursor::pos() ); + m_edit_menu->popup( TQCursor::pos() ); return true; } } |