summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-04-22 19:38:51 (UTC)
committer llornkcor <llornkcor>2003-04-22 19:38:51 (UTC)
commitfc4a2188381ba68060eac61fe18ab34a87742635 (patch) (unidiff)
treedfe37b48935edaa04f6fd0c930e1ae2a2e3872fe
parent6504c09407f6cdf0e131205e0337ba6bc7046182 (diff)
downloadopie-fc4a2188381ba68060eac61fe18ab34a87742635.zip
opie-fc4a2188381ba68060eac61fe18ab34a87742635.tar.gz
opie-fc4a2188381ba68060eac61fe18ab34a87742635.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index eb2bcd8..d0de442 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -1,250 +1,249 @@
1/*************************************************************************** 1/***************************************************************************
2 advancedfmData.cpp 2 advancedfmData.cpp
3 ------------------- 3 -------------------
4** Created: Mon 09-23-2002 13:24:11 4** Created: Mon 09-23-2002 13:24:11
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#include "advancedfm.h" 12#include "advancedfm.h"
13 13
14#include <opie/otabwidget.h> 14#include <opie/otabwidget.h>
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/resource.h> 16#include <qpe/resource.h>
17#include <qpe/menubutton.h> 17#include <qpe/menubutton.h>
18 18
19#include <qlayout.h> 19#include <qlayout.h>
20#include <qhbox.h> 20#include <qhbox.h>
21#include <qmenubar.h> 21#include <qmenubar.h>
22#include <qcombobox.h> 22#include <qcombobox.h>
23#include <qtoolbutton.h> 23#include <qtoolbutton.h>
24#include <qlineedit.h> 24#include <qlineedit.h>
25#include <qlistview.h> 25#include <qlistview.h>
26 26
27#include <sys/utsname.h> 27#include <sys/utsname.h>
28 28
29 29
30void AdvancedFm::init() { 30void AdvancedFm::init() {
31#if defined(QT_QWS_OPIE) 31#if defined(QT_QWS_OPIE)
32 qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); 32 qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!");
33#endif 33#endif
34 setCaption( tr( "AdvancedFm" ) ); 34 setCaption( tr( "AdvancedFm" ) );
35 35
36 QVBoxLayout *layout = new QVBoxLayout( this ); 36 QVBoxLayout *layout = new QVBoxLayout( this );
37 layout->setSpacing( 2); 37 layout->setSpacing( 2);
38 layout->setMargin( 2); 38 layout->setMargin( 2);
39 39
40 40 QMenuBar *menuBar = new QMenuBar(this);
41 QMenuBar *menuBar = new QMenuBar(this);
42 fileMenu = new QPopupMenu( this ); 41 fileMenu = new QPopupMenu( this );
43 viewMenu = new QPopupMenu( this ); 42 viewMenu = new QPopupMenu( this );
44// customDirMenu = new QPopupMenu( this ); 43// customDirMenu = new QPopupMenu( this );
45 44
46 layout->addWidget( menuBar ); 45 layout->addWidget( menuBar );
47 46
48 menuBar->insertItem( tr( "File" ), fileMenu); 47 menuBar->insertItem( tr( "File" ), fileMenu);
49 menuBar->insertItem( tr( "View" ), viewMenu); 48 menuBar->insertItem( tr( "View" ), viewMenu);
50 49
51 cdUpButton = new QToolButton( 0,"cdUpButton"); 50 cdUpButton = new QToolButton( 0,"cdUpButton");
52 cdUpButton->setPixmap(Resource::loadPixmap("up")); 51 cdUpButton->setPixmap(Resource::loadPixmap("up"));
53 cdUpButton->setAutoRaise( true ); 52 cdUpButton->setAutoRaise( true );
54 menuBar->insertItem( cdUpButton ); 53 menuBar->insertItem( cdUpButton );
55 54
56 55
57 QHBox *lineBox = new QHBox( this ); 56 QHBox *lineBox = new QHBox( this );
58 57
59 qpeDirButton= new QToolButton( 0,"QPEButton"); 58 qpeDirButton= new QToolButton( 0,"QPEButton");
60 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); 59 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
61 qpeDirButton->setAutoRaise( true ); 60 qpeDirButton->setAutoRaise( true );
62 menuBar->insertItem( qpeDirButton ); 61 menuBar->insertItem( qpeDirButton );
63 62
64 cfButton = new QToolButton( 0, "CFButton"); 63 cfButton = new QToolButton( 0, "CFButton");
65 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); 64 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
66 cfButton->setAutoRaise( true ); 65 cfButton->setAutoRaise( true );
67 menuBar->insertItem( cfButton ); 66 menuBar->insertItem( cfButton );
68 67
69 sdButton = new QToolButton( 0, "SDButton"); 68 sdButton = new QToolButton( 0, "SDButton");
70 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); 69 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard"));
71 sdButton->setAutoRaise( true ); 70 sdButton->setAutoRaise( true );
72 menuBar->insertItem( sdButton ); 71 menuBar->insertItem( sdButton );
73 72
74 docButton = new QToolButton( 0,"docsButton"); 73 docButton = new QToolButton( 0,"docsButton");
75 docButton->setPixmap(Resource::loadPixmap("DocsIcon")); 74 docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
76 docButton->setAutoRaise( true ); 75 docButton->setAutoRaise( true );
77 menuBar->insertItem( docButton ); 76 menuBar->insertItem( docButton );
78 77
79 homeButton = new QToolButton( 0, "homeButton"); 78 homeButton = new QToolButton( 0, "homeButton");
80 homeButton->setPixmap(Resource::loadPixmap("home")); 79 homeButton->setPixmap(Resource::loadPixmap("home"));
81 homeButton->setAutoRaise( true ); 80 homeButton->setAutoRaise( true );
82 menuBar->insertItem( homeButton ); 81 menuBar->insertItem( homeButton );
83 82
84 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); 83 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
85 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 84 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
86 fileMenu->insertSeparator(); 85 fileMenu->insertSeparator();
87 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 86 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
88 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 87 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
89 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 88 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
90 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 89 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
91 fileMenu->insertSeparator(); 90 fileMenu->insertSeparator();
92 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 91 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
93 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); 92 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() ));
94 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); 93 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
95 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 94 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
96 fileMenu->setCheckable(TRUE); 95 fileMenu->setCheckable(TRUE);
97 96
98 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 97 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
99 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 98 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
100// viewMenu->insertSeparator(); 99// viewMenu->insertSeparator();
101// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 100// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
102 viewMenu->setCheckable(TRUE); 101 viewMenu->setCheckable(TRUE);
103 102
104 s_addBookmark = tr("Bookmark Directory"); 103 s_addBookmark = tr("Bookmark Directory");
105 s_removeBookmark = tr("Remove Current Directory from Bookmarks"); 104 s_removeBookmark = tr("Remove Current Directory from Bookmarks");
106 105
107// menuButton->insertItem(""); 106// menuButton->insertItem("");
108 107
109// customDirMenu->insertItem(tr("Add This Directory")); 108// customDirMenu->insertItem(tr("Add This Directory"));
110// customDirMenu->insertItem(tr("Remove This Directory")); 109// customDirMenu->insertItem(tr("Remove This Directory"));
111// customDirMenu->insertSeparator(); 110// customDirMenu->insertSeparator();
112 111
113 customDirsToMenu();
114
115 menuButton = new MenuButton( lineBox ); 112 menuButton = new MenuButton( lineBox );
116 113
117 menuButton->setUseLabel(false); 114 menuButton->setUseLabel(false);
118 menuButton->setMaximumWidth( 20 ); 115 menuButton->setMaximumWidth( 20 );
119 menuButton->insertItem( s_addBookmark); 116 menuButton->insertItem( s_addBookmark);
120 menuButton->insertItem( s_removeBookmark); 117 menuButton->insertItem( s_removeBookmark);
121 menuButton->insertSeparator(); 118 menuButton->insertSeparator();
122 119
120 customDirsToMenu();
121
123 currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" ); 122 currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" );
124 currentPathCombo->setEditable(TRUE); 123 currentPathCombo->setEditable(TRUE);
125 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 124 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
126 125
127 layout->addWidget( lineBox ); 126 layout->addWidget( lineBox );
128 127
129 128
130 TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); 129 TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab);
131// TabWidget = new QTabWidget( this, "TabWidget" ); 130// TabWidget = new QTabWidget( this, "TabWidget" );
132 layout->addWidget( TabWidget, 4 ); 131 layout->addWidget( TabWidget, 4 );
133 132
134 tab = new QWidget( TabWidget, "tab" ); 133 tab = new QWidget( TabWidget, "tab" );
135 tabLayout = new QGridLayout( tab ); 134 tabLayout = new QGridLayout( tab );
136 tabLayout->setSpacing( 2); 135 tabLayout->setSpacing( 2);
137 tabLayout->setMargin( 2); 136 tabLayout->setMargin( 2);
138 137
139 Local_View = new QListView( tab, "Local_View" ); 138 Local_View = new QListView( tab, "Local_View" );
140 Local_View->addColumn( tr("File"),130); 139 Local_View->addColumn( tr("File"),130);
141 Local_View->addColumn( tr("Size"),-1); 140 Local_View->addColumn( tr("Size"),-1);
142 Local_View->setColumnAlignment(1,QListView::AlignRight); 141 Local_View->setColumnAlignment(1,QListView::AlignRight);
143 Local_View->addColumn( tr("Date"),-1); 142 Local_View->addColumn( tr("Date"),-1);
144 Local_View->setColumnAlignment(2,QListView::AlignRight); 143 Local_View->setColumnAlignment(2,QListView::AlignRight);
145 Local_View->setAllColumnsShowFocus(TRUE); 144 Local_View->setAllColumnsShowFocus(TRUE);
146 Local_View->setMultiSelection( TRUE ); 145 Local_View->setMultiSelection( TRUE );
147 Local_View->setSelectionMode(QListView::Extended); 146 Local_View->setSelectionMode(QListView::Extended);
148 147
149 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 148 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
150 149
151 tabLayout->addWidget( Local_View, 0, 0 ); 150 tabLayout->addWidget( Local_View, 0, 0 );
152 151
153 TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1")); 152 TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1"));
154// TabWidget->insertTab( tab, tr("1")); 153// TabWidget->insertTab( tab, tr("1"));
155 154
156 tab_2 = new QWidget( TabWidget, "tab_2" ); 155 tab_2 = new QWidget( TabWidget, "tab_2" );
157 tabLayout_2 = new QGridLayout( tab_2 ); 156 tabLayout_2 = new QGridLayout( tab_2 );
158 tabLayout_2->setSpacing( 2); 157 tabLayout_2->setSpacing( 2);
159 tabLayout_2->setMargin( 2); 158 tabLayout_2->setMargin( 2);
160 159
161 Remote_View = new QListView( tab_2, "Remote_View" ); 160 Remote_View = new QListView( tab_2, "Remote_View" );
162 Remote_View->addColumn( tr("File"),130); 161 Remote_View->addColumn( tr("File"),130);
163 Remote_View->addColumn( tr("Size"),-1); 162 Remote_View->addColumn( tr("Size"),-1);
164 Remote_View->setColumnAlignment(1,QListView::AlignRight); 163 Remote_View->setColumnAlignment(1,QListView::AlignRight);
165 Remote_View->addColumn( tr("Date"),-1); 164 Remote_View->addColumn( tr("Date"),-1);
166 Remote_View->setColumnAlignment(2,QListView::AlignRight); 165 Remote_View->setColumnAlignment(2,QListView::AlignRight);
167 Remote_View->setAllColumnsShowFocus(TRUE); 166 Remote_View->setAllColumnsShowFocus(TRUE);
168 Remote_View->setMultiSelection( TRUE ); 167 Remote_View->setMultiSelection( TRUE );
169 Remote_View->setSelectionMode(QListView::Extended); 168 Remote_View->setSelectionMode(QListView::Extended);
170 169
171 170
172 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 171 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
173 172
174 tabLayout_2->addWidget( Remote_View, 0, 0 ); 173 tabLayout_2->addWidget( Remote_View, 0, 0 );
175 174
176 TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); 175 TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2"));
177// TabWidget->insertTab( tab_2, tr( "2")); 176// TabWidget->insertTab( tab_2, tr( "2"));
178 177
179 /* tab_3 = new QWidget( TabWidget, "tab_3" ); 178 /* tab_3 = new QWidget( TabWidget, "tab_3" );
180 tabLayout_3 = new QGridLayout( tab_3 ); 179 tabLayout_3 = new QGridLayout( tab_3 );
181 tabLayout_3->setSpacing( 2); 180 tabLayout_3->setSpacing( 2);
182 tabLayout_3->setMargin( 2); 181 tabLayout_3->setMargin( 2);
183 182
184 183
185 // OFileDialog fileDialog; 184 // OFileDialog fileDialog;
186 // fileDialog; 185 // fileDialog;
187 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy 186 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
188 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); 187 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
189 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); 188 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");
190 189
191 QListView *fileTree; 190 QListView *fileTree;
192 fileTree = new QListView( tab_3, "tree" ); 191 fileTree = new QListView( tab_3, "tree" );
193 192
194 193
195 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); 194 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
196 195
197 TabWidget->insertTab( tab_3, tr( "Remote" ) ); 196 TabWidget->insertTab( tab_3, tr( "Remote" ) );
198 */ 197 */
199 198
200 /////////////// 199 ///////////////
201 200
202 struct utsname name; /* check for embedix kernel running on the zaurus*/ 201 struct utsname name; /* check for embedix kernel running on the zaurus*/
203 if (uname(&name) != -1) { 202 if (uname(&name) != -1) {
204 QString release=name.release; 203 QString release=name.release;
205 if(release.find("embedix",0,TRUE) !=-1) { 204 if(release.find("embedix",0,TRUE) !=-1) {
206 zaurusDevice=TRUE; 205 zaurusDevice=TRUE;
207 } else { 206 } else {
208 zaurusDevice=FALSE; 207 zaurusDevice=FALSE;
209 sdButton->hide(); 208 sdButton->hide();
210 } 209 }
211 } 210 }
212 211
213 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 212 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
214 currentDir.setPath( QDir::currentDirPath()); 213 currentDir.setPath( QDir::currentDirPath());
215 214
216 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 215 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
217 currentRemoteDir.setPath( QDir::currentDirPath()); 216 currentRemoteDir.setPath( QDir::currentDirPath());
218 217
219 b = TRUE; 218 b = TRUE;
220 219
221 filterStr="*"; 220 filterStr="*";
222 b=FALSE; 221 b=FALSE;
223 TabWidget->setCurrentTab(0); 222 TabWidget->setCurrentTab(0);
224 223
225} 224}
226 225
227void AdvancedFm::initConnections() 226void AdvancedFm::initConnections()
228{ 227{
229 228
230 connect( qApp,SIGNAL( aboutToQuit()), 229 connect( qApp,SIGNAL( aboutToQuit()),
231 this, SLOT( cleanUp()) ); 230 this, SLOT( cleanUp()) );
232 connect( qpeDirButton ,SIGNAL(released()), 231 connect( qpeDirButton ,SIGNAL(released()),
233 this,SLOT( QPEButtonPushed()) ); 232 this,SLOT( QPEButtonPushed()) );
234 connect( cfButton ,SIGNAL(released()), 233 connect( cfButton ,SIGNAL(released()),
235 this,SLOT( CFButtonPushed()) ); 234 this,SLOT( CFButtonPushed()) );
236 connect( sdButton ,SIGNAL(released()), 235 connect( sdButton ,SIGNAL(released()),
237 this,SLOT( SDButtonPushed()) ); 236 this,SLOT( SDButtonPushed()) );
238 connect( cdUpButton ,SIGNAL(released()), 237 connect( cdUpButton ,SIGNAL(released()),
239 this,SLOT( upDir()) ); 238 this,SLOT( upDir()) );
240 connect( docButton,SIGNAL(released()), 239 connect( docButton,SIGNAL(released()),
241 this,SLOT( docButtonPushed()) ); 240 this,SLOT( docButtonPushed()) );
242 connect( homeButton,SIGNAL(released()), 241 connect( homeButton,SIGNAL(released()),
243 this,SLOT( homeButtonPushed()) ); 242 this,SLOT( homeButtonPushed()) );
244 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 243 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
245 this, SLOT( currentPathComboActivated( const QString & ) ) ); 244 this, SLOT( currentPathComboActivated( const QString & ) ) );
246 245
247 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 246 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
248 this,SLOT(currentPathComboChanged())); 247 this,SLOT(currentPathComboChanged()));
249 248
250 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 249 connect( Local_View, SIGNAL( clicked( QListViewItem*)),