From 1619cf87bd1db9e991dd22f528798e1463344d4c Mon Sep 17 00:00:00 2001 From: llornkcor Date: Sun, 28 Jul 2002 15:05:31 +0000 Subject: added Insert Time adn Date to edit menu --- diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 9e6ba8d..107695a 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -37,6 +37,8 @@ #include #include +#include +#include #include #include #include @@ -50,10 +52,12 @@ #include #include #include + #include #include - #include //getenv + + /* XPM */ static char * filesave_xpm[] = { "16 16 78 1", @@ -290,6 +294,13 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) a->addTo( editBar ); a->addTo( edit ); + +#ifndef QT_NO_CLIPBOARD + a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); + connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) ); + a->addTo( edit ); +#endif + a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); edit->insertSeparator(); @@ -511,7 +522,7 @@ void TextEdit::fileOpen() { Config cfg("TextEdit"); cfg.setGroup("View"); - bool b=FALSE; + // bool b=FALSE; QMap map; map.insert(tr("All"), QStringList() ); @@ -982,3 +993,12 @@ void TextEdit::doAdvanced(bool b) { cfg.setGroup("View"); cfg.writeEntry("AdvancedFeatures",b); } + +void TextEdit::editPasteTimeDate() { +#ifndef QT_NO_CLIPBOARD + QClipboard *cb = QApplication::clipboard(); + QDateTime dt = QDateTime::currentDateTime(); + cb->setText( dt.toString()); + editor->paste(); +#endif +} diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h index aec6427..a2badaa 100644 --- a/core/apps/textedit/textedit.h +++ b/core/apps/textedit/textedit.h @@ -69,6 +69,7 @@ protected: void closeEvent( QCloseEvent *e ); void doSearchBar(); private slots: + void editPasteTimeDate(); void doAdvanced(bool); void doAbout(); void setDocument(const QString&); -- cgit v0.9.0.2