-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 347 |
1 files changed, 172 insertions, 175 deletions
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index ce7da24..2997c55 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -31,80 +31,78 @@ using namespace Opie::Ui; | |||
31 | void AdvancedFm::init() { | 31 | void AdvancedFm::init() { |
32 | #if defined(QT_QWS_OPIE) | 32 | b = false; |
33 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); | 33 | setCaption( tr( "AdvancedFm" ) ); |
34 | #endif | 34 | |
35 | setCaption( tr( "AdvancedFm" ) ); | 35 | QVBoxLayout *layout = new QVBoxLayout( this ); |
36 | 36 | layout->setSpacing( 2); | |
37 | QVBoxLayout *layout = new QVBoxLayout( this ); | 37 | layout->setMargin( 0); // squeeze |
38 | layout->setSpacing( 2); | 38 | |
39 | layout->setMargin( 0); // squeeze | 39 | QMenuBar *menuBar = new QMenuBar(this); |
40 | 40 | menuBar->setMargin( 0 ); // squeeze | |
41 | QMenuBar *menuBar = new QMenuBar(this); | 41 | fileMenu = new QPopupMenu( this ); |
42 | menuBar->setMargin( 0 ); // squeeze | 42 | viewMenu = new QPopupMenu( this ); |
43 | fileMenu = new QPopupMenu( this ); | ||
44 | viewMenu = new QPopupMenu( this ); | ||
45 | // customDirMenu = new QPopupMenu( this ); | 43 | // customDirMenu = new QPopupMenu( this ); |
46 | 44 | ||
47 | layout->addWidget( menuBar ); | 45 | layout->addWidget( menuBar ); |
48 | 46 | ||
49 | menuBar->insertItem( tr( "File" ), fileMenu); | 47 | menuBar->insertItem( tr( "File" ), fileMenu); |
50 | menuBar->insertItem( tr( "View" ), viewMenu); | 48 | menuBar->insertItem( tr( "View" ), viewMenu); |
51 | 49 | ||
52 | cdUpButton = new QToolButton( 0,"cdUpButton"); | 50 | cdUpButton = new QToolButton( 0,"cdUpButton"); |
53 | cdUpButton->setPixmap(Resource::loadPixmap("up")); | 51 | cdUpButton->setPixmap(Resource::loadPixmap("up")); |
54 | cdUpButton->setAutoRaise( true ); | 52 | cdUpButton->setAutoRaise( true ); |
55 | menuBar->insertItem( cdUpButton ); | 53 | menuBar->insertItem( cdUpButton ); |
56 | 54 | ||
57 | 55 | ||
58 | 56 | ||
59 | qpeDirButton= new QToolButton( 0,"QPEButton"); | 57 | qpeDirButton= new QToolButton( 0,"QPEButton"); |
60 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); | 58 | qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); |
61 | qpeDirButton->setAutoRaise( true ); | 59 | qpeDirButton->setAutoRaise( true ); |
62 | menuBar->insertItem( qpeDirButton ); | 60 | menuBar->insertItem( qpeDirButton ); |
63 | 61 | ||
64 | cfButton = new QToolButton( 0, "CFButton"); | 62 | cfButton = new QToolButton( 0, "CFButton"); |
65 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); | 63 | cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); |
66 | cfButton->setAutoRaise( true ); | 64 | cfButton->setAutoRaise( true ); |
67 | menuBar->insertItem( cfButton ); | 65 | menuBar->insertItem( cfButton ); |
68 | 66 | ||
69 | sdButton = new QToolButton( 0, "SDButton"); | 67 | sdButton = new QToolButton( 0, "SDButton"); |
70 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); | 68 | sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); |
71 | sdButton->setAutoRaise( true ); | 69 | sdButton->setAutoRaise( true ); |
72 | menuBar->insertItem( sdButton ); | 70 | menuBar->insertItem( sdButton ); |
73 | 71 | ||
74 | docButton = new QToolButton( 0,"docsButton"); | 72 | docButton = new QToolButton( 0,"docsButton"); |
75 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); | 73 | docButton->setPixmap(Resource::loadPixmap("DocsIcon")); |
76 | docButton->setAutoRaise( true ); | 74 | docButton->setAutoRaise( true ); |
77 | menuBar->insertItem( docButton ); | 75 | menuBar->insertItem( docButton ); |
78 | 76 | ||
79 | homeButton = new QToolButton( 0, "homeButton"); | 77 | homeButton = new QToolButton( 0, "homeButton"); |
80 | homeButton->setPixmap(Resource::loadPixmap("home")); | 78 | homeButton->setPixmap(Resource::loadPixmap("home")); |
81 | homeButton->setAutoRaise( true ); | 79 | homeButton->setAutoRaise( true ); |
82 | menuBar->insertItem( homeButton ); | 80 | menuBar->insertItem( homeButton ); |
83 | 81 | ||
84 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 82 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); |
85 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 83 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
86 | fileMenu->insertSeparator(); | 84 | fileMenu->insertSeparator(); |
87 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); | 85 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); |
88 | fileMenu->insertSeparator(); | 86 | fileMenu->insertSeparator(); |
89 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 87 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
90 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 88 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
91 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 89 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
92 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 90 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
93 | fileMenu->insertSeparator(); | 91 | fileMenu->insertSeparator(); |
94 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 92 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
95 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); | 93 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); |
96 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 94 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
97 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 95 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
98 | fileMenu->setCheckable(TRUE); | 96 | fileMenu->setCheckable(TRUE); |
99 | 97 | ||
100 | viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); | 98 | viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); |
101 | viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); | 99 | viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); |
102 | // viewMenu->insertSeparator(); | 100 | // viewMenu->insertSeparator(); |
103 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 101 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
104 | viewMenu->setCheckable(true); | 102 | viewMenu->setCheckable(true); |
105 | viewMenu->setItemChecked( viewMenu->idAt(0), true); | 103 | viewMenu->setItemChecked( viewMenu->idAt(0), true); |
106 | viewMenu->setItemChecked( viewMenu->idAt(1), false); | 104 | viewMenu->setItemChecked( viewMenu->idAt(1), false); |
107 | 105 | ||
108 | s_addBookmark = tr("Bookmark Directory"); | 106 | s_addBookmark = tr("Bookmark Directory"); |
109 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); | 107 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); |
110 | 108 | ||
@@ -116,128 +114,127 @@ void AdvancedFm::init() { | |||
116 | 114 | ||
117 | QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later | 115 | QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later |
118 | CBHB->setMargin( 0 ); | 116 | CBHB->setMargin( 0 ); |
119 | CBHB->setSpacing( 1 ); | 117 | CBHB->setSpacing( 1 ); |
120 | 118 | ||
121 | menuButton = new MenuButton( this ); | 119 | menuButton = new MenuButton( this ); |
122 | 120 | ||
123 | menuButton->setUseLabel(false); | 121 | menuButton->setUseLabel(false); |
124 | menuButton->setMaximumWidth( 20 ); | 122 | menuButton->setMaximumWidth( 20 ); |
125 | menuButton->insertItem( s_addBookmark); | 123 | menuButton->insertItem( s_addBookmark); |
126 | menuButton->insertItem( s_removeBookmark); | 124 | menuButton->insertItem( s_removeBookmark); |
127 | menuButton->insertSeparator(); | 125 | menuButton->insertSeparator(); |
128 | menuButton->setFocusPolicy(NoFocus); | 126 | menuButton->setFocusPolicy(NoFocus); |
129 | CBHB->addWidget( menuButton ); | 127 | CBHB->addWidget( menuButton ); |
130 | 128 | ||
131 | customDirsToMenu(); | 129 | customDirsToMenu(); |
132 | 130 | ||
133 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | 131 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); |
134 | currentPathCombo->setEditable(TRUE); | 132 | currentPathCombo->setEditable(TRUE); |
135 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 133 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
136 | currentPathCombo->setFocusPolicy(NoFocus); | 134 | currentPathCombo->setFocusPolicy(NoFocus); |
137 | CBHB->addWidget( currentPathCombo ); | 135 | CBHB->addWidget( currentPathCombo ); |
138 | 136 | ||
139 | layout->addLayout( CBHB ); | 137 | layout->addLayout( CBHB ); |
140 | 138 | ||
141 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); | 139 | TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); |
142 | // TabWidget = new QTabWidget( this, "TabWidget" ); | 140 | // TabWidget = new QTabWidget( this, "TabWidget" ); |
143 | layout->addWidget( TabWidget, 4 ); | 141 | layout->addWidget( TabWidget, 4 ); |
144 | 142 | ||
145 | tab = new QWidget( TabWidget, "tab" ); | 143 | tab = new QWidget( TabWidget, "tab" ); |
146 | tabLayout = new QGridLayout( tab ); | 144 | tabLayout = new QGridLayout( tab ); |
147 | tabLayout->setSpacing( 2); | 145 | tabLayout->setSpacing( 2); |
148 | tabLayout->setMargin( 2); | 146 | tabLayout->setMargin( 2); |
149 | 147 | ||
150 | Local_View = new QListView( tab, "Local_View" ); | 148 | Local_View = new QListView( tab, "Local_View" ); |
151 | Local_View->addColumn( tr("File"),130); | 149 | Local_View->addColumn( tr("File"),130); |
152 | Local_View->addColumn( tr("Size"),-1); | 150 | Local_View->addColumn( tr("Size"),-1); |
153 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 151 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
154 | Local_View->addColumn( tr("Date"),-1); | 152 | Local_View->addColumn( tr("Date"),-1); |
155 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 153 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
156 | Local_View->setAllColumnsShowFocus(TRUE); | 154 | Local_View->setAllColumnsShowFocus(TRUE); |
157 | Local_View->setMultiSelection( TRUE ); | 155 | Local_View->setMultiSelection( TRUE ); |
158 | Local_View->setSelectionMode(QListView::Extended); | 156 | Local_View->setSelectionMode(QListView::Extended); |
159 | Local_View->setFocusPolicy(StrongFocus); | 157 | Local_View->setFocusPolicy(StrongFocus); |
160 | Local_View->installEventFilter( this ); | 158 | Local_View->installEventFilter( this ); |
161 | 159 | ||
162 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 160 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
163 | 161 | ||
164 | tabLayout->addWidget( Local_View, 0, 0 ); | 162 | tabLayout->addWidget( Local_View, 0, 0 ); |
165 | 163 | ||
166 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); | 164 | TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1")); |
167 | // TabWidget->insertTab( tab, tr("1")); | 165 | // TabWidget->insertTab( tab, tr("1")); |
168 | 166 | ||
169 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 167 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
170 | tabLayout_2 = new QGridLayout( tab_2 ); | 168 | tabLayout_2 = new QGridLayout( tab_2 ); |
171 | tabLayout_2->setSpacing( 2); | 169 | tabLayout_2->setSpacing( 2); |
172 | tabLayout_2->setMargin( 2); | 170 | tabLayout_2->setMargin( 2); |
173 | 171 | ||
174 | Remote_View = new QListView( tab_2, "Remote_View" ); | 172 | Remote_View = new QListView( tab_2, "Remote_View" ); |
175 | Remote_View->addColumn( tr("File"),130); | 173 | Remote_View->addColumn( tr("File"),130); |
176 | Remote_View->addColumn( tr("Size"),-1); | 174 | Remote_View->addColumn( tr("Size"),-1); |
177 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 175 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
178 | Remote_View->addColumn( tr("Date"),-1); | 176 | Remote_View->addColumn( tr("Date"),-1); |
179 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 177 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
180 | Remote_View->setAllColumnsShowFocus(TRUE); | 178 | Remote_View->setAllColumnsShowFocus(TRUE); |
181 | Remote_View->setMultiSelection( TRUE ); | 179 | Remote_View->setMultiSelection( TRUE ); |
182 | Remote_View->setSelectionMode(QListView::Extended); | 180 | Remote_View->setSelectionMode(QListView::Extended); |
183 | Remote_View->setFocusPolicy(StrongFocus); | 181 | Remote_View->setFocusPolicy(StrongFocus); |
184 | Remote_View->installEventFilter( this ); | 182 | Remote_View->installEventFilter( this ); |
185 | 183 | ||
186 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 184 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
187 | 185 | ||
188 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 186 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
189 | 187 | ||
190 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); | 188 | TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); |
191 | TabWidget->setSizeChange( 370 ); | 189 | TabWidget->setSizeChange( 370 ); |
192 | // TabWidget->insertTab( tab_2, tr( "2")); | 190 | // TabWidget->insertTab( tab_2, tr( "2")); |
193 | 191 | ||
194 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); | 192 | /* tab_3 = new QWidget( TabWidget, "tab_3" ); |
195 | tabLayout_3 = new QGridLayout( tab_3 ); | 193 | tabLayout_3 = new QGridLayout( tab_3 ); |
196 | tabLayout_3->setSpacing( 2); | 194 | tabLayout_3->setSpacing( 2); |
197 | tabLayout_3->setMargin( 2); | 195 | tabLayout_3->setMargin( 2); |
198 | 196 | ||
199 | 197 | ||
200 | // OFileDialog fileDialog; | 198 | // OFileDialog fileDialog; |
201 | // fileDialog; | 199 | // fileDialog; |
202 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy | 200 | // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy |
203 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); | 201 | // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); |
204 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); | 202 | // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); |
205 | 203 | ||
206 | QListView *fileTree; | 204 | QListView *fileTree; |
207 | fileTree = new QListView( tab_3, "tree" ); | 205 | fileTree = new QListView( tab_3, "tree" ); |
208 | 206 | ||
209 | 207 | ||
210 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); | 208 | tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); |
211 | 209 | ||
212 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); | 210 | TabWidget->insertTab( tab_3, tr( "Remote" ) ); |
213 | */ | 211 | */ |
214 | 212 | ||
215 | /////////////// | 213 | /////////////// |
216 | 214 | ||
217 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 215 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
218 | zaurusDevice=TRUE; | 216 | zaurusDevice=TRUE; |
219 | else | 217 | else |
220 | zaurusDevice=FALSE; | 218 | zaurusDevice=FALSE; |
221 | 219 | ||
222 | 220 | ||
223 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { | 221 | if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { |
224 | qDebug("not have sd"); | 222 | qDebug("not have sd"); |
225 | sdButton->hide(); | 223 | sdButton->hide(); |
226 | } | 224 | } |
227 | if( !StorageInfo::hasCf() ) { | 225 | if( !StorageInfo::hasCf() ) { |
228 | qDebug("not have cf"); | 226 | qDebug("not have cf"); |
229 | cfButton->hide(); | 227 | cfButton->hide(); |
230 | } | 228 | } |
231 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 229 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
232 | currentDir.setPath( QDir::currentDirPath()); | 230 | currentDir.setPath( QDir::currentDirPath()); |
233 | 231 | ||
234 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 232 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
235 | currentRemoteDir.setPath( QDir::currentDirPath()); | 233 | currentRemoteDir.setPath( QDir::currentDirPath()); |
236 | 234 | ||
237 | // b = TRUE; | 235 | // b = TRUE; |
238 | 236 | ||
239 | filterStr="*"; | 237 | filterStr="*"; |
240 | b=FALSE; | 238 | showMenuHidden(); |
241 | showMenuHidden(); | 239 | TabWidget->setCurrentWidget(0); |
242 | TabWidget->setCurrentWidget(0); | ||
243 | 240 | ||