-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 16 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 73ef8f9..ce7da24 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -1,287 +1,293 @@ | |||
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 <qpe/storage.h> | 14 | #include <qpe/storage.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 | ||
30 | using namespace Opie::Ui; | 30 | using namespace Opie::Ui; |
31 | void AdvancedFm::init() { | 31 | void AdvancedFm::init() { |
32 | #if defined(QT_QWS_OPIE) | 32 | #if defined(QT_QWS_OPIE) |
33 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); | 33 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); |
34 | #endif | 34 | #endif |
35 | setCaption( tr( "AdvancedFm" ) ); | 35 | setCaption( tr( "AdvancedFm" ) ); |
36 | 36 | ||
37 | QVBoxLayout *layout = new QVBoxLayout( this ); | 37 | QVBoxLayout *layout = new QVBoxLayout( this ); |
38 | layout->setSpacing( 2); | 38 | layout->setSpacing( 2); |
39 | layout->setMargin( 2); | 39 | layout->setMargin( 0); // squeeze |
40 | 40 | ||
41 | QMenuBar *menuBar = new QMenuBar(this); | 41 | QMenuBar *menuBar = new QMenuBar(this); |
42 | menuBar->setMargin( 0 ); // squeeze | ||
42 | fileMenu = new QPopupMenu( this ); | 43 | fileMenu = new QPopupMenu( this ); |
43 | viewMenu = new QPopupMenu( this ); | 44 | viewMenu = new QPopupMenu( this ); |
44 | // customDirMenu = new QPopupMenu( this ); | 45 | // customDirMenu = new QPopupMenu( this ); |
45 | 46 | ||
46 | layout->addWidget( menuBar ); | 47 | layout->addWidget( menuBar ); |
47 | 48 | ||
48 | menuBar->insertItem( tr( "File" ), fileMenu); | 49 | menuBar->insertItem( tr( "File" ), fileMenu); |
49 | menuBar->insertItem( tr( "View" ), viewMenu); | 50 | menuBar->insertItem( tr( "View" ), viewMenu); |
50 | 51 | ||
51 | cdUpButton = new QToolButton( 0,"cdUpButton"); | 52 | cdUpButton = new QToolButton( 0,"cdUpButton"); |
52 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 53 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
53 | cdUpButton->setAutoRaise( true ); | 54 | cdUpButton->setAutoRaise( true ); |
54 | menuBar->insertItem( cdUpButton ); | 55 | menuBar->insertItem( cdUpButton ); |
55 | 56 | ||
56 | 57 | ||
57 | QHBox *lineBox = new QHBox( this ); | ||
58 | 58 | ||
59 | qpeDirButton= new QToolButton( 0,"QPEButton"); | 59 | qpeDirButton= new QToolButton( 0,"QPEButton"); |
60 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 60 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
61 | qpeDirButton->setAutoRaise( true ); | 61 | qpeDirButton->setAutoRaise( true ); |
62 | menuBar->insertItem( qpeDirButton ); | 62 | menuBar->insertItem( qpeDirButton ); |
63 | 63 | ||
64 | cfButton = new QToolButton( 0, "CFButton"); | 64 | cfButton = new QToolButton( 0, "CFButton"); |
65 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 65 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
66 | cfButton->setAutoRaise( true ); | 66 | cfButton->setAutoRaise( true ); |
67 | menuBar->insertItem( cfButton ); | 67 | menuBar->insertItem( cfButton ); |
68 | 68 | ||
69 | sdButton = new QToolButton( 0, "SDButton"); | 69 | sdButton = new QToolButton( 0, "SDButton"); |
70 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); | 70 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); |
71 | sdButton->setAutoRaise( true ); | 71 | sdButton->setAutoRaise( true ); |
72 | menuBar->insertItem( sdButton ); | 72 | menuBar->insertItem( sdButton ); |
73 | 73 | ||
74 | docButton = new QToolButton( 0,"docsButton"); | 74 | docButton = new QToolButton( 0,"docsButton"); |
75 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 75 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
76 | docButton->setAutoRaise( true ); | 76 | docButton->setAutoRaise( true ); |
77 | menuBar->insertItem( docButton ); | 77 | menuBar->insertItem( docButton ); |
78 | 78 | ||
79 | homeButton = new QToolButton( 0, "homeButton"); | 79 | homeButton = new QToolButton( 0, "homeButton"); |
80 | homeButton->setPixmap(Resource::loadPixmap("home")); | 80 | homeButton->setPixmap(Resource::loadPixmap("home")); |
81 | homeButton->setAutoRaise( true ); | 81 | homeButton->setAutoRaise( true ); |
82 | menuBar->insertItem( homeButton ); | 82 | menuBar->insertItem( homeButton ); |
83 | 83 | ||
84 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 84 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); |
85 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 85 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
86 | fileMenu->insertSeparator(); | 86 | fileMenu->insertSeparator(); |
87 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); | 87 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); |
88 | fileMenu->insertSeparator(); | 88 | fileMenu->insertSeparator(); |
89 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 89 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
90 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 90 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
91 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 91 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
92 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 92 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
93 | fileMenu->insertSeparator(); | 93 | fileMenu->insertSeparator(); |
94 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 94 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
95 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); | 95 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); |
96 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 96 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
97 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 97 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
98 | fileMenu->setCheckable(TRUE); | 98 | fileMenu->setCheckable(TRUE); |
99 | 99 | ||
100 | viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); | 100 | viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); |
101 | viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); | 101 | viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); |
102 | // viewMenu->insertSeparator(); | 102 | // viewMenu->insertSeparator(); |
103 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 103 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
104 | viewMenu->setCheckable(true); | 104 | viewMenu->setCheckable(true); |
105 | viewMenu->setItemChecked( viewMenu->idAt(0), true); | 105 | viewMenu->setItemChecked( viewMenu->idAt(0), true); |
106 | viewMenu->setItemChecked( viewMenu->idAt(1), false); | 106 | viewMenu->setItemChecked( viewMenu->idAt(1), false); |
107 | 107 | ||
108 | s_addBookmark = tr("Bookmark Directory"); | 108 | s_addBookmark = tr("Bookmark Directory"); |
109 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); | 109 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); |
110 | 110 | ||
111 | // menuButton->insertItem(""); | 111 | // menuButton->insertItem(""); |
112 | 112 | ||
113 | // customDirMenu->insertItem(tr("Add This Directory")); | 113 | // customDirMenu->insertItem(tr("Add This Directory")); |
114 | // customDirMenu->insertItem(tr("Remove This Directory")); | 114 | // customDirMenu->insertItem(tr("Remove This Directory")); |
115 | // customDirMenu->insertSeparator(); | 115 | // customDirMenu->insertSeparator(); |
116 | 116 | ||
117 | menuButton = new MenuButton( lineBox ); | 117 | QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later |
118 | CBHB->setMargin( 0 ); | ||
119 | CBHB->setSpacing( 1 ); | ||
120 | |||
121 | menuButton = new MenuButton( this ); | ||
118 | 122 | ||
119 | menuButton->setUseLabel(false); | 123 | menuButton->setUseLabel(false); |
120 | menuButton->setMaximumWidth( 20 ); | 124 | menuButton->setMaximumWidth( 20 ); |
121 | menuButton->insertItem( s_addBookmark); | 125 | menuButton->insertItem( s_addBookmark); |
122 | menuButton->insertItem( s_removeBookmark); | 126 | menuButton->insertItem( s_removeBookmark); |
123 | menuButton->insertSeparator(); | 127 | menuButton->insertSeparator(); |
124 | menuButton->setFocusPolicy(NoFocus); | 128 | menuButton->setFocusPolicy(NoFocus); |
129 | CBHB->addWidget( menuButton ); | ||
125 | 130 | ||
126 | customDirsToMenu(); | 131 | customDirsToMenu(); |
127 | 132 | ||
128 | currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" ); | 133 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
129 | currentPathCombo->setEditable(TRUE); | 134 | currentPathCombo->setEditable(TRUE); |
130 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 135 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
131 | currentPathCombo->setFocusPolicy(NoFocus); | 136 | currentPathCombo->setFocusPolicy(NoFocus); |
132 | layout->addWidget( lineBox ); | 137 | CBHB->addWidget( currentPathCombo ); |
133 | 138 | ||
139 | layout->addLayout( CBHB ); | ||
134 | 140 | ||
135 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); | 141 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); |
136 | // TabWidget = new QTabWidget( this, "TabWidget" ); | 142 | // TabWidget = new QTabWidget( this, "TabWidget" ); |
137 | layout->addWidget( TabWidget, 4 ); | 143 | layout->addWidget( TabWidget, 4 ); |
138 | 144 | ||
139 | tab = new QWidget( TabWidget, "tab" ); | 145 | tab = new QWidget( TabWidget, "tab" ); |
140 | tabLayout = new QGridLayout( tab ); | 146 | tabLayout = new QGridLayout( tab ); |
141 | tabLayout->setSpacing( 2); | 147 | tabLayout->setSpacing( 2); |
142 | tabLayout->setMargin( 2); | 148 | tabLayout->setMargin( 2); |
143 | 149 | ||
144 | Local_View = new QListView( tab, "Local_View" ); | 150 | Local_View = new QListView( tab, "Local_View" ); |
145 | Local_View->addColumn( tr("File"),130); | 151 | Local_View->addColumn( tr("File"),130); |
146 | Local_View->addColumn( tr("Size"),-1); | 152 | Local_View->addColumn( tr("Size"),-1); |
147 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 153 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
148 | Local_View->addColumn( tr("Date"),-1); | 154 | Local_View->addColumn( tr("Date"),-1); |
149 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 155 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
150 | Local_View->setAllColumnsShowFocus(TRUE); | 156 | Local_View->setAllColumnsShowFocus(TRUE); |
151 | Local_View->setMultiSelection( TRUE ); | 157 | Local_View->setMultiSelection( TRUE ); |
152 | Local_View->setSelectionMode(QListView::Extended); | 158 | Local_View->setSelectionMode(QListView::Extended); |
153 | Local_View->setFocusPolicy(StrongFocus); | 159 | Local_View->setFocusPolicy(StrongFocus); |
154 | Local_View->installEventFilter( this ); | 160 | Local_View->installEventFilter( this ); |
155 | 161 | ||
156 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 162 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
157 | 163 | ||
158 | tabLayout->addWidget( Local_View, 0, 0 ); | 164 | tabLayout->addWidget( Local_View, 0, 0 ); |
159 | 165 | ||
160 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); | 166 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); |
161 | // TabWidget->insertTab( tab, tr("1")); | 167 | // TabWidget->insertTab( tab, tr("1")); |
162 | 168 | ||
163 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 169 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
164 | tabLayout_2 = new QGridLayout( tab_2 ); | 170 | tabLayout_2 = new QGridLayout( tab_2 ); |
165 | tabLayout_2->setSpacing( 2); | 171 | tabLayout_2->setSpacing( 2); |
166 | tabLayout_2->setMargin( 2); | 172 | tabLayout_2->setMargin( 2); |
167 | 173 | ||
168 | Remote_View = new QListView( tab_2, "Remote_View" ); | 174 | Remote_View = new QListView( tab_2, "Remote_View" ); |
169 | Remote_View->addColumn( tr("File"),130); | 175 | Remote_View->addColumn( tr("File"),130); |
170 | Remote_View->addColumn( tr("Size"),-1); | 176 | Remote_View->addColumn( tr("Size"),-1); |
171 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 177 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
172 | Remote_View->addColumn( tr("Date"),-1); | 178 | Remote_View->addColumn( tr("Date"),-1); |
173 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 179 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
174 | Remote_View->setAllColumnsShowFocus(TRUE); | 180 | Remote_View->setAllColumnsShowFocus(TRUE); |
175 | Remote_View->setMultiSelection( TRUE ); | 181 | Remote_View->setMultiSelection( TRUE ); |
176 | Remote_View->setSelectionMode(QListView::Extended); | 182 | Remote_View->setSelectionMode(QListView::Extended); |
177 | Remote_View->setFocusPolicy(StrongFocus); | 183 | Remote_View->setFocusPolicy(StrongFocus); |
178 | Remote_View->installEventFilter( this ); | 184 | Remote_View->installEventFilter( this ); |
179 | 185 | ||
180 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 186 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
181 | 187 | ||
182 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 188 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
183 | 189 | ||
184 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); | 190 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); |
185 | TabWidget->setSizeChange( 370 ); | 191 | TabWidget->setSizeChange( 370 ); |
186 | // TabWidget->insertTab( tab_2, tr( "2")); | 192 | // TabWidget->insertTab( tab_2, tr( "2")); |
187 | 193 | ||
188 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 194 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
189 | tabLayout_3 = new QGridLayout( tab_3 ); | 195 | tabLayout_3 = new QGridLayout( tab_3 ); |
190 | tabLayout_3->setSpacing( 2); | 196 | tabLayout_3->setSpacing( 2); |
191 | tabLayout_3->setMargin( 2); | 197 | tabLayout_3->setMargin( 2); |
192 | 198 | ||
193 | 199 | ||
194 | // OFileDialog fileDialog; | 200 | // OFileDialog fileDialog; |
195 | // fileDialog; | 201 | // fileDialog; |
196 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 202 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
197 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 203 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
198 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 204 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
199 | 205 | ||
200 | QListView *fileTree; | 206 | QListView *fileTree; |
201 | fileTree = new QListView( tab_3, "tree" ); | 207 | fileTree = new QListView( tab_3, "tree" ); |
202 | 208 | ||
203 | 209 | ||
204 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 210 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
205 | 211 | ||
206 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 212 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
207 | */ | 213 | */ |
208 | 214 | ||
209 | /////////////// | 215 | /////////////// |
210 | 216 | ||
211 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 217 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
212 | zaurusDevice=TRUE; | 218 | zaurusDevice=TRUE; |
213 | else | 219 | else |
214 | zaurusDevice=FALSE; | 220 | zaurusDevice=FALSE; |
215 | 221 | ||
216 | 222 | ||
217 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { | 223 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { |
218 | qDebug("not have sd"); | 224 | qDebug("not have sd"); |
219 | sdButton->hide(); | 225 | sdButton->hide(); |
220 | } | 226 | } |
221 | if( !StorageInfo::hasCf() ) { | 227 | if( !StorageInfo::hasCf() ) { |
222 | qDebug("not have cf"); | 228 | qDebug("not have cf"); |
223 | cfButton->hide(); | 229 | cfButton->hide(); |
224 | } | 230 | } |
225 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 231 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
226 | currentDir.setPath( QDir::currentDirPath()); | 232 | currentDir.setPath( QDir::currentDirPath()); |
227 | 233 | ||
228 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 234 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
229 | currentRemoteDir.setPath( QDir::currentDirPath()); | 235 | currentRemoteDir.setPath( QDir::currentDirPath()); |
230 | 236 | ||
231 | // b = TRUE; | 237 | // b = TRUE; |
232 | 238 | ||
233 | filterStr="*"; | 239 | filterStr="*"; |
234 | b=FALSE; | 240 | b=FALSE; |
235 | showMenuHidden(); | 241 | showMenuHidden(); |
236 | TabWidget->setCurrentWidget(0); | 242 | TabWidget->setCurrentWidget(0); |
237 | 243 | ||
238 | } | 244 | } |
239 | 245 | ||
240 | void AdvancedFm::initConnections() | 246 | void AdvancedFm::initConnections() |
241 | { | 247 | { |
242 | 248 | ||
243 | connect( qApp,SIGNAL( aboutToQuit()), | 249 | connect( qApp,SIGNAL( aboutToQuit()), |
244 | this, SLOT( cleanUp()) ); | 250 | this, SLOT( cleanUp()) ); |
245 | connect( qpeDirButton ,SIGNAL(released()), | 251 | connect( qpeDirButton ,SIGNAL(released()), |
246 | this,SLOT( QPEButtonPushed()) ); | 252 | this,SLOT( QPEButtonPushed()) ); |
247 | connect( cfButton ,SIGNAL(released()), | 253 | connect( cfButton ,SIGNAL(released()), |
248 | this,SLOT( CFButtonPushed()) ); | 254 | this,SLOT( CFButtonPushed()) ); |
249 | connect( sdButton ,SIGNAL(released()), | 255 | connect( sdButton ,SIGNAL(released()), |
250 | this,SLOT( SDButtonPushed()) ); | 256 | this,SLOT( SDButtonPushed()) ); |
251 | connect( cdUpButton ,SIGNAL(released()), | 257 | connect( cdUpButton ,SIGNAL(released()), |
252 | this,SLOT( upDir()) ); | 258 | this,SLOT( upDir()) ); |
253 | connect( docButton,SIGNAL(released()), | 259 | connect( docButton,SIGNAL(released()), |
254 | this,SLOT( docButtonPushed()) ); | 260 | this,SLOT( docButtonPushed()) ); |
255 | connect( homeButton,SIGNAL(released()), | 261 | connect( homeButton,SIGNAL(released()), |
256 | this,SLOT( homeButtonPushed()) ); | 262 | this,SLOT( homeButtonPushed()) ); |
257 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), | 263 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), |
258 | this, SLOT( currentPathComboActivated(const QString&) ) ); | 264 | this, SLOT( currentPathComboActivated(const QString&) ) ); |
259 | 265 | ||
260 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 266 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
261 | this,SLOT(currentPathComboChanged())); | 267 | this,SLOT(currentPathComboChanged())); |
262 | 268 | ||
263 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), | 269 | connect( Local_View, SIGNAL( clicked(QListViewItem*)), |
264 | this,SLOT( ListClicked(QListViewItem*)) ); | 270 | this,SLOT( ListClicked(QListViewItem*)) ); |
265 | 271 | ||
266 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 272 | connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
267 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); | 273 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); |
268 | 274 | ||
269 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 275 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
270 | 276 | ||
271 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), | 277 | connect( Remote_View, SIGNAL( clicked(QListViewItem*)), |
272 | this,SLOT( ListClicked(QListViewItem*)) ); | 278 | this,SLOT( ListClicked(QListViewItem*)) ); |
273 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 279 | connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
274 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); | 280 | this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) ); |
275 | 281 | ||
276 | connect( TabWidget,SIGNAL(currentChanged(QWidget*)), | 282 | connect( TabWidget,SIGNAL(currentChanged(QWidget*)), |
277 | this,SLOT(tabChanged(QWidget*))); | 283 | this,SLOT(tabChanged(QWidget*))); |
278 | 284 | ||
279 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | 285 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); |
280 | 286 | ||
281 | connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&))); | 287 | connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&))); |
282 | // connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int))); | 288 | // connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int))); |
283 | connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int))); | 289 | connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int))); |
284 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); | 290 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); |
285 | 291 | ||
286 | } | 292 | } |
287 | 293 | ||
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 6d41ac3..2461e26 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -627,212 +627,212 @@ void AdvancedFm::fileStatus() { | |||
627 | QPEApplication::execDialog( outDlg ); | 627 | QPEApplication::execDialog( outDlg ); |
628 | qApp->processEvents(); | 628 | qApp->processEvents(); |
629 | } | 629 | } |
630 | 630 | ||
631 | 631 | ||
632 | void AdvancedFm::mkDir() { | 632 | void AdvancedFm::mkDir() { |
633 | makeDir(); | 633 | makeDir(); |
634 | } | 634 | } |
635 | 635 | ||
636 | void AdvancedFm::rn() { | 636 | void AdvancedFm::rn() { |
637 | renameIt(); | 637 | renameIt(); |
638 | } | 638 | } |
639 | 639 | ||
640 | void AdvancedFm::del() { | 640 | void AdvancedFm::del() { |
641 | doDelete(); | 641 | doDelete(); |
642 | } | 642 | } |
643 | 643 | ||
644 | void AdvancedFm::mkSym() { | 644 | void AdvancedFm::mkSym() { |
645 | QString cmd; | 645 | QString cmd; |
646 | QStringList curFileList = getPath(); | 646 | QStringList curFileList = getPath(); |
647 | if( curFileList.count() > 0) { | 647 | if( curFileList.count() > 0) { |
648 | QDir *thisDir = CurrentDir(); | 648 | QDir *thisDir = CurrentDir(); |
649 | QDir * thatDir = OtherDir(); | 649 | QDir * thatDir = OtherDir(); |
650 | 650 | ||
651 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 651 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
652 | 652 | ||
653 | QString destName = thatDir->canonicalPath()+"/"+(*it); | 653 | QString destName = thatDir->canonicalPath()+"/"+(*it); |
654 | if(destName.right(1) == "/") { | 654 | if(destName.right(1) == "/") { |
655 | destName = destName.left( destName.length() -1); | 655 | destName = destName.left( destName.length() -1); |
656 | } | 656 | } |
657 | 657 | ||
658 | QString curFile = thisDir->canonicalPath()+"/"+(*it); | 658 | QString curFile = thisDir->canonicalPath()+"/"+(*it); |
659 | 659 | ||
660 | if( curFile.right(1) == "/") { | 660 | if( curFile.right(1) == "/") { |
661 | curFile = curFile.left( curFile.length() -1); | 661 | curFile = curFile.left( curFile.length() -1); |
662 | } | 662 | } |
663 | 663 | ||
664 | cmd = "ln -s "+curFile+" "+destName; | 664 | cmd = "ln -s "+curFile+" "+destName; |
665 | // qDebug(cmd); | 665 | // qDebug(cmd); |
666 | startProcess( (const QString)cmd ); | 666 | startProcess( (const QString)cmd ); |
667 | } | 667 | } |
668 | rePopulate(); | 668 | rePopulate(); |
669 | setOtherTabCurrent(); | 669 | setOtherTabCurrent(); |
670 | } | 670 | } |
671 | } | 671 | } |
672 | 672 | ||
673 | void AdvancedFm::doBeam() { | 673 | void AdvancedFm::doBeam() { |
674 | Ir ir; | 674 | Ir ir; |
675 | if(!ir.supported()) { | 675 | if(!ir.supported()) { |
676 | } else { | 676 | } else { |
677 | QStringList curFileList = getPath(); | 677 | QStringList curFileList = getPath(); |
678 | if( curFileList.count() > 0) { | 678 | if( curFileList.count() > 0) { |
679 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 679 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
680 | QString curFile = (*it); | 680 | QString curFile = (*it); |
681 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; | 681 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; |
682 | if( curFilePath.right(1) == "/") { | 682 | if( curFilePath.right(1) == "/") { |
683 | curFilePath = curFilePath.left( curFilePath.length() -1); | 683 | curFilePath = curFilePath.left( curFilePath.length() -1); |
684 | } | 684 | } |
685 | Ir *file = new Ir(this, "IR"); | 685 | Ir *file = new Ir(this, "IR"); |
686 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); | 686 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); |
687 | file->send( curFilePath, curFile ); | 687 | file->send( curFilePath, curFile ); |
688 | } | 688 | } |
689 | } | 689 | } |
690 | } | 690 | } |
691 | } | 691 | } |
692 | 692 | ||
693 | void AdvancedFm::fileBeamFinished( Ir *) { | 693 | void AdvancedFm::fileBeamFinished( Ir *) { |
694 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 694 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
695 | } | 695 | } |
696 | 696 | ||
697 | void AdvancedFm::selectAll() { | 697 | void AdvancedFm::selectAll() { |
698 | QListView *thisView = CurrentView(); | 698 | QListView *thisView = CurrentView(); |
699 | thisView->selectAll(true); | 699 | thisView->selectAll(true); |
700 | thisView->setSelected( thisView->firstChild(),false); | 700 | thisView->setSelected( thisView->firstChild(),false); |
701 | } | 701 | } |
702 | 702 | ||
703 | void AdvancedFm::startProcess(const QString & cmd) { | 703 | void AdvancedFm::startProcess(const QString & cmd) { |
704 | QStringList command; | 704 | QStringList command; |
705 | OProcess *process; | 705 | OProcess *process; |
706 | process = new OProcess(); | 706 | process = new OProcess(); |
707 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), | 707 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), |
708 | this, SLOT( processEnded(Opie::Core::OProcess*))); | 708 | this, SLOT( processEnded(Opie::Core::OProcess*))); |
709 | 709 | ||
710 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), | 710 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), |
711 | this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); | 711 | this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); |
712 | 712 | ||
713 | command << "/bin/sh"; | 713 | command << "/bin/sh"; |
714 | command << "-c"; | 714 | command << "-c"; |
715 | command << cmd.latin1(); | 715 | command << cmd.latin1(); |
716 | *process << command; | 716 | *process << command; |
717 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) | 717 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) |
718 | qDebug("could not start process"); | 718 | qDebug("could not start process"); |
719 | } | 719 | } |
720 | 720 | ||
721 | void AdvancedFm::processEnded(OProcess *) { | 721 | void AdvancedFm::processEnded(OProcess *) { |
722 | rePopulate(); | 722 | rePopulate(); |
723 | } | 723 | } |
724 | 724 | ||
725 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { | 725 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { |
726 | // qWarning("received stderrt %d bytes", buflen); | 726 | // qWarning("received stderrt %d bytes", buflen); |
727 | 727 | ||
728 | QString lineStr = buffer; | 728 | QString lineStr = buffer; |
729 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); | 729 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); |
730 | } | 730 | } |
731 | 731 | ||
732 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | 732 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { |
733 | if ( o->inherits( "QLineEdit" ) ) { | 733 | if ( o->inherits( "QLineEdit" ) ) { |
734 | if ( e->type() == QEvent::KeyPress ) { | 734 | if ( e->type() == QEvent::KeyPress ) { |
735 | QKeyEvent *ke = (QKeyEvent*)e; | 735 | QKeyEvent *ke = (QKeyEvent*)e; |
736 | if ( ke->key() == Key_Return || | 736 | if ( ke->key() == Key_Return || |
737 | ke->key() == Key_Enter ) { | 737 | ke->key() == Key_Enter ) { |
738 | okRename(); | 738 | okRename(); |
739 | return true; | 739 | return true; |
740 | } | 740 | } |
741 | else if ( ke->key() == Key_Escape ) { | 741 | else if ( ke->key() == Key_Escape ) { |
742 | cancelRename(); | 742 | cancelRename(); |
743 | return true; | 743 | return true; |
744 | } | 744 | } |
745 | } | 745 | } |
746 | else if ( e->type() == QEvent::FocusOut ) { | 746 | else if ( e->type() == QEvent::FocusOut ) { |
747 | cancelRename(); | 747 | cancelRename(); |
748 | return true; | 748 | return true; |
749 | } | 749 | } |
750 | } | 750 | } |
751 | if ( o->inherits( "QListView" ) ) { | 751 | if ( o->inherits( "QListView" ) ) { |
752 | if ( e->type() == QEvent::FocusIn ) { | 752 | if ( e->type() == QEvent::FocusIn ) { |
753 | if( o == Local_View) { //keep track of which view | 753 | if( o == Local_View) { //keep track of which view |
754 | whichTab=1; | 754 | whichTab=1; |
755 | } | 755 | } |
756 | else { | 756 | else { |
757 | whichTab=2; | 757 | whichTab=2; |
758 | } | 758 | } |
759 | } | 759 | } |
760 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection | 760 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection |
761 | } | 761 | } |
762 | 762 | ||
763 | return QWidget::eventFilter( o, e ); | 763 | return QWidget::eventFilter( o, e ); |
764 | } | 764 | } |
765 | 765 | ||
766 | 766 | ||
767 | void AdvancedFm::cancelRename() { | 767 | void AdvancedFm::cancelRename() { |
768 | // qDebug("cancel rename"); | 768 | // qDebug("cancel rename"); |
769 | QListView * view; | 769 | QListView * view; |
770 | view = CurrentView(); | 770 | view = CurrentView(); |
771 | 771 | ||
772 | bool resetFocus = view->viewport()->focusProxy() == renameBox; | 772 | bool resetFocus = view->viewport()->focusProxy() == renameBox; |
773 | delete renameBox; | 773 | delete renameBox; |
774 | renameBox = 0; | 774 | renameBox = 0; |
775 | if ( resetFocus ) { | 775 | if ( resetFocus ) { |
776 | view->viewport()->setFocusProxy( view); | 776 | view->viewport()->setFocusProxy( view); |
777 | view->setFocus(); | 777 | view->setFocus(); |
778 | } | 778 | } |
779 | } | 779 | } |
780 | 780 | ||
781 | void AdvancedFm::doRename(QListView * view) { | 781 | void AdvancedFm::doRename(QListView * view) { |
782 | if( !CurrentView()->currentItem()) return; | 782 | if( !CurrentView()->currentItem()) return; |
783 | 783 | ||
784 | QRect r = view->itemRect( view->currentItem( )); | 784 | QRect r = view->itemRect( view->currentItem( )); |
785 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); | 785 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); |
786 | r.setX( view->contentsX() ); | 786 | r.setX( view->contentsX() ); |
787 | 787 | ||
788 | if ( r.width() > view->visibleWidth() ) | 788 | if ( r.width() > view->visibleWidth() ) |
789 | r.setWidth( view->visibleWidth() ); | 789 | r.setWidth( view->visibleWidth() ); |
790 | 790 | ||
791 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); | 791 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); |
792 | renameBox->setFrame(true); | 792 | renameBox->setFrame(true); |
793 | 793 | ||
794 | renameBox->setText( view->currentItem()->text(0) ); | 794 | renameBox->setText( view->currentItem()->text(0) ); |
795 | 795 | ||
796 | renameBox->selectAll(); | 796 | renameBox->selectAll(); |
797 | renameBox->installEventFilter( this ); | 797 | renameBox->installEventFilter( this ); |
798 | 798 | ||
799 | view->addChild( renameBox, r.x(), r.y() ); | 799 | view->addChild( renameBox, r.x(), r.y() ); |
800 | 800 | ||
801 | renameBox->resize( r.size() ); | 801 | renameBox->resize( r.size() ); |
802 | 802 | ||
803 | view->viewport()->setFocusProxy( renameBox ); | 803 | view->viewport()->setFocusProxy( renameBox ); |
804 | 804 | ||
805 | renameBox->setFocus(); | 805 | renameBox->setFocus(); |
806 | renameBox->show(); | 806 | renameBox->show(); |
807 | } | 807 | } |
808 | 808 | ||
809 | 809 | ||
810 | void AdvancedFm::renameIt() { | 810 | void AdvancedFm::renameIt() { |
811 | if( !CurrentView()->currentItem()) return; | 811 | if( !CurrentView()->currentItem()) return; |
812 | 812 | ||
813 | QListView *thisView = CurrentView(); | 813 | QListView *thisView = CurrentView(); |
814 | oldName = thisView->currentItem()->text(0); | 814 | oldName = thisView->currentItem()->text(0); |
815 | doRename( thisView ); | 815 | doRename( thisView ); |
816 | } | 816 | } |
817 | 817 | ||
818 | void AdvancedFm::okRename() { | 818 | void AdvancedFm::okRename() { |
819 | if( !CurrentView()->currentItem()) return; | 819 | if( !renameBox) return; |
820 | 820 | ||
821 | QString newName = renameBox->text(); | 821 | QString newName = renameBox->text(); |
822 | cancelRename(); | 822 | cancelRename(); |
823 | QListView * view = CurrentView(); | 823 | QListView * view = CurrentView(); |
824 | QString path = CurrentDir()->canonicalPath() + "/"; | 824 | QString path = CurrentDir()->canonicalPath() + "/"; |
825 | oldName = path + oldName; | 825 | oldName = path + oldName; |
826 | newName = path + newName; | 826 | newName = path + newName; |
827 | if( rename( oldName.latin1(), newName.latin1())== -1) | 827 | if( rename( oldName.latin1(), newName.latin1())== -1) |
828 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 828 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
829 | else | 829 | else |
830 | oldName = ""; | 830 | oldName = ""; |
831 | view->takeItem( view->currentItem() ); | 831 | view->takeItem( view->currentItem() ); |
832 | delete view->currentItem(); | 832 | delete view->currentItem(); |
833 | rePopulate(); | 833 | rePopulate(); |
834 | } | 834 | } |
835 | 835 | ||
836 | void AdvancedFm::openSearch() { | 836 | void AdvancedFm::openSearch() { |
837 | QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); | 837 | QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); |
838 | } | 838 | } |