summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tableviewer/tableviewer.cpp67
-rw-r--r--noncore/comm/keypebble/kvnc.cpp18
2 files changed, 40 insertions, 45 deletions
diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp
index 9538cb3..8668368 100644
--- a/noncore/apps/tableviewer/tableviewer.cpp
+++ b/noncore/apps/tableviewer/tableviewer.cpp
@@ -1,171 +1,164 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "tableviewer.h" 21#include "tableviewer.h"
22#include "ui/tvbrowseview.h" 22#include "ui/tvbrowseview.h"
23#include "ui/tvfilterview.h" 23#include "ui/tvfilterview.h"
24#include "ui/tvlistview.h" 24#include "ui/tvlistview.h"
25#include "ui/tveditview.h" 25#include "ui/tveditview.h"
26#include "ui/tvkeyedit.h" 26#include "ui/tvkeyedit.h"
27#include "db/datacache.h" 27#include "db/datacache.h"
28 28
29/* OPIE */ 29/* OPIE */
30#include <opie2/odebug.h> 30#include <opie2/odebug.h>
31#include <opie2/oresource.h>
31#include <qpe/fileselector.h> 32#include <qpe/fileselector.h>
32#include <qpe/resource.h>
33using namespace Opie::Core; 33using namespace Opie::Core;
34 34
35/* QT */ 35/* QT */
36#include <qmenubar.h> 36#include <qmenubar.h>
37#include <qtoolbar.h> 37#include <qtoolbar.h>
38#include <qpopupmenu.h> 38#include <qpopupmenu.h>
39#include <qapplication.h> 39#include <qapplication.h>
40#include <qwidgetstack.h> 40#include <qwidgetstack.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qbuffer.h> 42#include <qbuffer.h>
43 43
44/*! 44/*!
45 \class TableViewerWindow 45 \class TableViewerWindow
46 \brief The main window widget of the application 46 \brief The main window widget of the application
47 47
48 This is the main widget of the table viewer application. 48 This is the main widget of the table viewer application.
49 It is the co-ordination point. 49 It is the co-ordination point.
50*/ 50*/
51 51
52/*! 52/*!
53 Constructs a new TableViewerWindow 53 Constructs a new TableViewerWindow
54*/ 54*/
55TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f) 55TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f)
56 : QMainWindow(parent, name, f) 56 : QMainWindow(parent, name, f)
57{ 57{
58 setCaption(tr("Table Viewer")); 58 setCaption(tr("Table Viewer"));
59 59
60/* Build data */ 60/* Build data */
61 ds = new DBStore(); 61 ds = new DBStore();
62 doc.setType("text/x-xml-tableviewer"); 62 doc.setType("text/x-xml-tableviewer");
63 doc.setName("table"); 63 doc.setName("table");
64 64
65 dirty = FALSE; 65 dirty = FALSE;
66 ts.current_column = 0; 66 ts.current_column = 0;
67 ts.kRep = ds->getKeys(); 67 ts.kRep = ds->getKeys();
68 68
69/* build menus */ 69/* build menus */
70 menu = new QMenuBar(this, 0); 70 menu = new QMenuBar(this, 0);
71 71
72 QPopupMenu *file_menu = new QPopupMenu; 72 QPopupMenu *file_menu = new QPopupMenu;
73 file_menu->insertItem("New", this, SLOT(newDocument())); 73 file_menu->insertItem("New", this, SLOT(newDocument()));
74 74
75 file_menu->insertItem("Open", this, SLOT(selectDocument())); 75 file_menu->insertItem("Open", this, SLOT(selectDocument()));
76 file_menu->insertSeparator(); 76 file_menu->insertSeparator();
77 file_menu->insertItem("Properties"); 77 file_menu->insertItem("Properties");
78 78
79 /* later will want to set this up to clean up first via this, SLOT(quit) */ 79 /* later will want to set this up to clean up first via this, SLOT(quit) */
80 menu->insertItem("Document", file_menu); 80 menu->insertItem("Document", file_menu);
81 81
82 QPopupMenu *edit_menu = new QPopupMenu; 82 QPopupMenu *edit_menu = new QPopupMenu;
83 edit_menu->insertItem("Edit Item", this, SLOT(editItemSlot())); 83 edit_menu->insertItem("Edit Item", this, SLOT(editItemSlot()));
84 edit_menu->insertItem("Edit Keys", this, SLOT(editKeysSlot())); 84 edit_menu->insertItem("Edit Keys", this, SLOT(editKeysSlot()));
85 edit_menu->insertItem("Edit filters", this, SLOT(filterViewSlot())); 85 edit_menu->insertItem("Edit filters", this, SLOT(filterViewSlot()));
86 menu->insertItem("Edit", edit_menu); 86 menu->insertItem("Edit", edit_menu);
87 87
88 QPopupMenu *view_menu = new QPopupMenu; 88 QPopupMenu *view_menu = new QPopupMenu;
89 view_menu->insertItem("Browse View", this, SLOT(browseViewSlot())); 89 view_menu->insertItem("Browse View", this, SLOT(browseViewSlot()));
90 view_menu->insertItem("List View", this, SLOT(listViewSlot())); 90 view_menu->insertItem("List View", this, SLOT(listViewSlot()));
91 menu->insertItem("View", view_menu); 91 menu->insertItem("View", view_menu);
92 92
93 QVBoxLayout *main_layout = new QVBoxLayout; 93 QVBoxLayout *main_layout = new QVBoxLayout;
94 94
95 /* Build tool bar */ 95 /* Build tool bar */
96 bool useBigIcon = qApp->desktop()->size().width() > 330;
97
96 navigation = new QToolBar(this, "navigation"); 98 navigation = new QToolBar(this, "navigation");
97 QToolButton *newItemButton = new QToolButton( 99 QToolButton *btn = new QToolButton( Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon),
98 QIconSet(Resource::loadPixmap("new")), "New Item", QString::null, 100 "New Item", QString::null, this, SLOT(newItemSlot()), navigation, "New Item");
99 this, SLOT(newItemSlot()), navigation, "New Item"); 101 btn->setUsesBigPixmap( useBigIcon );
100 QToolButton *editItemButton = new QToolButton( 102 btn = new QToolButton( Opie::Core::OResource::loadPixmap("edit", Opie::Core::OResource::SmallIcon),
101 QIconSet(Resource::loadPixmap("edit")), "Edit Item", QString::null, 103 "Edit Item", QString::null, this, SLOT(editItemSlot()), navigation, "Edit Item");
102 this, SLOT(editItemSlot()), navigation, "Edit Item"); 104 btn->setUsesBigPixmap( useBigIcon );
103 QToolButton *deleteItemButton = new QToolButton( 105 btn = new QToolButton( Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon),
104 QIconSet(Resource::loadPixmap("trash")), "Delete Item", 106 "Delete Item", QString::null, this, SLOT(deleteItemSlot()), navigation, "Delete Item");
105 QString::null, this, 107 btn->setUsesBigPixmap( useBigIcon );
106 SLOT(deleteItemSlot()), navigation, "Delete Item");
107 108
108 navigation->addSeparator(); 109 navigation->addSeparator();
109 110
110 QToolButton *firstItemButton = new QToolButton( 111 btn = new QToolButton( Opie::Core::OResource::loadPixmap("fastback", Opie::Core::OResource::SmallIcon),
111 QIconSet(Resource::loadPixmap("fastback")), "First Item", 112 "First Item", QString::null, this, SLOT(firstItem()), navigation, "First Item");
112 QString::null, this, 113 btn->setUsesBigPixmap( useBigIcon );
113 SLOT(firstItem()), navigation, "First Item"); 114 btn = new QToolButton( Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon),
114 QToolButton *previousItemButton = new QToolButton( 115 "Previous Item", QString::null, this, SLOT(previousItem()), navigation, "Previous Item");
115 QIconSet(Resource::loadPixmap("back")), "Previous Item", 116 btn->setUsesBigPixmap( useBigIcon );
116 QString::null, this, 117 btn = new QToolButton( Opie::Core::OResource::loadPixmap("forward", Opie::Core::OResource::SmallIcon),
117 SLOT(previousItem()), navigation, "Previous Item"); 118 "Next Item", QString::null, this, SLOT(nextItem()), navigation, "Next Item");
118 QToolButton *nextItemButton = new QToolButton( 119 btn->setUsesBigPixmap( useBigIcon );
119 QIconSet(Resource::loadPixmap("forward")), "Next Item", 120 btn = new QToolButton( Opie::Core::OResource::loadPixmap("fastforward", Opie::Core::OResource::SmallIcon),
120 QString::null, this, 121 "Last Item", QString::null, this, SLOT(lastItem()), navigation, "Last Item");
121 SLOT(nextItem()), navigation, "Next Item"); 122 btn->setUsesBigPixmap( useBigIcon );
122 QToolButton *lastItemButton = new QToolButton(
123 QIconSet(Resource::loadPixmap("fastforward")), "Last Item",
124 QString::null, this,
125 SLOT(lastItem()), navigation, "Last Item");
126 123
127 navigation->addSeparator(); 124 navigation->addSeparator();
128 QToolButton *browseButton = new QToolButton( 125 btn = new QToolButton( Opie::Core::OResource::loadPixmap("day", Opie::Core::OResource::SmallIcon),
129 QIconSet(Resource::loadPixmap("day")), "View Single Item", 126 "View Single Item", QString::null, this, SLOT(browseViewSlot()), navigation, "View Single Item");
130 QString::null, this, 127 btn->setUsesBigPixmap( useBigIcon );
131 SLOT(browseViewSlot()), navigation, "View Single Item"); 128 btn = new QToolButton( Opie::Core::OResource::loadPixmap("month", Opie::Core::OResource::SmallIcon),
132 QToolButton *listButton = new QToolButton( 129 "View Multiple Items", QString::null, this, SLOT(listViewSlot()), navigation, "View Multiple Items");
133 QIconSet(Resource::loadPixmap("month")), "View Multiple Items", 130 btn->setUsesBigPixmap( useBigIcon );
134 QString::null, this,
135 SLOT(listViewSlot()), navigation, "View Multiple Items");
136 131
137 setToolBarsMovable(FALSE); 132 setToolBarsMovable(FALSE);
138 setToolBarsMovable(FALSE);
139 setToolBarsMovable(FALSE);
140 133
141/* Build widgets */ 134/* Build widgets */
142 browseView = new TVBrowseView(&ts, this, 0); 135 browseView = new TVBrowseView(&ts, this, 0);
143 listView = new TVListView(&ts, this, 0); 136 listView = new TVListView(&ts, this, 0);
144 filterView = new TVFilterView(&ts, this, 0); 137 filterView = new TVFilterView(&ts, this, 0);
145 fileSelector = new FileSelector("text/csv;text/x-xml-tableviewer", 138 fileSelector = new FileSelector("text/csv;text/x-xml-tableviewer",
146 this, "fileselector"); 139 this, "fileselector");
147 fileSelector->setNewVisible(FALSE); 140 fileSelector->setNewVisible(FALSE);
148 fileSelector->setCloseVisible(FALSE); 141 fileSelector->setCloseVisible(FALSE);
149 142
150 cw = new QWidgetStack(this, 0); 143 cw = new QWidgetStack(this, 0);
151 cw->addWidget(listView, ListState); 144 cw->addWidget(listView, ListState);
152 cw->addWidget(browseView, BrowseState); 145 cw->addWidget(browseView, BrowseState);
153 cw->addWidget(filterView, FilterState); 146 cw->addWidget(filterView, FilterState);
154 cw->addWidget(fileSelector, FileState); 147 cw->addWidget(fileSelector, FileState);
155 148
156 current_view = FileState; 149 current_view = FileState;
157 cw->raiseWidget(current_view); 150 cw->raiseWidget(current_view);
158 fileSelector->reread(); 151 fileSelector->reread();
159 152
160 connect(browseView, SIGNAL(searchOnKey(int,TVVariant)), 153 connect(browseView, SIGNAL(searchOnKey(int,TVVariant)),
161 this, SLOT(searchOnKey(int,TVVariant))); 154 this, SLOT(searchOnKey(int,TVVariant)));
162 connect(browseView, SIGNAL(sortChanged(int)), 155 connect(browseView, SIGNAL(sortChanged(int)),
163 this, SLOT(setPrimaryKey(int))); 156 this, SLOT(setPrimaryKey(int)));
164 157
165 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(browseViewSlot())); 158 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(browseViewSlot()));
166 connect(fileSelector, SIGNAL(fileSelected(const DocLnk&)), 159 connect(fileSelector, SIGNAL(fileSelected(const DocLnk&)),
167 this, SLOT(openDocument(const DocLnk&))); 160 this, SLOT(openDocument(const DocLnk&)));
168 161
169 main_layout->addWidget(menu); 162 main_layout->addWidget(menu);
170 main_layout->addWidget(cw); 163 main_layout->addWidget(cw);
171 164
diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp
index 3a8e919..c089551 100644
--- a/noncore/comm/keypebble/kvnc.cpp
+++ b/noncore/comm/keypebble/kvnc.cpp
@@ -1,39 +1,41 @@
1#include <opie2/oresource.h>
2
3#include <qpe/qpeapplication.h>
4
1#include <qaction.h> 5#include <qaction.h>
2#include <qpopupmenu.h> 6#include <qpopupmenu.h>
3#include <qpushbutton.h> 7#include <qpushbutton.h>
4#include <qmessagebox.h> 8#include <qmessagebox.h>
5#include <qlistbox.h> 9#include <qlistbox.h>
6#include <qpe/qpeapplication.h>
7#include <qpe/resource.h>
8 10
9#include <assert.h> 11#include <assert.h>
10 12
11#include "kvnc.h" 13#include "kvnc.h"
12#include "krfbcanvas.h" 14#include "krfbcanvas.h"
13#include "krfbconnection.h" 15#include "krfbconnection.h"
14#include "kvncconndlg.h" 16#include "kvncconndlg.h"
15 17
16static int u_id = 1; 18static int u_id = 1;
17static int get_unique_id() 19static int get_unique_id()
18{ 20{
19 return u_id++; 21 return u_id++;
20} 22}
21 23
22 24
23/* XPM */ 25/* XPM */
24static char * menu_xpm[] = { 26static char * menu_xpm[] = {
25"12 12 5 1", 27"12 12 5 1",
26 " c None", 28 " c None",
27 ".c #000000", 29 ".c #000000",
28 "+c #FFFDAD", 30 "+c #FFFDAD",
29 "@c #FFFF00", 31 "@c #FFFF00",
30 "#c #E5E100", 32 "#c #E5E100",
31" ", 33" ",
32" ", 34" ",
33" ......... ", 35" ......... ",
34" .+++++++. ", 36" .+++++++. ",
35" .+@@@@#. ", 37" .+@@@@#. ",
36" .+@@@#. ", 38" .+@@@#. ",
37" .+@@#. ", 39" .+@@#. ",
38" .+@#. ", 40" .+@#. ",
39" .+#. ", 41" .+#. ",
@@ -56,78 +58,78 @@ KVNC::KVNC( QWidget *parent, const char *name, WFlags ) : QMainWindow( parent,
56 stack->raiseWidget( bookmarkSelector ); 58 stack->raiseWidget( bookmarkSelector );
57 59
58 canvas = new KRFBCanvas( stack, "canvas" ); 60 canvas = new KRFBCanvas( stack, "canvas" );
59 stack->addWidget(canvas,get_unique_id()); 61 stack->addWidget(canvas,get_unique_id());
60 setCentralWidget( stack ); 62 setCentralWidget( stack );
61 63
62 64
63 connect( bookmarkSelector->bookmarkList, SIGNAL(clicked(QListBoxItem*)), 65 connect( bookmarkSelector->bookmarkList, SIGNAL(clicked(QListBoxItem*)),
64 this, SLOT(openConnection(QListBoxItem*)) ); 66 this, SLOT(openConnection(QListBoxItem*)) );
65 connect( canvas->connection(), SIGNAL(statusChanged(const QString&)), 67 connect( canvas->connection(), SIGNAL(statusChanged(const QString&)),
66 this, SLOT(statusMessage(const QString&)) ); 68 this, SLOT(statusMessage(const QString&)) );
67 connect( canvas->connection(), SIGNAL(error(const QString&)), 69 connect( canvas->connection(), SIGNAL(error(const QString&)),
68 this, SLOT(error(const QString&)) ); 70 this, SLOT(error(const QString&)) );
69 connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) ); 71 connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) );
70 connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) ); 72 connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) );
71 connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) ); 73 connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) );
72 74
73 setupActions(); 75 setupActions();
74 76
75 cornerButton = new QPushButton( this ); 77 cornerButton = new QPushButton( this );
76 cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); 78 cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) );
77 connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) ); 79 connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) );
78 canvas->setCornerWidget( cornerButton ); 80 canvas->setCornerWidget( cornerButton );
79 81
80 stack->raiseWidget( bookmarkSelector ); 82 stack->raiseWidget( bookmarkSelector );
81 83
82 84
83 bar= new QToolBar( this ); 85 bar= new QToolBar( this );
84 setToolBarsMovable( false ); 86 setToolBarsMovable( false );
85 setRightJustification(false); 87 setRightJustification(false);
86 88
87 89
88 QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ), 90 QAction *n = new QAction( tr( "New Connection" ), Opie::Core::OResource::loadPixmap( "new",
89 QString::null, 0, this, 0 ); 91 Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
90 connect( n, SIGNAL( activated() ), 92 connect( n, SIGNAL( activated() ),
91 this, SLOT( newConnection() ) ); 93 this, SLOT( newConnection() ) );
92 n->addTo( bar ); 94 n->addTo( bar );
93 95
94 QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "fileopen" ), 96 QAction *o = new QAction( tr( "Open Bookmark" ), Opie::Core::OResource::loadPixmap( "fileopen",
95 QString::null, 0, this, 0 ); 97 Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
96 connect( o, SIGNAL( activated() ), 98 connect( o, SIGNAL( activated() ),
97 this, SLOT( openConnection() ) ); 99 this, SLOT( openConnection() ) );
98 o->addTo( bar ); 100 o->addTo( bar );
99 101
100 QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ), 102 QAction *d = new QAction( tr( "Delete Bookmark" ), Opie::Core::OResource::loadPixmap( "trash",
101 QString::null, 0, this, 0 ); 103 Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
102 connect( d, SIGNAL( activated() ), 104 connect( d, SIGNAL( activated() ),
103 this, SLOT( deleteBookmark() ) ); 105 this, SLOT( deleteBookmark() ) );
104 d->addTo( bar ); 106 d->addTo( bar );
105} 107}
106 108
107KVNC::~KVNC() 109KVNC::~KVNC()
108{ 110{
109 111
110} 112}
111 113
112void KVNC::newConnection() 114void KVNC::newConnection()
113{ 115{
114 curServer=new KRFBServer; 116 curServer=new KRFBServer;
115 117
116 KVNCConnDlg dlg( curServer,this); 118 KVNCConnDlg dlg( curServer,this);
117 if ( QPEApplication::execDialog( &dlg )) { 119 if ( QPEApplication::execDialog( &dlg )) {
118 if (!curServer->name.isEmpty()) 120 if (!curServer->name.isEmpty())
119 bookmarkSelector->addBookmark(curServer); 121 bookmarkSelector->addBookmark(curServer);
120 canvas->openConnection(*curServer); 122 canvas->openConnection(*curServer);
121 } else 123 } else
122 curServer=0; 124 curServer=0;
123} 125}
124 126
125void KVNC::openConnection( QString name) 127void KVNC::openConnection( QString name)
126{ 128{
127 curServer=bookmarkSelector->getServer(name); 129 curServer=bookmarkSelector->getServer(name);
128 130
129 if (curServer) { 131 if (curServer) {
130 KVNCConnDlg dlg( curServer,this); 132 KVNCConnDlg dlg( curServer,this);
131 if ( QPEApplication::execDialog( &dlg ) ) { 133 if ( QPEApplication::execDialog( &dlg ) ) {
132 canvas->openConnection(*curServer); 134 canvas->openConnection(*curServer);
133 bookmarkSelector->writeBookmarks(); 135 bookmarkSelector->writeBookmarks();