Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/textedit/textedit.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
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 | |||
@@ -34,12 +34,14 @@ | |||
34 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #include <qpe/qpemenubar.h> | 36 | #include <qpe/qpemenubar.h> |
37 | #include <qpe/qpetoolbar.h> | 37 | #include <qpe/qpetoolbar.h> |
38 | #include <qpe/qcopenvelope_qws.h> | 38 | #include <qpe/qcopenvelope_qws.h> |
39 | 39 | ||
40 | #include <qdatetime.h> | ||
41 | #include <qclipboard.h> | ||
40 | #include <qstringlist.h> | 42 | #include <qstringlist.h> |
41 | #include <qaction.h> | 43 | #include <qaction.h> |
42 | #include <qcolordialog.h> | 44 | #include <qcolordialog.h> |
43 | #include <qfileinfo.h> | 45 | #include <qfileinfo.h> |
44 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
45 | #include <qmessagebox.h> | 47 | #include <qmessagebox.h> |
@@ -47,16 +49,18 @@ | |||
47 | #include <qpopupmenu.h> | 49 | #include <qpopupmenu.h> |
48 | #include <qspinbox.h> | 50 | #include <qspinbox.h> |
49 | #include <qtoolbutton.h> | 51 | #include <qtoolbutton.h> |
50 | #include <qwidgetstack.h> | 52 | #include <qwidgetstack.h> |
51 | #include <qcheckbox.h> | 53 | #include <qcheckbox.h> |
52 | #include <qcombo.h> | 54 | #include <qcombo.h> |
55 | |||
53 | #include <unistd.h> | 56 | #include <unistd.h> |
54 | #include <sys/stat.h> | 57 | #include <sys/stat.h> |
55 | |||
56 | #include <stdlib.h> //getenv | 58 | #include <stdlib.h> //getenv |
59 | |||
60 | |||
57 | /* XPM */ | 61 | /* XPM */ |
58 | static char * filesave_xpm[] = { | 62 | static char * filesave_xpm[] = { |
59 | "16 16 78 1", | 63 | "16 16 78 1", |
60 | " c None", | 64 | " c None", |
61 | ". c #343434", | 65 | ". c #343434", |
62 | "+ c #A0A0A0", | 66 | "+ c #A0A0A0", |
@@ -287,12 +291,19 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
287 | 291 | ||
288 | a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 292 | a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
289 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); | 293 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); |
290 | a->addTo( editBar ); | 294 | a->addTo( editBar ); |
291 | a->addTo( edit ); | 295 | a->addTo( edit ); |
292 | 296 | ||
297 | |||
298 | #ifndef QT_NO_CLIPBOARD | ||
299 | a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | ||
300 | connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) ); | ||
301 | a->addTo( edit ); | ||
302 | #endif | ||
303 | |||
293 | a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 304 | a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
294 | connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); | 305 | connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); |
295 | edit->insertSeparator(); | 306 | edit->insertSeparator(); |
296 | a->addTo( bar ); | 307 | a->addTo( bar ); |
297 | a->addTo( edit ); | 308 | a->addTo( edit ); |
298 | 309 | ||
@@ -508,13 +519,13 @@ void TextEdit::fileNew() | |||
508 | } | 519 | } |
509 | 520 | ||
510 | void TextEdit::fileOpen() | 521 | void TextEdit::fileOpen() |
511 | { | 522 | { |
512 | Config cfg("TextEdit"); | 523 | Config cfg("TextEdit"); |
513 | cfg.setGroup("View"); | 524 | cfg.setGroup("View"); |
514 | bool b=FALSE; | 525 | // bool b=FALSE; |
515 | 526 | ||
516 | QMap<QString, QStringList> map; | 527 | QMap<QString, QStringList> map; |
517 | map.insert(tr("All"), QStringList() ); | 528 | map.insert(tr("All"), QStringList() ); |
518 | QStringList text; | 529 | QStringList text; |
519 | text << "text/*"; | 530 | text << "text/*"; |
520 | map.insert(tr("Text"), text ); | 531 | map.insert(tr("Text"), text ); |
@@ -979,6 +990,15 @@ void TextEdit::doAbout() { | |||
979 | void TextEdit::doAdvanced(bool b) { | 990 | void TextEdit::doAdvanced(bool b) { |
980 | useAdvancedFeatures=b; | 991 | useAdvancedFeatures=b; |
981 | Config cfg("TextEdit"); | 992 | Config cfg("TextEdit"); |
982 | cfg.setGroup("View"); | 993 | cfg.setGroup("View"); |
983 | cfg.writeEntry("AdvancedFeatures",b); | 994 | cfg.writeEntry("AdvancedFeatures",b); |
984 | } | 995 | } |
996 | |||
997 | void TextEdit::editPasteTimeDate() { | ||
998 | #ifndef QT_NO_CLIPBOARD | ||
999 | QClipboard *cb = QApplication::clipboard(); | ||
1000 | QDateTime dt = QDateTime::currentDateTime(); | ||
1001 | cb->setText( dt.toString()); | ||
1002 | editor->paste(); | ||
1003 | #endif | ||
1004 | } | ||