summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/microkde/kiconloader.cpp12
-rw-r--r--noncore/apps/tinykate/mainwindow/tinykate.cpp40
2 files changed, 33 insertions, 19 deletions
diff --git a/noncore/apps/tinykate/libkate/microkde/kiconloader.cpp b/noncore/apps/tinykate/libkate/microkde/kiconloader.cpp
index 83a2cad..c5fe5df 100644
--- a/noncore/apps/tinykate/libkate/microkde/kiconloader.cpp
+++ b/noncore/apps/tinykate/libkate/microkde/kiconloader.cpp
@@ -1,33 +1,33 @@
1#include <qpe/resource.h> 1#include <opie2/oresource.h>
2 2
3#include "kiconloader.h" 3#include "kiconloader.h"
4 4
5QPixmap KIconLoader::loadIcon( const QString &name, int ) 5QPixmap KIconLoader::loadIcon( const QString &name, int )
6{ 6{
7 return Resource::loadPixmap( "kate/" + name ); 7 return Opie::Core::OResource::loadPixmap( "kate/" + name, Opie::Core::OResource::SmallIcon );
8} 8}
9 9
10QString KIconLoader::iconPath( const QString &, int ) 10QString KIconLoader::iconPath( const QString &, int )
11{ 11{
12 return QString::null; 12 return QString::null;
13} 13}
14 14
15QPixmap BarIcon( const QString &name ) 15QPixmap BarIcon( const QString &name )
16{ 16{
17 return Resource::loadPixmap( "kate/" + name ); 17 return Opie::Core::OResource::loadPixmap( "kate/" + name, Opie::Core::OResource::SmallIcon );
18} 18}
19 19
20QPixmap DesktopIcon( const QString &name, int ) 20QPixmap DesktopIcon( const QString &name, int )
21{ 21{
22 return Resource::loadPixmap( "kate/" + name ); 22 return Opie::Core::OResource::loadPixmap( "kate/" + name, Opie::Core::OResource::SmallIcon );
23} 23}
24 24
25QPixmap SmallIcon( const QString &name ) 25QPixmap SmallIcon( const QString &name )
26{ 26{
27 return Resource::loadPixmap( "kate/" + name ); 27 return Opie::Core::OResource::loadPixmap( "kate/" + name, Opie::Core::OResource::SmallIcon );
28} 28}
29 29
30QPixmap SmallIconSet( const QString &name ) 30QPixmap SmallIconSet( const QString &name )
31{ 31{
32 return Resource::loadPixmap( "kate/" + name ); 32 return Opie::Core::OResource::loadPixmap( "kate/" + name, Opie::Core::OResource::SmallIcon );
33} 33}
diff --git a/noncore/apps/tinykate/mainwindow/tinykate.cpp b/noncore/apps/tinykate/mainwindow/tinykate.cpp
index 8d19c71..bbb0be7e 100644
--- a/noncore/apps/tinykate/mainwindow/tinykate.cpp
+++ b/noncore/apps/tinykate/mainwindow/tinykate.cpp
@@ -1,215 +1,229 @@
1/*************************************************************************** 1/***************************************************************************
2 tinykate.cpp 2 tinykate.cpp
3 Tiny KATE mainwindow 3 Tiny KATE mainwindow
4 ------------------- 4 -------------------
5 begin : November 2002 5 begin : November 2002
6 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> 6 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org>
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free softwaSre; you can redistribute it and/or modify * 11 * This program is free softwaSre; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation. * 13 * the Free Software Foundation. *
14 * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * 14 * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include "tinykate.h" 18#include "tinykate.h"
19 19
20#include "katedocument.h" 20#include "katedocument.h"
21#include "kglobal.h" 21#include "kglobal.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/odebug.h> 24#include <opie2/odebug.h>
25#include <opie2/ofiledialog.h> 25#include <opie2/ofiledialog.h>
26#include <qpe/resource.h> 26#include <opie2/oresource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28 28
29/* QT */ 29/* QT */
30#include <qaction.h> 30#include <qaction.h>
31#include <qtoolbutton.h> 31#include <qtoolbutton.h>
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qmessagebox.h> 33#include <qmessagebox.h>
34 34
35 35
36using namespace Opie::Ui; 36using namespace Opie::Ui;
37TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : 37TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
38 QMainWindow( parent, name, f ) 38 QMainWindow( parent, name, f )
39{ 39{
40 shutDown=false; 40 shutDown=false;
41 nextUnnamed=0; 41 nextUnnamed=0;
42 currentView=0; 42 currentView=0;
43 viewCount=0; 43 viewCount=0;
44 setCaption(tr("TinyKATE")); 44 setCaption(tr("TinyKATE"));
45 KGlobal::setAppName("TinyKATE"); 45 KGlobal::setAppName("TinyKATE");
46 46
47 QMenuBar *mb = new QMenuBar( this ); 47 QMenuBar *mb = new QMenuBar( this );
48 mb->setMargin( 0 ); 48 mb->setMargin( 0 );
49 49
50 tabwidget=new OTabWidget(this); 50 tabwidget=new OTabWidget(this);
51 setCentralWidget(tabwidget); 51 setCentralWidget(tabwidget);
52 connect(tabwidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(slotCurrentChanged(QWidget*))); 52 connect(tabwidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(slotCurrentChanged(QWidget*)));
53 53
54 //FILE ACTIONS 54 //FILE ACTIONS
55 QPopupMenu *popup = new QPopupMenu( this ); 55 QPopupMenu *popup = new QPopupMenu( this );
56 56
57 // Action for creating a new document 57 // Action for creating a new document
58 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 58 QAction *a = new QAction( tr( "New" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
59 QString::null, 0, this, 0 );
59 a->addTo( popup ); 60 a->addTo( popup );
60 connect(a, SIGNAL(activated()), this, SLOT(slotNew())); 61 connect(a, SIGNAL(activated()), this, SLOT(slotNew()));
61 62
62 // Action for opening an exisiting document 63 // Action for opening an exisiting document
63 a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 ); 64 a = new QAction( tr( "Open" ), Opie::Core::OResource::loadPixmap( "fileopen", Opie::Core::OResource::SmallIcon ),
65 QString::null, 0, this, 0 );
64 a->addTo(popup); 66 a->addTo(popup);
65 connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); 67 connect(a, SIGNAL(activated()), this, SLOT(slotOpen()));
66 68
67 69
68 // Action for saving document 70 // Action for saving document
69 a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); 71 a = new QAction( tr( "Save" ), Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ),
72 QString::null, 0, this, 0 );
70 a->addTo(popup); 73 a->addTo(popup);
71 connect(a, SIGNAL(activated()), this, SLOT(slotSave())); 74 connect(a, SIGNAL(activated()), this, SLOT(slotSave()));
72 75
73 // Action for saving document to a new name 76 // Action for saving document to a new name
74 a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); 77 a = new QAction( tr( "Save As" ), Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ),
78 QString::null, 0, this, 0 );
75 a->addTo(popup); 79 a->addTo(popup);
76 connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); 80 connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs()));
77 81
78 // Action for closing the currently active document 82 // Action for closing the currently active document
79 a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 ); 83 a = new QAction( tr( "Close" ), Opie::Core::OResource::loadPixmap( "quit_icon", Opie::Core::OResource::SmallIcon ),
84 QString::null, 0, this, 0 );
80 a->addTo(popup); 85 a->addTo(popup);
81 connect(a, SIGNAL(activated()), this, SLOT(slotClose())); 86 connect(a, SIGNAL(activated()), this, SLOT(slotClose()));
82 87
83 88
84 mb->insertItem(tr("File"),popup); 89 mb->insertItem(tr("File"),popup);
85 90
86 //EDIT ACTIONS 91 //EDIT ACTIONS
92 bool useBigIcon = qApp->desktop()->size().width() > 330;
87 93
88 // Action for cutting text 94 // Action for cutting text
89 editCut = new QToolButton( 0 ); 95 editCut = new QToolButton( 0 );
96 editCut->setUsesBigPixmap( useBigIcon );
90 editCut->setAutoRaise( true ); 97 editCut->setAutoRaise( true );
91 editCut->setIconSet( Resource::loadPixmap( "cut" ) ); 98 editCut->setIconSet( Opie::Core::OResource::loadPixmap( "cut", Opie::Core::OResource::SmallIcon ) );
92 99
93 // Action for Copying text 100 // Action for Copying text
94 editCopy = new QToolButton( 0 ); 101 editCopy = new QToolButton( 0 );
102 editCopy->setUsesBigPixmap( useBigIcon );
95 editCopy->setAutoRaise( true ); 103 editCopy->setAutoRaise( true );
96 editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); 104 editCopy->setIconSet( Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon ) );
97 105
98 // Action for pasting text 106 // Action for pasting text
99 editPaste = new QToolButton( 0 ); 107 editPaste = new QToolButton( 0 );
108 editPaste->setUsesBigPixmap( useBigIcon );
100 editPaste->setAutoRaise( true ); 109 editPaste->setAutoRaise( true );
101 editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); 110 editPaste->setIconSet( Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ) );
102 111
103 // Action for finding / replacing text 112 // Action for finding / replacing text
104 editFindReplace = new QToolButton( 0 ); 113 editFindReplace = new QToolButton( 0 );
114 editFindReplace->setUsesBigPixmap( useBigIcon );
105 editFindReplace->setAutoRaise( true ); 115 editFindReplace->setAutoRaise( true );
106 editFindReplace->setIconSet( Resource::loadPixmap("find") ); 116 editFindReplace->setIconSet( Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ) );
107 117
108 // Action for undo 118 // Action for undo
109 editUndo = new QToolButton( 0 ); 119 editUndo = new QToolButton( 0 );
120 editUndo->setUsesBigPixmap( useBigIcon );
110 editUndo->setAutoRaise( true ); 121 editUndo->setAutoRaise( true );
111 editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); 122 editUndo->setIconSet( Opie::Core::OResource::loadPixmap( "undo", Opie::Core::OResource::SmallIcon ) );
112 123
113 // Action for redo 124 // Action for redo
114 editRedo = new QToolButton( 0 ); 125 editRedo = new QToolButton( 0 );
126 editRedo->setUsesBigPixmap( useBigIcon );
115 editRedo->setAutoRaise( true ); 127 editRedo->setAutoRaise( true );
116 editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); 128 editRedo->setIconSet( Opie::Core::OResource::loadPixmap( "redo", Opie::Core::OResource::SmallIcon ) );
117 129
118 //VIEW ACITONS 130 //VIEW ACITONS
119 popup = new QPopupMenu( this ); 131 popup = new QPopupMenu( this );
120 132
121 viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); 133 viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 );
122 viewIncFontSizes->addTo( popup ); 134 viewIncFontSizes->addTo( popup );
123 135
124 viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); 136 viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 );
125 viewDecFontSizes->addTo( popup ); 137 viewDecFontSizes->addTo( popup );
126 138
127 mb->insertItem(tr("View"),popup); 139 mb->insertItem(tr("View"),popup);
128 140
129 popup = new QPopupMenu( this ); 141 popup = new QPopupMenu( this );
130 mb->insertItem(tr("Utils"),popup); 142 mb->insertItem(tr("Utils"),popup);
131 143
132 144
133 mb->insertItem( editCut ); 145 mb->insertItem( editCut );
134 mb->insertItem( editCopy ); 146 mb->insertItem( editCopy );
135 mb->insertItem( editPaste ); 147 mb->insertItem( editPaste );
136 mb->insertItem( editFindReplace ); 148 mb->insertItem( editFindReplace );
137 mb->insertItem( editUndo ); 149 mb->insertItem( editUndo );
138 mb->insertItem( editRedo ); 150 mb->insertItem( editRedo );
139 151
140 152
141 //Highlight management 153 //Highlight management
142 hlmenu=new QPopupMenu(this); 154 hlmenu=new QPopupMenu(this);
143 HlManager *hlm=HlManager::self(); 155 HlManager *hlm=HlManager::self();
144 for (int i=0;i<hlm->highlights();i++) 156 for (int i=0;i<hlm->highlights();i++)
145 { 157 {
146 hlmenu->insertItem(hlm->hlName(i),i); 158 hlmenu->insertItem(hlm->hlName(i),i);
147 } 159 }
148 popup->insertItem(tr("Highlighting"),hlmenu); 160 popup->insertItem(tr("Highlighting"),hlmenu);
149 161
150 162
151 utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); 163 utilSettings = new QAction( tr( "Settings" ),
164 Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
165 QString::null, 0, this, 0 );
152 utilSettings->addTo( popup); 166 utilSettings->addTo( popup);
153 167
154 if( qApp->argc() > 1) open(qApp->argv()[1]); 168 if( qApp->argc() > 1) open(qApp->argv()[1]);
155 else slotNew(); 169 else slotNew();
156 170
157} 171}
158 172
159TinyKate::~TinyKate( ) 173TinyKate::~TinyKate( )
160{ 174{
161 owarn << "TinyKate destructor\n" << oendl; 175 owarn << "TinyKate destructor\n" << oendl;
162 176
163 shutDown=true; 177 shutDown=true;
164 while (currentView!=0) 178 while (currentView!=0)
165 { 179 {
166 slotClose(); 180 slotClose();
167 } 181 }
168 182
169 if( KGlobal::config() != 0 ) 183 if( KGlobal::config() != 0 )
170 { 184 {
171 owarn << "deleting KateConfig object..\n" << oendl; 185 owarn << "deleting KateConfig object..\n" << oendl;
172 delete KGlobal::config(); 186 delete KGlobal::config();
173 } 187 }
174} 188}
175 189
176void TinyKate::slotOpen( ) 190void TinyKate::slotOpen( )
177{ 191{
178 QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, 192 QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
179 QString::null); 193 QString::null);
180 if (!filename.isEmpty()) 194 if (!filename.isEmpty())
181 { 195 {
182 open(filename); 196 open(filename);
183 } 197 }
184} 198}
185 199
186void TinyKate::open(const QString & filename) 200void TinyKate::open(const QString & filename)
187{ 201{
188 KateDocument *kd= new KateDocument(false, false, this,0,this); 202 KateDocument *kd= new KateDocument(false, false, this,0,this);
189 KTextEditor::View *kv; 203 KTextEditor::View *kv;
190 QString realFileName; 204 QString realFileName;
191 //check if filename is a .desktop file 205 //check if filename is a .desktop file
192 if ( filename.find( ".desktop", 0, true ) ) 206 if ( filename.find( ".desktop", 0, true ) )
193 { 207 {
194 switch ( QMessageBox::warning( this, tr( "TinyKATE" ), 208 switch ( QMessageBox::warning( this, tr( "TinyKATE" ),
195 tr("TinyKATE has detected<BR>you selected a <B>.desktop</B> file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?" ), 209 tr("TinyKATE has detected<BR>you selected a <B>.desktop</B> file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?" ),
196 tr(".desktop File"), 210 tr(".desktop File"),
197 tr("Linked Document"), 0, 1, 1 ) ) 211 tr("Linked Document"), 0, 1, 1 ) )
198 { 212 {
199 case 0: //desktop 213 case 0: //desktop
200 realFileName = filename; 214 realFileName = filename;
201 break; 215 break;
202 case 1: //linked 216 case 1: //linked
203 DocLnk docLnk( filename ); 217 DocLnk docLnk( filename );
204 realFileName = docLnk.file(); 218 realFileName = docLnk.file();
205 break; 219 break;
206 }; 220 };
207 } 221 }
208 222
209 QFileInfo fileInfo( realFileName ); 223 QFileInfo fileInfo( realFileName );
210 QString filenamed = fileInfo.fileName(); 224 QString filenamed = fileInfo.fileName();
211 tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); 225 tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed );
212 odebug << realFileName << oendl; 226 odebug << realFileName << oendl;
213 227
214 kd->setDocName( filenamed); 228 kd->setDocName( filenamed);
215 kd->open( realFileName ); 229 kd->open( realFileName );