author | llornkcor <llornkcor> | 2002-09-23 13:38:57 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-23 13:38:57 (UTC) |
commit | 7c3194a651beca5ba43bc29d87cc96b55761b7bc (patch) (unidiff) | |
tree | c2860d2c826b62ce6737681ac43c78197448931b /noncore/apps/advancedfm/advancedfmData.cpp | |
parent | cfeb1373faa2b46011ecdb294d0ce4e557ea988f (diff) | |
download | opie-7c3194a651beca5ba43bc29d87cc96b55761b7bc.zip opie-7c3194a651beca5ba43bc29d87cc96b55761b7bc.tar.gz opie-7c3194a651beca5ba43bc29d87cc96b55761b7bc.tar.bz2 |
start changing things around
Diffstat (limited to 'noncore/apps/advancedfm/advancedfmData.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 236 |
1 files changed, 236 insertions, 0 deletions
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp new file mode 100644 index 0000000..a4f4d59 --- a/dev/null +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -0,0 +1,236 @@ | |||
1 | /*************************************************************************** | ||
2 | advancedfmData.cpp | ||
3 | ------------------- | ||
4 | ** Created: Mon 09-23-2002 13:24:11 | ||
5 | copyright : (C) 2002 by ljp | ||
6 | email : ljp@llornkcor.com | ||
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 * | ||
9 | * the Free Software Foundation; either version 2 of the License, or * | ||
10 | * (at your option) any later version. * | ||
11 | ***************************************************************************/ | ||
12 | #include "advancedfm.h" | ||
13 | |||
14 | #include <qpe/qpeapplication.h> | ||
15 | #include <qpe/qpemenubar.h> | ||
16 | #include <qpe/qpetoolbar.h> | ||
17 | #include <qpe/resource.h> | ||
18 | |||
19 | #include <qlayout.h> | ||
20 | #include <qpixmap.h> | ||
21 | #include <qcombobox.h> | ||
22 | #include <qpopupmenu.h> | ||
23 | #include <qtabwidget.h> | ||
24 | #include <qtoolbutton.h> | ||
25 | #include <qtabwidget.h> | ||
26 | #include <qlineedit.h> | ||
27 | #include <qlistview.h> | ||
28 | |||
29 | #include <sys/utsname.h> | ||
30 | |||
31 | |||
32 | void AdvancedFm::init() { | ||
33 | |||
34 | setCaption( tr( "AdvancedFm" ) ); | ||
35 | |||
36 | QGridLayout *layout = new QGridLayout( this ); | ||
37 | layout->setSpacing( 2); | ||
38 | layout->setMargin( 2); | ||
39 | |||
40 | |||
41 | QPEMenuBar *menuBar = new QPEMenuBar(this); | ||
42 | fileMenu = new QPopupMenu( this ); | ||
43 | viewMenu = new QPopupMenu( this ); | ||
44 | |||
45 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); | ||
46 | |||
47 | menuBar->insertItem( tr( "File" ), fileMenu); | ||
48 | menuBar->insertItem( tr( "View" ), viewMenu); | ||
49 | |||
50 | qpeDirButton= new QToolButton(this,"QPEButton"); | ||
51 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | ||
52 | qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); | ||
53 | layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); | ||
54 | |||
55 | cfButton = new QToolButton( this,"CFButton"); | ||
56 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | ||
57 | cfButton ->setFixedSize( QSize( 20, 20 ) ); | ||
58 | layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); | ||
59 | |||
60 | sdButton = new QToolButton( this,"SDButton"); | ||
61 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); | ||
62 | sdButton->setFixedSize( QSize( 20, 20 ) ); | ||
63 | layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); | ||
64 | |||
65 | cdUpButton = new QToolButton( this,"cdUpButton"); | ||
66 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | ||
67 | cdUpButton ->setFixedSize( QSize( 20, 20 ) ); | ||
68 | layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); | ||
69 | |||
70 | docButton = new QToolButton( this,"docsButton"); | ||
71 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | ||
72 | docButton->setFixedSize( QSize( 20, 20 ) ); | ||
73 | layout->addMultiCellWidget( docButton, 0, 0, 6, 6); | ||
74 | |||
75 | homeButton = new QToolButton( this,"homeButton"); | ||
76 | homeButton->setPixmap(Resource::loadPixmap("home")); | ||
77 | homeButton->setFixedSize( QSize( 20, 20 ) ); | ||
78 | layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); | ||
79 | |||
80 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | ||
81 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | ||
82 | fileMenu->insertSeparator(); | ||
83 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | ||
84 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | ||
85 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | ||
86 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | ||
87 | fileMenu->insertSeparator(); | ||
88 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | ||
89 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | ||
90 | fileMenu->setCheckable(TRUE); | ||
91 | |||
92 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | ||
93 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | ||
94 | viewMenu->insertSeparator(); | ||
95 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | ||
96 | viewMenu->setCheckable(TRUE); | ||
97 | |||
98 | |||
99 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | ||
100 | currentPathCombo->setEditable(TRUE); | ||
101 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | ||
102 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | ||
103 | |||
104 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | ||
105 | |||
106 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | ||
107 | |||
108 | |||
109 | TabWidget = new QTabWidget( this, "TabWidget" ); | ||
110 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); | ||
111 | |||
112 | tab = new QWidget( TabWidget, "tab" ); | ||
113 | tabLayout = new QGridLayout( tab ); | ||
114 | tabLayout->setSpacing( 2); | ||
115 | tabLayout->setMargin( 2); | ||
116 | |||
117 | Local_View = new QListView( tab, "Local_View" ); | ||
118 | Local_View->addColumn( tr("File"),130); | ||
119 | Local_View->addColumn( tr("Size"),-1); | ||
120 | Local_View->setColumnAlignment(1,QListView::AlignRight); | ||
121 | Local_View->addColumn( tr("Date"),-1); | ||
122 | Local_View->setColumnAlignment(2,QListView::AlignRight); | ||
123 | Local_View->setAllColumnsShowFocus(TRUE); | ||
124 | Local_View->setMultiSelection( TRUE ); | ||
125 | Local_View->setSelectionMode(QListView::Extended); | ||
126 | |||
127 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | ||
128 | |||
129 | tabLayout->addWidget( Local_View, 0, 0 ); | ||
130 | |||
131 | TabWidget->insertTab( tab, tr("1")); | ||
132 | |||
133 | tab_2 = new QWidget( TabWidget, "tab_2" ); | ||
134 | tabLayout_2 = new QGridLayout( tab_2 ); | ||
135 | tabLayout_2->setSpacing( 2); | ||
136 | tabLayout_2->setMargin( 2); | ||
137 | |||
138 | Remote_View = new QListView( tab_2, "Remote_View" ); | ||
139 | Remote_View->addColumn( tr("File"),130); | ||
140 | Remote_View->addColumn( tr("Size"),-1); | ||
141 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | ||
142 | Remote_View->addColumn( tr("Date"),-1); | ||
143 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | ||
144 | Remote_View->setAllColumnsShowFocus(TRUE); | ||
145 | Remote_View->setMultiSelection( TRUE ); | ||
146 | Remote_View->setSelectionMode(QListView::Extended); | ||
147 | |||
148 | |||
149 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | ||
150 | |||
151 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | ||
152 | |||
153 | |||
154 | TabWidget->insertTab( tab_2, tr( "2")); | ||
155 | |||
156 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | ||
157 | tabLayout_3 = new QGridLayout( tab_3 ); | ||
158 | tabLayout_3->setSpacing( 2); | ||
159 | tabLayout_3->setMargin( 2); | ||
160 | |||
161 | |||
162 | // OFileDialog fileDialog; | ||
163 | // fileDialog; | ||
164 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | ||
165 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | ||
166 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | ||
167 | |||
168 | QListView *fileTree; | ||
169 | fileTree = new QListView( tab_3, "tree" ); | ||
170 | |||
171 | |||
172 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | ||
173 | |||
174 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | ||
175 | */ | ||
176 | |||
177 | /////////////// | ||
178 | |||
179 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | ||
180 | if (uname(&name) != -1) { | ||
181 | QString release=name.release; | ||
182 | if(release.find("embedix",0,TRUE) !=-1) { | ||
183 | zaurusDevice=TRUE; | ||
184 | } else { | ||
185 | zaurusDevice=FALSE; | ||
186 | sdButton->hide(); | ||
187 | } | ||
188 | } | ||
189 | |||
190 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | ||
191 | currentDir.setPath( QDir::currentDirPath()); | ||
192 | |||
193 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | ||
194 | currentRemoteDir.setPath( QDir::currentDirPath()); | ||
195 | |||
196 | b = TRUE; | ||
197 | |||
198 | filterStr="*"; | ||
199 | b=FALSE; | ||
200 | |||
201 | |||
202 | |||
203 | } | ||
204 | |||
205 | void AdvancedFm::initConnections() { | ||
206 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | ||
207 | connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); | ||
208 | connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); | ||
209 | connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); | ||
210 | connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); | ||
211 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | ||
212 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | ||
213 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | ||
214 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | ||
215 | |||
216 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | ||
217 | this,SLOT(currentPathComboChanged())); | ||
218 | |||
219 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | ||
220 | this,SLOT( localListClicked(QListViewItem *)) ); | ||
221 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | ||
222 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | ||
223 | |||
224 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | ||
225 | |||
226 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | ||
227 | this,SLOT( remoteListClicked(QListViewItem *)) ); | ||
228 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | ||
229 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | ||
230 | |||
231 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | ||
232 | this,SLOT(tabChanged(QWidget*))); | ||
233 | |||
234 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | ||
235 | |||
236 | } | ||