-rw-r--r-- | noncore/apps/tinykate/pics/edit-redo.xpm | 90 | ||||
-rw-r--r-- | noncore/apps/tinykate/pics/edit-undo.xpm | 90 | ||||
-rw-r--r-- | noncore/apps/tinykate/pics/file-new.xpm | 24 | ||||
-rw-r--r-- | noncore/apps/tinykate/pics/file-open.xpm | 25 | ||||
-rw-r--r-- | noncore/apps/tinykate/pics/file-save.xpm | 24 | ||||
-rw-r--r-- | noncore/apps/tinykate/tinykate.cpp | 27 |
6 files changed, 11 insertions, 269 deletions
diff --git a/noncore/apps/tinykate/pics/edit-redo.xpm b/noncore/apps/tinykate/pics/edit-redo.xpm deleted file mode 100644 index 7557ac5..0000000 --- a/noncore/apps/tinykate/pics/edit-redo.xpm +++ b/dev/null @@ -1,90 +0,0 @@ -/* XPM */ -static char * edit_redo_xpm[] = { -"18 17 70 1", -" c None", -". c #1E472E", -"+ c #234E33", -"@ c #1B4029", -"# c #1B422A", -"$ c #AFBEBA", -"% c #DBEADF", -"& c #C1CECC", -"* c #214A30", -"= c #224B31", -"- c #163321", -"; c #BFD0C8", -"> c #90BD9F", -", c #227D37", -"' c #C0D1C9", -") c #245135", -"! c #153220", -"~ c #BDCEC7", -"{ c #2F9645", -"] c #3BB057", -"^ c #43BA5C", -"/ c #224B30", -"( c #173A23", -"_ c #143120", -": c #38774E", -"< c #1E4335", -"[ c #0B281E", -"} c #143D29", -"| c #3FAF57", -"1 c #42B75B", -"2 c #7BA08A", -"3 c #0F2417", -"4 c #081914", -"5 c #050E0D", -"6 c #123926", -"7 c #36A34D", -"8 c #9DC6AA", -"9 c #88AB9C", -"0 c #C2DBCA", -"a c #040B06", -"b c #0A1F18", -"c c #0D3525", -"d c #2A8F3D", -"e c #CFE0D4", -"f c #0A1910", -"g c #0D2419", -"h c #030C0B", -"i c #041714", -"j c #259039", -"k c #3E9951", -"l c #B2D1BC", -"m c #03090A", -"n c #071112", -"o c #55AE72", -"p c #5AB975", -"q c #5AA77B", -"r c #468166", -"s c #000001", -"t c #10211F", -"u c #03080A", -"v c #010003", -"w c #020005", -"x c #000000", -"y c #14311F", -"z c #050B0C", -"A c #162D26", -"B c #050D0E", -"C c #142724", -"D c #090F10", -"E c #050A0C", -" ", -" ", -" ..+ ", -" @#$%&*= ", -" -;>,,,%'* ) ", -" !~,,{]^,,%/ )( ", -" _,:<[[}|1,%*)2( ", -"3,)4 567,890( ", -"a,b c7,de( ", -"fgh i,jkl( ", -" mn 4,opqr( ", -" stu vvvwvvxy ", -" zA5 ", -" BCD ", -" sEs ", -" ", -" "}; diff --git a/noncore/apps/tinykate/pics/edit-undo.xpm b/noncore/apps/tinykate/pics/edit-undo.xpm deleted file mode 100644 index 17a1f30..0000000 --- a/noncore/apps/tinykate/pics/edit-undo.xpm +++ b/dev/null @@ -1,90 +0,0 @@ -/* XPM */ -static char * edit_undo_xpm[] = { -"18 17 70 1", -" c None", -". c #234E33", -"+ c #1E472E", -"@ c #224B31", -"# c #214A30", -"$ c #C1CECC", -"% c #DBEADF", -"& c #AFBEBA", -"* c #1B422A", -"= c #1B4029", -"- c #245135", -"; c #C0D1C9", -"> c #227D37", -", c #90BD9F", -"' c #BFD0C8", -") c #163321", -"! c #173A23", -"~ c #224B30", -"{ c #43BA5C", -"] c #3BB057", -"^ c #2F9645", -"/ c #BDCEC7", -"( c #153220", -"_ c #7BA08A", -": c #42B75B", -"< c #3FAF57", -"[ c #143D29", -"} c #0B281E", -"| c #1E4335", -"1 c #38774E", -"2 c #143120", -"3 c #C2DBCA", -"4 c #88AB9C", -"5 c #9DC6AA", -"6 c #36A34D", -"7 c #123926", -"8 c #050E0D", -"9 c #081914", -"0 c #0F2417", -"a c #CFE0D4", -"b c #2A8F3D", -"c c #0D3525", -"d c #0A1F18", -"e c #040B06", -"f c #B2D1BC", -"g c #3E9951", -"h c #259039", -"i c #041714", -"j c #030C0B", -"k c #0D2419", -"l c #0A1910", -"m c #468166", -"n c #5AA77B", -"o c #5AB975", -"p c #55AE72", -"q c #071112", -"r c #03090A", -"s c #14311F", -"t c #000000", -"u c #010003", -"v c #020005", -"w c #03080A", -"x c #10211F", -"y c #000001", -"z c #162D26", -"A c #050B0C", -"B c #090F10", -"C c #142724", -"D c #050D0E", -"E c #050A0C", -" ", -" ", -" .++ ", -" @#$%&*= ", -"- #;%>>>,') ", -"!- ~%>>{]^>>/( ", -"!_-#%>:<[}}|1>2 ", -"!345>678 9->0 ", -"!ab>6c d>e ", -"!fgh>i jkl ", -"!mnop>9 qr ", -"stuuvuuu wxy ", -" 8zA ", -" BCD ", -" yEy ", -" ", -" "}; diff --git a/noncore/apps/tinykate/pics/file-new.xpm b/noncore/apps/tinykate/pics/file-new.xpm deleted file mode 100644 index ec8dd63..0000000 --- a/noncore/apps/tinykate/pics/file-new.xpm +++ b/dev/null @@ -1,24 +0,0 @@ -/* XPM */ -static const char * file_new_xpm[] = { -"16 16 5 1", -" c None", -". c #808080", -"+ c #FFFFFF", -"@ c #C0C0C0", -"# c #000000", -" .......... ", -" .++++++++@. ", -" .++++++++@+. ", -" .++++++++#### ", -" .++++++++++@# ", -" .++++++++++@# ", -" .++++++++++@# ", -" .++++++++++@# ", -" .++++++++++@# ", -" .++++++++++@# ", -" .++++++++++@# ", -" .++++++++++@# ", -" .++++++++++@# ", -" .++++++++++@# ", -" .@@@@@@@@@@@# ", -" ############# "}; diff --git a/noncore/apps/tinykate/pics/file-open.xpm b/noncore/apps/tinykate/pics/file-open.xpm deleted file mode 100644 index 8449d5b..0000000 --- a/noncore/apps/tinykate/pics/file-open.xpm +++ b/dev/null @@ -1,25 +0,0 @@ -/* XPM */ -static const char * file_open_xpm[] = { -"16 16 6 1", -" c None", -". c #808080", -"+ c #FFFFFF", -"@ c #C0C0C0", -"# c #FFFF00", -"$ c #000000", -" ", -" ..... ", -" .+++++. ", -" .+@#@#@+...... ", -" .+#@#@#@+++++.$", -" .+@#@#@#@#@#@.$", -".............#.$", -".++++++++++.$@.$", -".+@#@#@#@#@#$..$", -" .+@#@#@#@#@.$.$", -" .+#@#@#@#@#@$.$", -" .+#@#@#@#@#.$$", -" ............$$", -" $$$$$$$$$$$$$", -" ", -" "}; diff --git a/noncore/apps/tinykate/pics/file-save.xpm b/noncore/apps/tinykate/pics/file-save.xpm deleted file mode 100644 index 039a174..0000000 --- a/noncore/apps/tinykate/pics/file-save.xpm +++ b/dev/null @@ -1,24 +0,0 @@ -/* XPM */ -static const char * file_save_xpm[] = { -"16 16 5 1", -" c None", -". c #808080", -"+ c #FFFFFF", -"@ c #000000", -"# c #0000FF", -" ", -" ........ ", -" .++++++.@ ", -" .+....+.+@ #", -" .++++++.@@@ ##", -" .+....++++@ ##@", -" .+++++++++@##@ ", -" .+.......+##@ ", -" .++++++++##@ ", -" .+......@#@ ", -" .++++++@@@@ ", -" .+....@@@+@ ", -" .++++@++++@ ", -" .+++++++++@ ", -" @@@@@@@@@@@ ", -" "}; diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp index aecc1bd..a25f81f 100644 --- a/noncore/apps/tinykate/tinykate.cpp +++ b/noncore/apps/tinykate/tinykate.cpp @@ -1,249 +1,244 @@ /*************************************************************************** tinykate.cpp Tiny KATE mainwindow ------------------- begin : November 2002 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation. * * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * * * ***************************************************************************/ #include <qwidget.h> #include <qaction.h> #include <qlayout.h> #include <qpe/qpetoolbar.h> #include <qpe/qpemenubar.h> #include <qpe/resource.h> #include <qpe/global.h> #include <qpe/qpeapplication.h> #include <opie/ofiledialog.h> #include "tinykate.h" -#include "pics/file-new.xpm" -#include "pics/file-open.xpm" -#include "pics/file-save.xpm" -#include "pics/edit-undo.xpm" -#include "pics/edit-redo.xpm" #include <katedocument.h> #include <katehighlight.h> #include <kateview.h> #include <kglobal.h> TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f ) -{ +{ nextUnnamed=0; currentView=0; viewCount=0; setCaption(tr("TinyKATE")); KGlobal::setAppName("TinyKATE"); setToolBarsMovable(FALSE); QPEToolBar *bar = new QPEToolBar( this ); bar->setHorizontalStretchable( TRUE ); QPEMenuBar *mb = new QPEMenuBar( bar ); mb->setMargin( 0 ); tabwidget=new OTabWidget(this); setCentralWidget(tabwidget); connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); //FILE ACTIONS QPopupMenu *popup = new QPopupMenu( this ); // Action for creating a new document - QAction *a = new QAction( tr( "New" ), QPixmap((const char**)file_new_xpm ), QString::null, 0, this, 0 ); + QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); a->addTo( popup ); connect(a, SIGNAL(activated()), this, SLOT(slotNew())); // Action for opening an exisiting document - a = new QAction( tr( "Open" ), QPixmap((const char**)file_open_xpm), QString::null, 0, this, 0 ); + a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); // Action for saving document - a = new QAction( tr( "Save" ), QPixmap((const char**)file_save_xpm), QString::null, 0, this, 0 ); + a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotSave())); // Action for saving document to a new name - a = new QAction( tr( "Save As" ), QPixmap((const char**)file_save_xpm), QString::null, 0, this, 0 ); + a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); // Action for closing the currently active document - a = new QAction( tr( "Close" ), QPixmap(), QString::null, 0, this, 0 ); + a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotClose())); - + mb->insertItem(tr("File"),popup); //EDIT ACTIONS // Action for cutting text editCut = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); editCut->addTo( bar ); // Action for Copying text editCopy = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 ); editCopy->addTo( bar ); // Action for pasting text editPaste = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); editPaste->addTo( bar ); // Action for finding / replacing text editFindReplace = new QAction( tr( "Find/Replace" ), Resource::loadPixmap("find"), QString::null, 0, this, 0 ); editFindReplace->addTo( bar ); // Action for undo - editUndo = new QAction( tr( "Undo" ), QPixmap((const char**)edit_undo_xpm), QString::null, 0, this, 0 ); + editUndo = new QAction( tr( "Undo" ),Resource::loadPixmap( "undo" ) , QString::null, 0, this, 0 ); editUndo->addTo( bar ); // Action for redo - editRedo = new QAction( tr( "Redo" ), QPixmap((const char**)edit_redo_xpm), QString::null, 0, this, 0 ); + editRedo = new QAction( tr( "Redo" ),Resource::loadPixmap( "redo" ) , QString::null, 0, this, 0 ); editRedo->addTo( bar ); //VIEW ACITONS popup = new QPopupMenu( this ); - + viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); viewIncFontSizes->addTo( popup ); viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); viewDecFontSizes->addTo( popup ); mb->insertItem(tr("View"),popup); popup = new QPopupMenu( this ); mb->insertItem(tr("Utils"),popup); //Highlight management hlmenu=new QPopupMenu(this); HlManager *hlm=HlManager::self(); for (int i=0;i<hlm->highlights();i++) { hlmenu->insertItem(hlm->hlName(i),i); } popup->insertItem(tr("Highlighting"),hlmenu); utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); utilSettings->addTo( popup); if( qApp->argc() > 1) open(qApp->argv()[1]); else slotNew(); } TinyKate::~TinyKate( ) { qWarning("TinyKate destructor\n"); if( KGlobal::config() != 0 ) { qWarning("deleting KateConfig object..\n"); delete KGlobal::config(); } } void TinyKate::slotOpen( ) { QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, QPEApplication::documentDir()); if (!filename.isEmpty()) { open(filename); } } void TinyKate::open(const QString & filename) { KateDocument *kd= new KateDocument(false, false, this,0,this); KTextEditor::View *kv; QFileInfo fi(filename); QString filenamed = fi.fileName(); tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); qDebug(filename); kd->setDocName( filenamed); kd->open( filename ); viewCount++; } void TinyKate::slotCurrentChanged( QWidget * view) { if (currentView) { disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); } currentView=(KTextEditor::View*)view; - + connect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); connect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); connect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); connect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); connect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); } void TinyKate::slotNew( ) { KateDocument *kd= new KateDocument(false, false, this,0,this); KTextEditor::View *kv; tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), "tinykate/tinykate", tr("Unnamed %1").arg(nextUnnamed++)); viewCount++; } void TinyKate::slotClose( ) { if (currentView==0) return; KTextEditor::View *dv=currentView; currentView=0; tabwidget->removePage(dv); delete dv->document(); viewCount--; if (!viewCount) slotNew(); } void TinyKate::slotSave() { // feel free to make this how you want if (currentView==0) return; // KateView *kv = (KateView*) currentView; KateDocument *kd = (KateDocument*) currentView->document(); // qDebug("saving file "+kd->docName()); if( kd->docName().isEmpty()) slotSaveAs(); else kd->saveFile(); // kv->save(); // kd->saveFile(); } |