author | harlekin <harlekin> | 2003-03-21 20:59:43 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-21 20:59:43 (UTC) |
commit | a1342464252328754954a59abf82d6dd030c88f0 (patch) (unidiff) | |
tree | e49e5c3e9cd9fd4816df78b788f7a9999d4b4581 | |
parent | 1e1a09e08d441db9ee899845a0200a5f70ac38a1 (diff) | |
download | opie-a1342464252328754954a59abf82d6dd030c88f0.zip opie-a1342464252328754954a59abf82d6dd030c88f0.tar.gz opie-a1342464252328754954a59abf82d6dd030c88f0.tar.bz2 |
adapted to new icons
-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 @@ | |||
1 | /* XPM */ | ||
2 | static char * edit_redo_xpm[] = { | ||
3 | "18 17 70 1", | ||
4 | " c None", | ||
5 | ".c #1E472E", | ||
6 | "+c #234E33", | ||
7 | "@c #1B4029", | ||
8 | "#c #1B422A", | ||
9 | "$c #AFBEBA", | ||
10 | "%c #DBEADF", | ||
11 | "&c #C1CECC", | ||
12 | "*c #214A30", | ||
13 | "=c #224B31", | ||
14 | "-c #163321", | ||
15 | ";c #BFD0C8", | ||
16 | ">c #90BD9F", | ||
17 | ",c #227D37", | ||
18 | "'c #C0D1C9", | ||
19 | ")c #245135", | ||
20 | "!c #153220", | ||
21 | "~c #BDCEC7", | ||
22 | "{c #2F9645", | ||
23 | "]c #3BB057", | ||
24 | "^c #43BA5C", | ||
25 | "/c #224B30", | ||
26 | "(c #173A23", | ||
27 | "_c #143120", | ||
28 | ":c #38774E", | ||
29 | "<c #1E4335", | ||
30 | "[c #0B281E", | ||
31 | "}c #143D29", | ||
32 | "|c #3FAF57", | ||
33 | "1c #42B75B", | ||
34 | "2c #7BA08A", | ||
35 | "3c #0F2417", | ||
36 | "4c #081914", | ||
37 | "5c #050E0D", | ||
38 | "6c #123926", | ||
39 | "7c #36A34D", | ||
40 | "8c #9DC6AA", | ||
41 | "9c #88AB9C", | ||
42 | "0c #C2DBCA", | ||
43 | "ac #040B06", | ||
44 | "bc #0A1F18", | ||
45 | "cc #0D3525", | ||
46 | "dc #2A8F3D", | ||
47 | "ec #CFE0D4", | ||
48 | "fc #0A1910", | ||
49 | "gc #0D2419", | ||
50 | "hc #030C0B", | ||
51 | "ic #041714", | ||
52 | "jc #259039", | ||
53 | "kc #3E9951", | ||
54 | "lc #B2D1BC", | ||
55 | "mc #03090A", | ||
56 | "nc #071112", | ||
57 | "oc #55AE72", | ||
58 | "pc #5AB975", | ||
59 | "qc #5AA77B", | ||
60 | "rc #468166", | ||
61 | "sc #000001", | ||
62 | "tc #10211F", | ||
63 | "uc #03080A", | ||
64 | "vc #010003", | ||
65 | "wc #020005", | ||
66 | "xc #000000", | ||
67 | "yc #14311F", | ||
68 | "zc #050B0C", | ||
69 | "Ac #162D26", | ||
70 | "Bc #050D0E", | ||
71 | "Cc #142724", | ||
72 | "Dc #090F10", | ||
73 | "Ec #050A0C", | ||
74 | " ", | ||
75 | " ", | ||
76 | " ..+ ", | ||
77 | " @#$%&*= ", | ||
78 | " -;>,,,%'* ) ", | ||
79 | " !~,,{]^,,%/ )( ", | ||
80 | " _,:<[[}|1,%*)2( ", | ||
81 | "3,)4 567,890( ", | ||
82 | "a,b c7,de( ", | ||
83 | "fgh i,jkl( ", | ||
84 | " mn 4,opqr( ", | ||
85 | " stu vvvwvvxy ", | ||
86 | " zA5 ", | ||
87 | " BCD ", | ||
88 | " sEs ", | ||
89 | " ", | ||
90 | " "}; | ||
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 @@ | |||
1 | /* XPM */ | ||
2 | static char * edit_undo_xpm[] = { | ||
3 | "18 17 70 1", | ||
4 | " c None", | ||
5 | ".c #234E33", | ||
6 | "+c #1E472E", | ||
7 | "@c #224B31", | ||
8 | "#c #214A30", | ||
9 | "$c #C1CECC", | ||
10 | "%c #DBEADF", | ||
11 | "&c #AFBEBA", | ||
12 | "*c #1B422A", | ||
13 | "=c #1B4029", | ||
14 | "-c #245135", | ||
15 | ";c #C0D1C9", | ||
16 | ">c #227D37", | ||
17 | ",c #90BD9F", | ||
18 | "'c #BFD0C8", | ||
19 | ")c #163321", | ||
20 | "!c #173A23", | ||
21 | "~c #224B30", | ||
22 | "{c #43BA5C", | ||
23 | "]c #3BB057", | ||
24 | "^c #2F9645", | ||
25 | "/c #BDCEC7", | ||
26 | "(c #153220", | ||
27 | "_c #7BA08A", | ||
28 | ":c #42B75B", | ||
29 | "<c #3FAF57", | ||
30 | "[c #143D29", | ||
31 | "}c #0B281E", | ||
32 | "|c #1E4335", | ||
33 | "1c #38774E", | ||
34 | "2c #143120", | ||
35 | "3c #C2DBCA", | ||
36 | "4c #88AB9C", | ||
37 | "5c #9DC6AA", | ||
38 | "6c #36A34D", | ||
39 | "7c #123926", | ||
40 | "8c #050E0D", | ||
41 | "9c #081914", | ||
42 | "0c #0F2417", | ||
43 | "ac #CFE0D4", | ||
44 | "bc #2A8F3D", | ||
45 | "cc #0D3525", | ||
46 | "dc #0A1F18", | ||
47 | "ec #040B06", | ||
48 | "fc #B2D1BC", | ||
49 | "gc #3E9951", | ||
50 | "hc #259039", | ||
51 | "ic #041714", | ||
52 | "jc #030C0B", | ||
53 | "kc #0D2419", | ||
54 | "lc #0A1910", | ||
55 | "mc #468166", | ||
56 | "nc #5AA77B", | ||
57 | "oc #5AB975", | ||
58 | "pc #55AE72", | ||
59 | "qc #071112", | ||
60 | "rc #03090A", | ||
61 | "sc #14311F", | ||
62 | "tc #000000", | ||
63 | "uc #010003", | ||
64 | "vc #020005", | ||
65 | "wc #03080A", | ||
66 | "xc #10211F", | ||
67 | "yc #000001", | ||
68 | "zc #162D26", | ||
69 | "Ac #050B0C", | ||
70 | "Bc #090F10", | ||
71 | "Cc #142724", | ||
72 | "Dc #050D0E", | ||
73 | "Ec #050A0C", | ||
74 | " ", | ||
75 | " ", | ||
76 | " .++ ", | ||
77 | " @#$%&*= ", | ||
78 | "- #;%>>>,') ", | ||
79 | "!- ~%>>{]^>>/( ", | ||
80 | "!_-#%>:<[}}|1>2 ", | ||
81 | "!345>678 9->0 ", | ||
82 | "!ab>6c d>e ", | ||
83 | "!fgh>i jkl ", | ||
84 | "!mnop>9 qr ", | ||
85 | "stuuvuuu wxy ", | ||
86 | " 8zA ", | ||
87 | " BCD ", | ||
88 | " yEy ", | ||
89 | " ", | ||
90 | " "}; | ||
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 @@ | |||
1 | /* XPM */ | ||
2 | static const char * file_new_xpm[] = { | ||
3 | "16 16 5 1", | ||
4 | " c None", | ||
5 | ".c #808080", | ||
6 | "+c #FFFFFF", | ||
7 | "@c #C0C0C0", | ||
8 | "#c #000000", | ||
9 | " .......... ", | ||
10 | " .++++++++@. ", | ||
11 | " .++++++++@+. ", | ||
12 | " .++++++++#### ", | ||
13 | " .++++++++++@# ", | ||
14 | " .++++++++++@# ", | ||
15 | " .++++++++++@# ", | ||
16 | " .++++++++++@# ", | ||
17 | " .++++++++++@# ", | ||
18 | " .++++++++++@# ", | ||
19 | " .++++++++++@# ", | ||
20 | " .++++++++++@# ", | ||
21 | " .++++++++++@# ", | ||
22 | " .++++++++++@# ", | ||
23 | " .@@@@@@@@@@@# ", | ||
24 | " ############# "}; | ||
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 @@ | |||
1 | /* XPM */ | ||
2 | static const char * file_open_xpm[] = { | ||
3 | "16 16 6 1", | ||
4 | " c None", | ||
5 | ".c #808080", | ||
6 | "+c #FFFFFF", | ||
7 | "@c #C0C0C0", | ||
8 | "#c #FFFF00", | ||
9 | "$c #000000", | ||
10 | " ", | ||
11 | " ..... ", | ||
12 | " .+++++. ", | ||
13 | " .+@#@#@+...... ", | ||
14 | " .+#@#@#@+++++.$", | ||
15 | " .+@#@#@#@#@#@.$", | ||
16 | ".............#.$", | ||
17 | ".++++++++++.$@.$", | ||
18 | ".+@#@#@#@#@#$..$", | ||
19 | " .+@#@#@#@#@.$.$", | ||
20 | " .+#@#@#@#@#@$.$", | ||
21 | " .+#@#@#@#@#.$$", | ||
22 | " ............$$", | ||
23 | " $$$$$$$$$$$$$", | ||
24 | " ", | ||
25 | " "}; | ||
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 @@ | |||
1 | /* XPM */ | ||
2 | static const char * file_save_xpm[] = { | ||
3 | "16 16 5 1", | ||
4 | " c None", | ||
5 | ".c #808080", | ||
6 | "+c #FFFFFF", | ||
7 | "@c #000000", | ||
8 | "#c #0000FF", | ||
9 | " ", | ||
10 | " ........ ", | ||
11 | " .++++++.@ ", | ||
12 | " .+....+.+@ #", | ||
13 | " .++++++.@@@ ##", | ||
14 | " .+....++++@ ##@", | ||
15 | " .+++++++++@##@ ", | ||
16 | " .+.......+##@ ", | ||
17 | " .++++++++##@ ", | ||
18 | " .+......@#@ ", | ||
19 | " .++++++@@@@ ", | ||
20 | " .+....@@@+@ ", | ||
21 | " .++++@++++@ ", | ||
22 | " .+++++++++@ ", | ||
23 | " @@@@@@@@@@@ ", | ||
24 | " "}; | ||
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 @@ | |||
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 software; you can redistribute it and/or modify * | 11 | * This program is free software; 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 | #include <qwidget.h> | 17 | #include <qwidget.h> |
18 | #include <qaction.h> | 18 | #include <qaction.h> |
19 | #include <qlayout.h> | 19 | #include <qlayout.h> |
20 | #include <qpe/qpetoolbar.h> | 20 | #include <qpe/qpetoolbar.h> |
21 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
22 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | 25 | ||
26 | #include <opie/ofiledialog.h> | 26 | #include <opie/ofiledialog.h> |
27 | 27 | ||
28 | #include "tinykate.h" | 28 | #include "tinykate.h" |
29 | #include "pics/file-new.xpm" | ||
30 | #include "pics/file-open.xpm" | ||
31 | #include "pics/file-save.xpm" | ||
32 | #include "pics/edit-undo.xpm" | ||
33 | #include "pics/edit-redo.xpm" | ||
34 | 29 | ||
35 | #include <katedocument.h> | 30 | #include <katedocument.h> |
36 | #include <katehighlight.h> | 31 | #include <katehighlight.h> |
37 | #include <kateview.h> | 32 | #include <kateview.h> |
38 | #include <kglobal.h> | 33 | #include <kglobal.h> |
39 | 34 | ||
40 | TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : | 35 | TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : |
41 | QMainWindow( parent, name, f ) | 36 | QMainWindow( parent, name, f ) |
42 | { | 37 | { |
43 | nextUnnamed=0; | 38 | nextUnnamed=0; |
44 | currentView=0; | 39 | currentView=0; |
45 | viewCount=0; | 40 | viewCount=0; |
46 | setCaption(tr("TinyKATE")); | 41 | setCaption(tr("TinyKATE")); |
47 | KGlobal::setAppName("TinyKATE"); | 42 | KGlobal::setAppName("TinyKATE"); |
48 | 43 | ||
49 | setToolBarsMovable(FALSE); | 44 | setToolBarsMovable(FALSE); |
50 | 45 | ||
51 | QPEToolBar *bar = new QPEToolBar( this ); | 46 | QPEToolBar *bar = new QPEToolBar( this ); |
52 | bar->setHorizontalStretchable( TRUE ); | 47 | bar->setHorizontalStretchable( TRUE ); |
53 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 48 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
54 | mb->setMargin( 0 ); | 49 | mb->setMargin( 0 ); |
55 | 50 | ||
56 | tabwidget=new OTabWidget(this); | 51 | tabwidget=new OTabWidget(this); |
57 | setCentralWidget(tabwidget); | 52 | setCentralWidget(tabwidget); |
58 | connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); | 53 | connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); |
59 | 54 | ||
60 | //FILE ACTIONS | 55 | //FILE ACTIONS |
61 | QPopupMenu *popup = new QPopupMenu( this ); | 56 | QPopupMenu *popup = new QPopupMenu( this ); |
62 | 57 | ||
63 | // Action for creating a new document | 58 | // Action for creating a new document |
64 | QAction *a = new QAction( tr( "New" ), QPixmap((const char**)file_new_xpm ), QString::null, 0, this, 0 ); | 59 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
65 | a->addTo( popup ); | 60 | a->addTo( popup ); |
66 | connect(a, SIGNAL(activated()), this, SLOT(slotNew())); | 61 | connect(a, SIGNAL(activated()), this, SLOT(slotNew())); |
67 | 62 | ||
68 | // Action for opening an exisiting document | 63 | // Action for opening an exisiting document |
69 | a = new QAction( tr( "Open" ), QPixmap((const char**)file_open_xpm), QString::null, 0, this, 0 ); | 64 | a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 ); |
70 | a->addTo(popup); | 65 | a->addTo(popup); |
71 | connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); | 66 | connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); |
72 | 67 | ||
73 | 68 | ||
74 | // Action for saving document | 69 | // Action for saving document |
75 | a = new QAction( tr( "Save" ), QPixmap((const char**)file_save_xpm), QString::null, 0, this, 0 ); | 70 | a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); |
76 | a->addTo(popup); | 71 | a->addTo(popup); |
77 | connect(a, SIGNAL(activated()), this, SLOT(slotSave())); | 72 | connect(a, SIGNAL(activated()), this, SLOT(slotSave())); |
78 | 73 | ||
79 | // Action for saving document to a new name | 74 | // Action for saving document to a new name |
80 | a = new QAction( tr( "Save As" ), QPixmap((const char**)file_save_xpm), QString::null, 0, this, 0 ); | 75 | a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); |
81 | a->addTo(popup); | 76 | a->addTo(popup); |
82 | connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); | 77 | connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); |
83 | 78 | ||
84 | // Action for closing the currently active document | 79 | // Action for closing the currently active document |
85 | a = new QAction( tr( "Close" ), QPixmap(), QString::null, 0, this, 0 ); | 80 | a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 ); |
86 | a->addTo(popup); | 81 | a->addTo(popup); |
87 | connect(a, SIGNAL(activated()), this, SLOT(slotClose())); | 82 | connect(a, SIGNAL(activated()), this, SLOT(slotClose())); |
88 | 83 | ||
89 | 84 | ||
90 | mb->insertItem(tr("File"),popup); | 85 | mb->insertItem(tr("File"),popup); |
91 | 86 | ||
92 | //EDIT ACTIONS | 87 | //EDIT ACTIONS |
93 | 88 | ||
94 | // Action for cutting text | 89 | // Action for cutting text |
95 | editCut = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); | 90 | editCut = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); |
96 | editCut->addTo( bar ); | 91 | editCut->addTo( bar ); |
97 | 92 | ||
98 | // Action for Copying text | 93 | // Action for Copying text |
99 | editCopy = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 ); | 94 | editCopy = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 ); |
100 | editCopy->addTo( bar ); | 95 | editCopy->addTo( bar ); |
101 | 96 | ||
102 | // Action for pasting text | 97 | // Action for pasting text |
103 | editPaste = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 98 | editPaste = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
104 | editPaste->addTo( bar ); | 99 | editPaste->addTo( bar ); |
105 | 100 | ||
106 | 101 | ||
107 | // Action for finding / replacing text | 102 | // Action for finding / replacing text |
108 | editFindReplace = new QAction( tr( "Find/Replace" ), Resource::loadPixmap("find"), QString::null, 0, this, 0 ); | 103 | editFindReplace = new QAction( tr( "Find/Replace" ), Resource::loadPixmap("find"), QString::null, 0, this, 0 ); |
109 | editFindReplace->addTo( bar ); | 104 | editFindReplace->addTo( bar ); |
110 | 105 | ||
111 | // Action for undo | 106 | // Action for undo |
112 | editUndo = new QAction( tr( "Undo" ), QPixmap((const char**)edit_undo_xpm), QString::null, 0, this, 0 ); | 107 | editUndo = new QAction( tr( "Undo" ),Resource::loadPixmap( "undo" ) , QString::null, 0, this, 0 ); |
113 | editUndo->addTo( bar ); | 108 | editUndo->addTo( bar ); |
114 | 109 | ||
115 | // Action for redo | 110 | // Action for redo |
116 | editRedo = new QAction( tr( "Redo" ), QPixmap((const char**)edit_redo_xpm), QString::null, 0, this, 0 ); | 111 | editRedo = new QAction( tr( "Redo" ),Resource::loadPixmap( "redo" ) , QString::null, 0, this, 0 ); |
117 | editRedo->addTo( bar ); | 112 | editRedo->addTo( bar ); |
118 | 113 | ||
119 | //VIEW ACITONS | 114 | //VIEW ACITONS |
120 | popup = new QPopupMenu( this ); | 115 | popup = new QPopupMenu( this ); |
121 | 116 | ||
122 | viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); | 117 | viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); |
123 | viewIncFontSizes->addTo( popup ); | 118 | viewIncFontSizes->addTo( popup ); |
124 | 119 | ||
125 | viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); | 120 | viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); |
126 | viewDecFontSizes->addTo( popup ); | 121 | viewDecFontSizes->addTo( popup ); |
127 | 122 | ||
128 | mb->insertItem(tr("View"),popup); | 123 | mb->insertItem(tr("View"),popup); |
129 | 124 | ||
130 | 125 | ||
131 | 126 | ||
132 | popup = new QPopupMenu( this ); | 127 | popup = new QPopupMenu( this ); |
133 | mb->insertItem(tr("Utils"),popup); | 128 | mb->insertItem(tr("Utils"),popup); |
134 | 129 | ||
135 | //Highlight management | 130 | //Highlight management |
136 | hlmenu=new QPopupMenu(this); | 131 | hlmenu=new QPopupMenu(this); |
137 | HlManager *hlm=HlManager::self(); | 132 | HlManager *hlm=HlManager::self(); |
138 | for (int i=0;i<hlm->highlights();i++) | 133 | for (int i=0;i<hlm->highlights();i++) |
139 | { | 134 | { |
140 | hlmenu->insertItem(hlm->hlName(i),i); | 135 | hlmenu->insertItem(hlm->hlName(i),i); |
141 | } | 136 | } |
142 | popup->insertItem(tr("Highlighting"),hlmenu); | 137 | popup->insertItem(tr("Highlighting"),hlmenu); |
143 | 138 | ||
144 | 139 | ||
145 | utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); | 140 | utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); |
146 | utilSettings->addTo( popup); | 141 | utilSettings->addTo( popup); |
147 | 142 | ||
148 | if( qApp->argc() > 1) open(qApp->argv()[1]); | 143 | if( qApp->argc() > 1) open(qApp->argv()[1]); |
149 | else slotNew(); | 144 | else slotNew(); |
150 | 145 | ||
151 | } | 146 | } |
152 | 147 | ||
153 | TinyKate::~TinyKate( ) | 148 | TinyKate::~TinyKate( ) |
154 | { | 149 | { |
155 | qWarning("TinyKate destructor\n"); | 150 | qWarning("TinyKate destructor\n"); |
156 | if( KGlobal::config() != 0 ) { | 151 | if( KGlobal::config() != 0 ) { |
157 | qWarning("deleting KateConfig object..\n"); | 152 | qWarning("deleting KateConfig object..\n"); |
158 | delete KGlobal::config(); | 153 | delete KGlobal::config(); |
159 | } | 154 | } |
160 | } | 155 | } |
161 | 156 | ||
162 | void TinyKate::slotOpen( ) | 157 | void TinyKate::slotOpen( ) |
163 | { | 158 | { |
164 | QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, | 159 | QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, |
165 | QPEApplication::documentDir()); | 160 | QPEApplication::documentDir()); |
166 | if (!filename.isEmpty()) { | 161 | if (!filename.isEmpty()) { |
167 | open(filename); | 162 | open(filename); |
168 | } | 163 | } |
169 | } | 164 | } |
170 | 165 | ||
171 | void TinyKate::open(const QString & filename) | 166 | void TinyKate::open(const QString & filename) |
172 | { | 167 | { |
173 | KateDocument *kd= new KateDocument(false, false, this,0,this); | 168 | KateDocument *kd= new KateDocument(false, false, this,0,this); |
174 | KTextEditor::View *kv; | 169 | KTextEditor::View *kv; |
175 | QFileInfo fi(filename); | 170 | QFileInfo fi(filename); |
176 | QString filenamed = fi.fileName(); | 171 | QString filenamed = fi.fileName(); |
177 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); | 172 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); |
178 | qDebug(filename); | 173 | qDebug(filename); |
179 | 174 | ||
180 | kd->setDocName( filenamed); | 175 | kd->setDocName( filenamed); |
181 | kd->open( filename ); | 176 | kd->open( filename ); |
182 | viewCount++; | 177 | viewCount++; |
183 | } | 178 | } |
184 | 179 | ||
185 | void TinyKate::slotCurrentChanged( QWidget * view) | 180 | void TinyKate::slotCurrentChanged( QWidget * view) |
186 | { | 181 | { |
187 | if (currentView) { | 182 | if (currentView) { |
188 | 183 | ||
189 | disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); | 184 | disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); |
190 | disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); | 185 | disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); |
191 | disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); | 186 | disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); |
192 | disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); | 187 | disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); |
193 | disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); | 188 | disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); |
194 | disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); | 189 | disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); |
195 | disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); | 190 | disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); |
196 | disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); | 191 | disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); |
197 | disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); | 192 | disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); |
198 | } | 193 | } |
199 | 194 | ||
200 | currentView=(KTextEditor::View*)view; | 195 | currentView=(KTextEditor::View*)view; |
201 | 196 | ||
202 | connect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); | 197 | connect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); |
203 | connect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); | 198 | connect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); |
204 | connect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); | 199 | connect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); |
205 | connect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); | 200 | connect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); |
206 | connect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); | 201 | connect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); |
207 | connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); | 202 | connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); |
208 | connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); | 203 | connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); |
209 | connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); | 204 | connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); |
210 | connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); | 205 | connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); |
211 | 206 | ||
212 | } | 207 | } |
213 | 208 | ||
214 | void TinyKate::slotNew( ) | 209 | void TinyKate::slotNew( ) |
215 | { | 210 | { |
216 | KateDocument *kd= new KateDocument(false, false, this,0,this); | 211 | KateDocument *kd= new KateDocument(false, false, this,0,this); |
217 | KTextEditor::View *kv; | 212 | KTextEditor::View *kv; |
218 | tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), | 213 | tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), |
219 | "tinykate/tinykate", | 214 | "tinykate/tinykate", |
220 | tr("Unnamed %1").arg(nextUnnamed++)); | 215 | tr("Unnamed %1").arg(nextUnnamed++)); |
221 | viewCount++; | 216 | viewCount++; |
222 | } | 217 | } |
223 | 218 | ||
224 | void TinyKate::slotClose( ) | 219 | void TinyKate::slotClose( ) |
225 | { | 220 | { |
226 | if (currentView==0) return; | 221 | if (currentView==0) return; |
227 | KTextEditor::View *dv=currentView; | 222 | KTextEditor::View *dv=currentView; |
228 | currentView=0; | 223 | currentView=0; |
229 | tabwidget->removePage(dv); | 224 | tabwidget->removePage(dv); |
230 | delete dv->document(); | 225 | delete dv->document(); |
231 | viewCount--; | 226 | viewCount--; |
232 | if (!viewCount) slotNew(); | 227 | if (!viewCount) slotNew(); |
233 | } | 228 | } |
234 | 229 | ||
235 | void TinyKate::slotSave() { | 230 | void TinyKate::slotSave() { |
236 | // feel free to make this how you want | 231 | // feel free to make this how you want |
237 | if (currentView==0) return; | 232 | if (currentView==0) return; |
238 | 233 | ||
239 | // KateView *kv = (KateView*) currentView; | 234 | // KateView *kv = (KateView*) currentView; |
240 | KateDocument *kd = (KateDocument*) currentView->document(); | 235 | KateDocument *kd = (KateDocument*) currentView->document(); |
241 | // qDebug("saving file "+kd->docName()); | 236 | // qDebug("saving file "+kd->docName()); |
242 | if( kd->docName().isEmpty()) | 237 | if( kd->docName().isEmpty()) |
243 | slotSaveAs(); | 238 | slotSaveAs(); |
244 | else | 239 | else |
245 | kd->saveFile(); | 240 | kd->saveFile(); |
246 | // kv->save(); | 241 | // kv->save(); |
247 | // kd->saveFile(); | 242 | // kd->saveFile(); |
248 | } | 243 | } |
249 | 244 | ||