summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp24
-rw-r--r--core/apps/textedit/textedit.h1
2 files changed, 23 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
@@ -28,41 +28,45 @@
#include <qpe/fontdatabase.h>
#include <qpe/global.h>
#include <qpe/fileselector.h>
#include <qpe/applnk.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qcopenvelope_qws.h>
+#include <qdatetime.h>
+#include <qclipboard.h>
#include <qstringlist.h>
#include <qaction.h>
#include <qcolordialog.h>
#include <qfileinfo.h>
#include <qlineedit.h>
#include <qmessagebox.h>
#include <qobjectlist.h>
#include <qpopupmenu.h>
#include <qspinbox.h>
#include <qtoolbutton.h>
#include <qwidgetstack.h>
#include <qcheckbox.h>
#include <qcombo.h>
+
#include <unistd.h>
#include <sys/stat.h>
-
#include <stdlib.h> //getenv
+
+
/* XPM */
static char * filesave_xpm[] = {
"16 16 78 1",
" c None",
". c #343434",
"+ c #A0A0A0",
"@ c #565656",
"# c #9E9E9E",
"$ c #525252",
"% c #929292",
"& c #676767",
"* c #848484",
@@ -281,24 +285,31 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
a->addTo( edit );
a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
a->addTo( editBar );
a->addTo( edit );
a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
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();
a->addTo( bar );
a->addTo( edit );
int defsize;
bool defb, defi, wrap;
Config cfg("TextEdit");
cfg.setGroup("View");
defsize = cfg.readNumEntry("FontSize",10);
@@ -502,25 +513,25 @@ void TextEdit::setWordWrap(bool y)
void TextEdit::fileNew()
{
// if( !bFromDocView ) {
// saveAs();
// }
newFile(DocLnk());
}
void TextEdit::fileOpen()
{
Config cfg("TextEdit");
cfg.setGroup("View");
- bool b=FALSE;
+ // bool b=FALSE;
QMap<QString, QStringList> map;
map.insert(tr("All"), QStringList() );
QStringList text;
text << "text/*";
map.insert(tr("Text"), text );
text << "*";
map.insert(tr("All"), text );
QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map);
if(!str.isEmpty() )
openFile( str );
@@ -973,12 +984,21 @@ void TextEdit::doAbout() {
QMessageBox::about(0,"Text Edit","Text Edit is copyright\n"
"2000 Trolltech AS, and\n"
"2002 by L.J.Potter \nljp@llornkcor.com\n"
"and is licensed under the GPL");
}
void TextEdit::doAdvanced(bool b) {
useAdvancedFeatures=b;
Config cfg("TextEdit");
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
@@ -60,24 +60,25 @@ public:
QAction *nStart, *nFileDlgOpt, *nAdvanced;
bool edited, edited1;
void openFile( const QString & );
QCopChannel * channel;
public slots:
void editorChanged();
void receive(const QCString&, const QByteArray&);
protected:
bool fileIs, useAdvancedFeatures;
void closeEvent( QCloseEvent *e );
void doSearchBar();
private slots:
+ void editPasteTimeDate();
void doAdvanced(bool);
void doAbout();
void setDocument(const QString&);
void changeFont();
void fileNew();
void fileRevert();
void fileOpen();
void changeStartConfig(bool);
bool save();
bool saveAs();
void cleanUp();