summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-09-18 09:27:34 (UTC)
committer llornkcor <llornkcor>2004-09-18 09:27:34 (UTC)
commitb45501194ab88d7fc898056df442430e7d6a2b22 (patch) (unidiff)
tree4fe36ced24e66b87d7969b46ba0a7623b98f21cc
parentf0e025a8e64f96390377c0aa66e8b5602494d7d0 (diff)
downloadopie-b45501194ab88d7fc898056df442430e7d6a2b22.zip
opie-b45501194ab88d7fc898056df442430e7d6a2b22.tar.gz
opie-b45501194ab88d7fc898056df442430e7d6a2b22.tar.bz2
add refresh menuitem
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp6
-rw-r--r--noncore/apps/advancedfm/advancedfm.h2
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp1
3 files changed, 8 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index b4461cb..4de7d38 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -240,96 +240,102 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
240 240
241 241
242 if(selectedItem) { 242 if(selectedItem) {
243 QString strItem=selectedItem->text(0); 243 QString strItem=selectedItem->text(0);
244// owarn << strItem << oendl; 244// owarn << strItem << oendl;
245 QString strSize=selectedItem->text(1); 245 QString strSize=selectedItem->text(1);
246 strSize=strSize.stripWhiteSpace(); 246 strSize=strSize.stripWhiteSpace();
247 bool isDirectory = false; 247 bool isDirectory = false;
248 QString strItem2; 248 QString strItem2;
249 249
250 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink 250 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink
251 strItem2 = dealWithSymName((const QString&)strItem); 251 strItem2 = dealWithSymName((const QString&)strItem);
252 if(QDir(strItem2).exists() ) 252 if(QDir(strItem2).exists() )
253 strItem = strItem2; 253 strItem = strItem2;
254 } 254 }
255 255
256 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 256 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
257 257
258 if(QDir(strItem).exists()) 258 if(QDir(strItem).exists())
259 isDirectory = true; 259 isDirectory = true;
260 } 260 }
261 261
262 if( isDirectory ) { 262 if( isDirectory ) {
263 CurrentDir()->cd( strItem, TRUE); 263 CurrentDir()->cd( strItem, TRUE);
264 populateView(); 264 populateView();
265 CurrentView()->ensureItemVisible( CurrentView()->firstChild()); 265 CurrentView()->ensureItemVisible( CurrentView()->firstChild());
266 } 266 }
267 chdir( strItem.latin1()); 267 chdir( strItem.latin1());
268 } 268 }
269} 269}
270 270
271void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { 271void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) {
272 Q_UNUSED(item); 272 Q_UNUSED(item);
273 switch (mouse) { 273 switch (mouse) {
274 case 1: 274 case 1:
275 { 275 {
276 if(renameBox != 0 ) { 276 if(renameBox != 0 ) {
277 cancelRename(); 277 cancelRename();
278 } 278 }
279 } 279 }
280 break; 280 break;
281// case 2: 281// case 2:
282// menuTimer.start( 50, TRUE ); 282// menuTimer.start( 50, TRUE );
283// break; 283// break;
284 }; 284 };
285} 285}
286 286
287 287
288void AdvancedFm::refreshCurrentTab() {
289 populateView();
290 // if ( TabWidget->currentWidget() == tab) {
291
292}
293
288void AdvancedFm::switchToLocalTab() { 294void AdvancedFm::switchToLocalTab() {
289 TabWidget->setCurrentWidget(0); 295 TabWidget->setCurrentWidget(0);
290 Local_View->setFocus(); 296 Local_View->setFocus();
291 297
292} 298}
293 299
294void AdvancedFm::switchToRemoteTab() { 300void AdvancedFm::switchToRemoteTab() {
295 TabWidget->setCurrentWidget(1); 301 TabWidget->setCurrentWidget(1);
296 Remote_View->setFocus(); 302 Remote_View->setFocus();
297} 303}
298 304
299void AdvancedFm::readConfig() { 305void AdvancedFm::readConfig() {
300 Config cfg("AdvancedFm"); 306 Config cfg("AdvancedFm");
301} 307}
302 308
303void AdvancedFm::writeConfig() { 309void AdvancedFm::writeConfig() {
304 Config cfg("AdvancedFm"); 310 Config cfg("AdvancedFm");
305} 311}
306 312
307void AdvancedFm::currentPathComboChanged() { 313void AdvancedFm::currentPathComboChanged() {
308 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 314 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
309 CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); 315 CurrentDir()->setPath( currentPathCombo->lineEdit()->text() );
310 populateView(); 316 populateView();
311 } else { 317 } else {
312 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 318 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
313 } 319 }
314} 320}
315 321
316void AdvancedFm::fillCombo(const QString &currentPath) { 322void AdvancedFm::fillCombo(const QString &currentPath) {
317 323
318 if ( TabWidget->currentWidget() == tab) { 324 if ( TabWidget->currentWidget() == tab) {
319// if ( whichTab == 1) { 325// if ( whichTab == 1) {
320 currentPathCombo->lineEdit()->setText( currentPath); 326 currentPathCombo->lineEdit()->setText( currentPath);
321 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 327 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
322 currentPathCombo->clear(); 328 currentPathCombo->clear();
323 localDirPathStringList.prepend( currentPath ); 329 localDirPathStringList.prepend( currentPath );
324 currentPathCombo->insertStringList( localDirPathStringList,-1); 330 currentPathCombo->insertStringList( localDirPathStringList,-1);
325 } 331 }
326 } else { 332 } else {
327 currentPathCombo->lineEdit()->setText( currentPath); 333 currentPathCombo->lineEdit()->setText( currentPath);
328 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 334 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
329 currentPathCombo->clear(); 335 currentPathCombo->clear();
330 remoteDirPathStringList.prepend( currentPath ); 336 remoteDirPathStringList.prepend( currentPath );
331 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 337 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
332 } 338 }
333 } 339 }
334} 340}
335 341
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index e596977..def6fe2 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -43,97 +43,97 @@ class QSpinBox;
43class QWidget; 43class QWidget;
44class QPopupMenu; 44class QPopupMenu;
45class QFile; 45class QFile;
46class QListViewItem; 46class QListViewItem;
47class QLineEdit; 47class QLineEdit;
48class MenuButton; 48class MenuButton;
49 49
50class QToolButton; 50class QToolButton;
51class Ir; 51class Ir;
52 52
53class AdvancedFm : public QMainWindow 53class AdvancedFm : public QMainWindow
54{ 54{
55 Q_OBJECT 55 Q_OBJECT
56public: 56public:
57 static QString appName() { return QString::fromLatin1("advancedfm"); } 57 static QString appName() { return QString::fromLatin1("advancedfm"); }
58 AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); 58 AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0);
59 ~AdvancedFm(); 59 ~AdvancedFm();
60protected slots: 60protected slots:
61 void slotSwitchMenu(int); 61 void slotSwitchMenu(int);
62 void selectAll(); 62 void selectAll();
63 void addToDocs(); 63 void addToDocs();
64 void doDirChange(); 64 void doDirChange();
65 void mkDir(); 65 void mkDir();
66 void del(); 66 void del();
67 void rn(); 67 void rn();
68 void populateView(); 68 void populateView();
69 void rePopulate(); 69 void rePopulate();
70 void showHidden(); 70 void showHidden();
71 void showMenuHidden(); 71 void showMenuHidden();
72 void writeConfig(); 72 void writeConfig();
73 void readConfig(); 73 void readConfig();
74 void ListClicked(QListViewItem *); 74 void ListClicked(QListViewItem *);
75 void ListPressed( int, QListViewItem *, const QPoint&, int); 75 void ListPressed( int, QListViewItem *, const QPoint&, int);
76 void makeDir(); 76 void makeDir();
77 void doDelete(); 77 void doDelete();
78 void tabChanged(QWidget*); 78 void tabChanged(QWidget*);
79 void cleanUp(); 79 void cleanUp();
80 void renameIt(); 80 void renameIt();
81 void runThis(); 81 void runThis();
82 void runText(); 82 void runText();
83 void filePerms(); 83 void filePerms();
84 void doProperties(); 84 void doProperties();
85 void runCommand(); 85 void runCommand();
86 void runCommandStd(); 86 void runCommandStd();
87 QStringList getPath(); 87 QStringList getPath();
88 void mkSym(); 88 void mkSym();
89 void switchToLocalTab(); 89 void switchToLocalTab();
90 void switchToRemoteTab(); 90 void switchToRemoteTab();
91 91 void refreshCurrentTab();
92protected: 92protected:
93 93
94 Opie::Ui::OSplitter *TabWidget; 94 Opie::Ui::OSplitter *TabWidget;
95 QCopChannel * channel; 95 QCopChannel * channel;
96 QPixmap unknownXpm; 96 QPixmap unknownXpm;
97 int whichTab; 97 int whichTab;
98// QTabWidget *TabWidget; 98// QTabWidget *TabWidget;
99 QWidget *tab, *tab_2, *tab_3; 99 QWidget *tab, *tab_2, *tab_3;
100 QListView *Local_View, *Remote_View; 100 QListView *Local_View, *Remote_View;
101 101
102 QLineEdit *currentPathEdit; 102 QLineEdit *currentPathEdit;
103 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; 103 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/;
104 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 104 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
105// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 105// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
106 QDir currentDir, currentRemoteDir; 106 QDir currentDir, currentRemoteDir;
107 QComboBox *currentPathCombo; 107 QComboBox *currentPathCombo;
108 QString filterStr, s_addBookmark, s_removeBookmark; 108 QString filterStr, s_addBookmark, s_removeBookmark;
109 QListViewItem * item; 109 QListViewItem * item;
110 bool b; 110 bool b;
111 QStringList fileSystemTypeList, fsList; 111 QStringList fileSystemTypeList, fsList;
112 int currentServerConfig; 112 int currentServerConfig;
113 bool zaurusDevice; 113 bool zaurusDevice;
114 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 114 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
115 QStringList remoteDirPathStringList, localDirPathStringList; 115 QStringList remoteDirPathStringList, localDirPathStringList;
116 QLineEdit *renameBox; 116 QLineEdit *renameBox;
117 117
118 void init(); 118 void init();
119 void initConnections(); 119 void initConnections();
120 void keyReleaseEvent( QKeyEvent *); 120 void keyReleaseEvent( QKeyEvent *);
121 void keyPressEvent( QKeyEvent *); 121 void keyPressEvent( QKeyEvent *);
122 QString getFileSystemType(const QString &); 122 QString getFileSystemType(const QString &);
123 QString getDiskSpace(const QString &); 123 QString getDiskSpace(const QString &);
124 void parsetab(const QString &fileName); 124 void parsetab(const QString &fileName);
125 QString checkDiskSpace(const QString &); 125 QString checkDiskSpace(const QString &);
126 QString dealWithSymName(const QString &); 126 QString dealWithSymName(const QString &);
127 QDir *CurrentDir(); 127 QDir *CurrentDir();
128 QDir *OtherDir(); 128 QDir *OtherDir();
129 QListView *CurrentView(); 129 QListView *CurrentView();
130 QListView *OtherView(); 130 QListView *OtherView();
131 void setOtherTabCurrent(); 131 void setOtherTabCurrent();
132 132
133protected slots: 133protected slots:
134 134
135 void openSearch(); 135 void openSearch();
136 void dirMenuSelected(int); 136 void dirMenuSelected(int);
137 void showFileMenu(); 137 void showFileMenu();
138 void homeButtonPushed(); 138 void homeButtonPushed();
139 void docButtonPushed(); 139 void docButtonPushed();
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index dc7e8e1..1802571 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -56,96 +56,97 @@ void AdvancedFm::init() {
56 cdUpButton->setAutoRaise( true ); 56 cdUpButton->setAutoRaise( true );
57 menuBar->insertItem( cdUpButton ); 57 menuBar->insertItem( cdUpButton );
58 58
59 59
60 60
61 qpeDirButton= new QToolButton( 0,"QPEButton"); 61 qpeDirButton= new QToolButton( 0,"QPEButton");
62 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); 62 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
63 qpeDirButton->setAutoRaise( true ); 63 qpeDirButton->setAutoRaise( true );
64 menuBar->insertItem( qpeDirButton ); 64 menuBar->insertItem( qpeDirButton );
65 65
66 cfButton = new QToolButton( 0, "CFButton"); 66 cfButton = new QToolButton( 0, "CFButton");
67 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); 67 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
68 cfButton->setAutoRaise( true ); 68 cfButton->setAutoRaise( true );
69 menuBar->insertItem( cfButton ); 69 menuBar->insertItem( cfButton );
70 70
71 sdButton = new QToolButton( 0, "SDButton"); 71 sdButton = new QToolButton( 0, "SDButton");
72 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); 72 sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard"));
73 sdButton->setAutoRaise( true ); 73 sdButton->setAutoRaise( true );
74 menuBar->insertItem( sdButton ); 74 menuBar->insertItem( sdButton );
75 75
76 docButton = new QToolButton( 0,"docsButton"); 76 docButton = new QToolButton( 0,"docsButton");
77 docButton->setPixmap(Resource::loadPixmap("DocsIcon")); 77 docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
78 docButton->setAutoRaise( true ); 78 docButton->setAutoRaise( true );
79 menuBar->insertItem( docButton ); 79 menuBar->insertItem( docButton );
80 80
81 homeButton = new QToolButton( 0, "homeButton"); 81 homeButton = new QToolButton( 0, "homeButton");
82 homeButton->setPixmap(Resource::loadPixmap("home")); 82 homeButton->setPixmap(Resource::loadPixmap("home"));
83 homeButton->setAutoRaise( true ); 83 homeButton->setAutoRaise( true );
84 menuBar->insertItem( homeButton ); 84 menuBar->insertItem( homeButton );
85 85
86 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); 86 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
87 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 87 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
88 fileMenu->insertSeparator(); 88 fileMenu->insertSeparator();
89 fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); 89 fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() ));
90 fileMenu->insertSeparator(); 90 fileMenu->insertSeparator();
91 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 91 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
92 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 92 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
93 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 93 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
94 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 94 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
95 fileMenu->insertSeparator(); 95 fileMenu->insertSeparator();
96 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 96 fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
97 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); 97 fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() ));
98 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); 98 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
99 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 99 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
100 fileMenu->setCheckable(TRUE); 100 fileMenu->setCheckable(TRUE);
101 101
102 viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); 102 viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab()));
103 viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); 103 viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab()));
104 viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab()));
104// viewMenu->insertSeparator(); 105// viewMenu->insertSeparator();
105// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 106// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
106 viewMenu->setCheckable(true); 107 viewMenu->setCheckable(true);
107 viewMenu->setItemChecked( viewMenu->idAt(0), true); 108 viewMenu->setItemChecked( viewMenu->idAt(0), true);
108 viewMenu->setItemChecked( viewMenu->idAt(1), false); 109 viewMenu->setItemChecked( viewMenu->idAt(1), false);
109 110
110 s_addBookmark = tr("Bookmark Directory"); 111 s_addBookmark = tr("Bookmark Directory");
111 s_removeBookmark = tr("Remove Current Directory from Bookmarks"); 112 s_removeBookmark = tr("Remove Current Directory from Bookmarks");
112 113
113// menuButton->insertItem(""); 114// menuButton->insertItem("");
114 115
115// customDirMenu->insertItem(tr("Add This Directory")); 116// customDirMenu->insertItem(tr("Add This Directory"));
116// customDirMenu->insertItem(tr("Remove This Directory")); 117// customDirMenu->insertItem(tr("Remove This Directory"));
117// customDirMenu->insertSeparator(); 118// customDirMenu->insertSeparator();
118 119
119 QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later 120 QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later
120 CBHB->setMargin( 0 ); 121 CBHB->setMargin( 0 );
121 CBHB->setSpacing( 1 ); 122 CBHB->setSpacing( 1 );
122 123
123 menuButton = new MenuButton( this ); 124 menuButton = new MenuButton( this );
124 125
125 menuButton->setUseLabel(false); 126 menuButton->setUseLabel(false);
126 menuButton->setMaximumWidth( 20 ); 127 menuButton->setMaximumWidth( 20 );
127 menuButton->insertItem( s_addBookmark); 128 menuButton->insertItem( s_addBookmark);
128 menuButton->insertItem( s_removeBookmark); 129 menuButton->insertItem( s_removeBookmark);
129 menuButton->insertSeparator(); 130 menuButton->insertSeparator();
130 menuButton->setFocusPolicy(NoFocus); 131 menuButton->setFocusPolicy(NoFocus);
131 CBHB->addWidget( menuButton ); 132 CBHB->addWidget( menuButton );
132 133
133 customDirsToMenu(); 134 customDirsToMenu();
134 135
135 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 136 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
136 currentPathCombo->setEditable(TRUE); 137 currentPathCombo->setEditable(TRUE);
137 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 138 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
138 currentPathCombo->setFocusPolicy(NoFocus); 139 currentPathCombo->setFocusPolicy(NoFocus);
139 CBHB->addWidget( currentPathCombo ); 140 CBHB->addWidget( currentPathCombo );
140 141
141 layout->addLayout( CBHB ); 142 layout->addLayout( CBHB );
142 143
143 TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); 144 TabWidget = new OSplitter( Horizontal, this, "TabWidget" );
144// TabWidget = new QTabWidget( this, "TabWidget" ); 145// TabWidget = new QTabWidget( this, "TabWidget" );
145 layout->addWidget( TabWidget, 4 ); 146 layout->addWidget( TabWidget, 4 );
146 147
147 tab = new QWidget( TabWidget, "tab" ); 148 tab = new QWidget( TabWidget, "tab" );
148 tabLayout = new QGridLayout( tab ); 149 tabLayout = new QGridLayout( tab );
149 tabLayout->setSpacing( 2); 150 tabLayout->setSpacing( 2);
150 tabLayout->setMargin( 2); 151 tabLayout->setMargin( 2);
151 152