-rw-r--r-- | core/apps/textedit/textedit.cpp | 77 | ||||
-rw-r--r-- | core/apps/textedit/textedit.h | 4 | ||||
-rw-r--r-- | core/apps/textedit/textedit.pro | 4 |
3 files changed, 43 insertions, 42 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index b8d62db..403bd92 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -1,71 +1,71 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ // changes added by L. J. Potter Sun 02-17-2002 21:31:31 #include "textedit.h" -#include "fileBrowser.h" +//#include "fileBrowser.h" #include "fileSaver.h" #include "filePermissions.h" #include "fontDialog.h" #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 <qpe/finddialog.h> #include <opie/ofileselector.h> #include <opie/ofiledialog.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", @@ -462,135 +462,136 @@ void TextEdit::setFontSize(int sz, bool round_down_not_up) s = fontsize[i]; break; } } } QFont f = editor->font(); f.setPointSize(s); editor->setFont(f); zin->setEnabled(s != fontsize[nfontsizes-1]); zout->setEnabled(s != fontsize[0]); } void TextEdit::setBold(bool y) { QFont f = editor->font(); f.setBold(y); editor->setFont(f); } void TextEdit::setItalic(bool y) { QFont f = editor->font(); f.setItalic(y); editor->setFont(f); } void TextEdit::setWordWrap(bool y) { bool state = editor->edited(); editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); editor->setEdited( state ); } void TextEdit::fileNew() { // if( !bFromDocView ) { // saveAs(); // } newFile(DocLnk()); } void TextEdit::fileOpen() { Config cfg("TextEdit"); cfg.setGroup("View"); bool b=FALSE; - if(cfg.readEntry("useOldFileDialog") == "TRUE") - b=TRUE; - if(!b) { - QString str = OFileDialog::getOpenFileName( 1,"/","", "*", this ); +// if(cfg.readEntry("useOldFileDialog") == "TRUE") +// b=TRUE; +// if(!b) { + QString str = OFileDialog::getOpenFileName( 1,"/")://,"", "*", this ); if(!str.isEmpty() ) openFile( str ); - } else { - QString str; - browseForFiles = new fileBrowser(this,tr("Open File"),TRUE,0, "*"); // - browseForFiles->setFileView( viewSelection ); - browseForFiles->showMaximized(); -// if( result != -1 ) - - if( browseForFiles->exec() != -1 ) { - QString selFile = browseForFiles->selectedFileName; - QStringList fileList = browseForFiles->fileList; - qDebug(selFile); - QStringList::ConstIterator f; - QString fileTemp; - for ( f = fileList.begin(); f != fileList.end(); f++ ) { - fileTemp = *f; - fileTemp.right( fileTemp.length()-5); - QString fileName = fileTemp; - if( fileName != "Unnamed" || fileName != "Empty Text" ) { - currentFileName = fileName; - qDebug("please open "+currentFileName); - openFile(currentFileName ); - } - } - viewSelection = browseForFiles->SelectionCombo->currentItem(); - } - delete browseForFiles; - editor->setEdited( FALSE); - edited1=FALSE; - edited=FALSE; - if(caption().left(1)=="*") - setCaption(caption().right(caption().length()-1)); - doSearchBar(); - } +// } else { +// QString str; +// browseForFiles = new fileBrowser(this,tr("Open File"),TRUE,0, "*"); // +// browseForFiles->setFileView( viewSelection ); +// browseForFiles->showMaximized(); +// // if( result != -1 ) + +// if( browseForFiles->exec() != -1 ) { +// QString selFile = browseForFiles->selectedFileName; +// QStringList fileList = browseForFiles->fileList; +// qDebug(selFile); +// QStringList::ConstIterator f; +// QString fileTemp; +// for ( f = fileList.begin(); f != fileList.end(); f++ ) { +// fileTemp = *f; +// fileTemp.right( fileTemp.length()-5); +// QString fileName = fileTemp; +// if( fileName != "Unnamed" || fileName != "Empty Text" ) { +// currentFileName = fileName; +// qDebug("please open "+currentFileName); +// openFile(currentFileName ); +// } +// } +// viewSelection = browseForFiles->SelectionCombo->currentItem(); +// } +// delete browseForFiles; +// editor->setEdited( FALSE); +// edited1=FALSE; +// edited=FALSE; +// if(caption().left(1)=="*") +// setCaption(caption().right(caption().length()-1)); +// doSearchBar(); +// } + } void TextEdit::doSearchBar() { Config cfg("TextEdit"); cfg.setGroup("View"); if(cfg.readEntry("SearchBar","Closed") != "Opened") searchBar->hide(); } #if 0 void TextEdit::slotFind() { FindDialog frmFind( tr("Text Editor"), this ); connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), editor, SLOT(slotDoFind( const QString&,bool,bool))); //case sensitive, backwards, [category] connect( editor, SIGNAL(notFound()), &frmFind, SLOT(slotNotFound()) ); connect( editor, SIGNAL(searchWrapped()), &frmFind, SLOT(slotWrapAround()) ); frmFind.exec(); } #endif void TextEdit::fileRevert() { clear(); fileOpen(); } void TextEdit::editCut() { #ifndef QT_NO_CLIPBOARD editor->cut(); #endif } void TextEdit::editCopy() { #ifndef QT_NO_CLIPBOARD editor->copy(); #endif diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h index 9d27ab0..d8208b1 100644 --- a/core/apps/textedit/textedit.h +++ b/core/apps/textedit/textedit.h @@ -1,126 +1,126 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ // additions made by L.J. Potter Sun 02-17-2002 22:27:46 #ifndef TEXTEDIT_H #define TEXTEDIT_H #define QTEXTEDIT_OPEN_API -#include "fileBrowser.h" +//#include "fileBrowser.h" #include "fileSaver.h" #include <qpe/filemanager.h> #include <qpe/qcopenvelope_qws.h> #include <opie/ofileselector.h> #include <qmainwindow.h> #include <qmultilineedit.h> #include <qlist.h> #include <qmap.h> class QAction; class QWidgetStack; class QToolButton; class QPopupMenu; class QToolBar; class QLineEdit; class QAction; class FileSelector; class QpeEditor; class QPopupMenu; class TextEdit : public QMainWindow { Q_OBJECT public: TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); ~TextEdit(); QPopupMenu *font; QAction *nStart, *nFileDlgOpt; bool edited, edited1; void openFile( const QString & ); QCopChannel * channel; public slots: void editorChanged(); void receive(const QCString&, const QByteArray&); protected: bool fileIs; void closeEvent( QCloseEvent *e ); void doSearchBar(); private slots: void doAbout(); void setDocument(const QString&); void changeFont(); void fileNew(); void fileRevert(); void fileOpen(); void changeStartConfig(bool); bool save(); bool saveAs(); void cleanUp(); void editCut(); void editCopy(); void editPaste(); void editFind(); void editDelete(); void findNext(); void findClose(); void search(); void accept(); void newFile( const DocLnk & ); void openFile( const DocLnk & ); void showEditTools(); void zoomIn(); void zoomOut(); void setBold(bool y); void setItalic(bool y); void setWordWrap(bool y); private: void colorChanged( const QColor &c ); void clear(); void updateCaption( const QString &name=QString::null ); void setFontSize(int sz, bool round_down_not_up); private: fileSaver *fileSaveDlg; - fileBrowser *browseForFiles; +// fileBrowser *browseForFiles; QpeEditor* editor; QToolBar *menu, *editBar, *searchBar; QLineEdit *searchEdit; DocLnk *doc; bool searchVisible; bool bFromDocView; int viewSelection; QAction *zin, *zout; QString currentFileName; }; #endif diff --git a/core/apps/textedit/textedit.pro b/core/apps/textedit/textedit.pro index 4f20da3..d01a9f4 100644 --- a/core/apps/textedit/textedit.pro +++ b/core/apps/textedit/textedit.pro @@ -1,25 +1,25 @@ TEMPLATE = app CONFIG += qt warn_on release DESTDIR = $(OPIEDIR)/bin -HEADERS = textedit.h fileBrowser.h fontDialog.h fileSaver.h filePermissions.h -SOURCES = main.cpp textedit.cpp fileBrowser.cpp fontDialog.cpp fileSaver.cpp filePermissions.cpp +HEADERS = textedit.h fontDialog.h fileSaver.h filePermissions.h +SOURCES = main.cpp textedit.cpp fontDialog.cpp fileSaver.cpp filePermissions.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie TARGET = textedit TRANSLATIONS += ../i18n/de/textedit.ts TRANSLATIONS += ../i18n/pt_BR/textedit.ts TRANSLATIONS += ../i18n/en/textedit.ts TRANSLATIONS += ../i18n/hu/textedit.ts TRANSLATIONS += ../i18n/fr/textedit.ts TRANSLATIONS += ../i18n/ja/textedit.ts TRANSLATIONS += ../i18n/sl/textedit.ts TRANSLATIONS += ../i18n/pl/textedit.ts TRANSLATIONS += ../i18n/ko/textedit.ts TRANSLATIONS += ../i18n/no/textedit.ts TRANSLATIONS += ../i18n/zh_CN/textedit.ts TRANSLATIONS += ../i18n/zh_TW/textedit.ts |