Diffstat (limited to 'noncore/apps/advancedfm/advancedfmData.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 0966f02..bb80dc6 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -7,24 +7,26 @@ | |||
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/qpemenubar.h> | 16 | #include <qpe/qpemenubar.h> |
17 | #include <qpe/qpetoolbar.h> | 17 | #include <qpe/qpetoolbar.h> |
18 | #include <qpe/resource.h> | 18 | #include <qpe/resource.h> |
19 | #include <qpe/menubutton.h> | ||
20 | #include <qpe/config.h> | ||
19 | 21 | ||
20 | #include <qlayout.h> | 22 | #include <qlayout.h> |
21 | #include <qpixmap.h> | 23 | #include <qpixmap.h> |
22 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
23 | #include <qpopupmenu.h> | 25 | #include <qpopupmenu.h> |
24 | #include <qtabwidget.h> | 26 | #include <qtabwidget.h> |
25 | #include <qtoolbutton.h> | 27 | #include <qtoolbutton.h> |
26 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
27 | #include <qlistview.h> | 29 | #include <qlistview.h> |
28 | 30 | ||
29 | #include <sys/utsname.h> | 31 | #include <sys/utsname.h> |
30 | 32 | ||
@@ -34,94 +36,115 @@ void AdvancedFm::init() { | |||
34 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); | 36 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); |
35 | #endif | 37 | #endif |
36 | setCaption( tr( "AdvancedFm" ) ); | 38 | setCaption( tr( "AdvancedFm" ) ); |
37 | 39 | ||
38 | QGridLayout *layout = new QGridLayout( this ); | 40 | QGridLayout *layout = new QGridLayout( this ); |
39 | layout->setSpacing( 2); | 41 | layout->setSpacing( 2); |
40 | layout->setMargin( 2); | 42 | layout->setMargin( 2); |
41 | 43 | ||
42 | 44 | ||
43 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 45 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
44 | fileMenu = new QPopupMenu( this ); | 46 | fileMenu = new QPopupMenu( this ); |
45 | viewMenu = new QPopupMenu( this ); | 47 | viewMenu = new QPopupMenu( this ); |
48 | // customDirMenu = new QPopupMenu( this ); | ||
46 | 49 | ||
47 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | 50 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); |
48 | 51 | ||
49 | menuBar->insertItem( tr( "File" ), fileMenu); | 52 | menuBar->insertItem( tr( "File" ), fileMenu); |
50 | menuBar->insertItem( tr( "View" ), viewMenu); | 53 | menuBar->insertItem( tr( "View" ), viewMenu); |
54 | // menuBar->insertItem( tr( "^" ), customDirMenu); | ||
55 | |||
56 | cdUpButton = new QToolButton( this,"cdUpButton"); | ||
57 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | ||
58 | cdUpButton->setFixedSize( QSize( 20, 20 ) ); | ||
59 | layout->addMultiCellWidget( cdUpButton , 0, 0, 2, 2); | ||
60 | |||
61 | menuButton = new MenuButton(this); | ||
62 | menuButton->setFixedSize( QSize( 20, 20 ) ); | ||
63 | layout->addMultiCellWidget( menuButton , 0, 0, 3, 3); | ||
51 | 64 | ||
52 | qpeDirButton= new QToolButton(this,"QPEButton"); | 65 | qpeDirButton= new QToolButton(this,"QPEButton"); |
53 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 66 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
54 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | 67 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); |
55 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | 68 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 4, 4); |
56 | 69 | ||
57 | cfButton = new QToolButton( this,"CFButton"); | 70 | cfButton = new QToolButton( this,"CFButton"); |
58 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 71 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
59 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | 72 | cfButton ->setFixedSize( QSize( 20, 20 ) ); |
60 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | 73 | layout->addMultiCellWidget( cfButton , 0, 0, 5, 5); |
61 | 74 | ||
62 | sdButton = new QToolButton( this,"SDButton"); | 75 | sdButton = new QToolButton( this,"SDButton"); |
63 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); | 76 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); |
64 | sdButton->setFixedSize( QSize( 20, 20 ) ); | 77 | sdButton->setFixedSize( QSize( 20, 20 ) ); |
65 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | 78 | layout->addMultiCellWidget( sdButton , 0, 0, 6, 6); |
66 | 79 | ||
67 | cdUpButton = new QToolButton( this,"cdUpButton"); | ||
68 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | ||
69 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | ||
70 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | ||
71 | 80 | ||
72 | docButton = new QToolButton( this,"docsButton"); | 81 | docButton = new QToolButton( this,"docsButton"); |
73 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 82 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
74 | docButton->setFixedSize( QSize( 20, 20 ) ); | 83 | docButton->setFixedSize( QSize( 20, 20 ) ); |
75 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | 84 | layout->addMultiCellWidget( docButton, 0, 0, 7, 7); |
76 | 85 | ||
77 | homeButton = new QToolButton( this,"homeButton"); | 86 | homeButton = new QToolButton( this,"homeButton"); |
78 | homeButton->setPixmap(Resource::loadPixmap("home")); | 87 | homeButton->setPixmap(Resource::loadPixmap("home")); |
79 | homeButton->setFixedSize( QSize( 20, 20 ) ); | 88 | homeButton->setFixedSize( QSize( 20, 20 ) ); |
80 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | 89 | layout->addMultiCellWidget( homeButton, 0, 0, 8, 8); |
81 | 90 | ||
82 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 91 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); |
83 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 92 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
84 | fileMenu->insertSeparator(); | 93 | fileMenu->insertSeparator(); |
85 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 94 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
86 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 95 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
87 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 96 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
88 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 97 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
89 | fileMenu->insertSeparator(); | 98 | fileMenu->insertSeparator(); |
90 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 99 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
91 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); | 100 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); |
92 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 101 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
93 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 102 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
94 | fileMenu->setCheckable(TRUE); | 103 | fileMenu->setCheckable(TRUE); |
95 | 104 | ||
96 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 105 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
97 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 106 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
98 | viewMenu->insertSeparator(); | 107 | viewMenu->insertSeparator(); |
99 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 108 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
100 | viewMenu->setCheckable(TRUE); | 109 | viewMenu->setCheckable(TRUE); |
101 | 110 | ||
111 | s_addBookmark = tr("Bookmark Directory"); | ||
112 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); | ||
113 | |||
114 | menuButton->setUseLabel(false); | ||
115 | menuButton->insertItem( s_addBookmark); | ||
116 | menuButton->insertItem( s_removeBookmark); | ||
117 | menuButton->insertSeparator(); | ||
118 | // menuButton->insertItem(""); | ||
119 | |||
120 | // customDirMenu->insertItem(tr("Add This Directory")); | ||
121 | // customDirMenu->insertItem(tr("Remove This Directory")); | ||
122 | // customDirMenu->insertSeparator(); | ||
123 | |||
124 | customDirsToMenu(); | ||
102 | 125 | ||
103 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 126 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
104 | currentPathCombo->setEditable(TRUE); | 127 | currentPathCombo->setEditable(TRUE); |
105 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 128 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 8); |
106 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 129 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
107 | 130 | ||
108 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 131 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
109 | 132 | ||
110 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | 133 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 8); |
111 | 134 | ||
112 | 135 | ||
113 | TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); | 136 | TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); |
114 | // TabWidget = new QTabWidget( this, "TabWidget" ); | 137 | // TabWidget = new QTabWidget( this, "TabWidget" ); |
115 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); | 138 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 8); |
116 | 139 | ||
117 | tab = new QWidget( TabWidget, "tab" ); | 140 | tab = new QWidget( TabWidget, "tab" ); |
118 | tabLayout = new QGridLayout( tab ); | 141 | tabLayout = new QGridLayout( tab ); |
119 | tabLayout->setSpacing( 2); | 142 | tabLayout->setSpacing( 2); |
120 | tabLayout->setMargin( 2); | 143 | tabLayout->setMargin( 2); |
121 | 144 | ||
122 | Local_View = new QListView( tab, "Local_View" ); | 145 | Local_View = new QListView( tab, "Local_View" ); |
123 | Local_View->addColumn( tr("File"),130); | 146 | Local_View->addColumn( tr("File"),130); |
124 | Local_View->addColumn( tr("Size"),-1); | 147 | Local_View->addColumn( tr("Size"),-1); |
125 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 148 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
126 | Local_View->addColumn( tr("Date"),-1); | 149 | Local_View->addColumn( tr("Date"),-1); |
127 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 150 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
@@ -205,37 +228,42 @@ void AdvancedFm::init() { | |||
205 | b=FALSE; | 228 | b=FALSE; |
206 | TabWidget->setCurrentTab(0); | 229 | TabWidget->setCurrentTab(0); |
207 | 230 | ||
208 | } | 231 | } |
209 | 232 | ||
210 | void AdvancedFm::initConnections() { | 233 | void AdvancedFm::initConnections() { |
211 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 234 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
212 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | 235 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); |
213 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | 236 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); |
214 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | 237 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); |
215 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | 238 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); |
216 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 239 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
217 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 240 | connect( homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
218 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 241 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
219 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 242 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
220 | 243 | ||
221 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 244 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
222 | this,SLOT(currentPathComboChanged())); | 245 | this,SLOT(currentPathComboChanged())); |
223 | 246 | ||
224 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 247 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
225 | this,SLOT( localListClicked(QListViewItem *)) ); | 248 | this,SLOT( localListClicked(QListViewItem *)) ); |
226 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 249 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
227 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 250 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
228 | 251 | ||
229 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | 252 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); |
230 | 253 | ||
231 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 254 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
232 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 255 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
233 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 256 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
234 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 257 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
235 | 258 | ||
236 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 259 | connect( TabWidget,SIGNAL(currentChanged(QWidget *)), |
237 | this,SLOT(tabChanged(QWidget*))); | 260 | this,SLOT(tabChanged(QWidget*))); |
238 | 261 | ||
239 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | 262 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); |
240 | 263 | ||
264 | connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); | ||
265 | // connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); | ||
266 | |||
267 | // connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); | ||
268 | |||
241 | } | 269 | } |