summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-24 22:41:21 (UTC)
committer llornkcor <llornkcor>2002-03-24 22:41:21 (UTC)
commitd8820a9f2bdf9bc98c99542e3613ca9b5d2c6e0c (patch) (side-by-side diff)
tree195a7cbe7f9577a118d1bc05fb028fbc010279f7
parent8cada0d43b00686567295e712f9c5c89e3977a7d (diff)
downloadopie-d8820a9f2bdf9bc98c99542e3613ca9b5d2c6e0c.zip
opie-d8820a9f2bdf9bc98c99542e3613ca9b5d2c6e0c.tar.gz
opie-d8820a9f2bdf9bc98c99542e3613ca9b5d2c6e0c.tar.bz2
added lock icons
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp14
-rw-r--r--noncore/net/opieftp/opieftp.cpp109
-rw-r--r--noncore/net/opieftp/opieftp.h12
3 files changed, 109 insertions, 26 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index 41e800c..acd50c2 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -188,28 +188,36 @@ void fileBrowser::populateList()
fileL.sprintf( "%s",fi->fileName().data() );
fileDate= fi->lastModified().toString();
if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
fileL+="/";
isDir=TRUE;
// qDebug( fileL);
}
}
if(fileL !="./") {
item= new QListViewItem( ListView,fileL,fileS , fileDate);
QPixmap pm;
pm= Resource::loadPixmap( "folder" );
- if(isDir || fileL.find("/",0,TRUE) != -1)
+
+ if(isDir || fileL.find("/",0,TRUE) != -1) {
+ if( !QDir( fi->filePath() ).isReadable())
+ pm = Resource::loadPixmap( "lockedfolder" );
item->setPixmap( 0,pm );
- else
- item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
+ } else {
+ if( !fi->isReadable() )
+ pm = Resource::loadPixmap( "locked" );
+ else
+ pm = Resource::loadPixmap( "fileopen" );
+ item->setPixmap( 0,pm);
+ }
if( fileL.find("->",0,TRUE) != -1) {
// overlay link image
QPixmap lnk = Resource::loadPixmap( "symlink" );
QPainter painter( &pm );
painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
pm.setMask( pm.createHeuristicMask( FALSE ) );
item->setPixmap( 0, pm);
}
}
isDir=FALSE;
++it;
}
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index e97a9bf..37e2134 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -13,24 +13,25 @@
#include "opieftp.h"
#include "ftplib.h"
#include "inputDialog.h"
#include <qpe/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/config.h>
+#include <qstringlist.h>
#include <qtextstream.h>
#include <qpushbutton.h>
#include <qtoolbutton.h>
#include <qdatetime.h>
#include <qdir.h>
#include <qfile.h>
#include <qstring.h>
#include <qcombobox.h>
#include <qpopupmenu.h>
#include <qlistview.h>
#include <qmainwindow.h>
#include <qlabel.h>
@@ -227,29 +228,35 @@ OpieFtp::OpieFtp( )
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
tabLayout_3->addItem( spacer, 5, 0 );
TabWidget->insertTab( tab_3, tr( "Config" ) );
connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
this,SLOT(tabChanged(QWidget*)));
currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
currentDir.setPath( QDir::currentDirPath());
// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
- currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" );
- layout->addMultiCellWidget( currentPathEdit, 3, 3, 0, 3 );
- currentPathEdit->setText( currentDir.canonicalPath());
- connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged()));
+ currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
+ layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 );
+
+ currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
+
+ connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
+ this, SLOT( currentPathComboChanged()currentPathCombo( const QString & ) ) );
+
+ connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
+ this,SLOT(currentPathComboChanged()));
ProgressBar = new QProgressBar( this, "ProgressBar" );
layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 );
// fillCombos();
#ifdef DEVELOPERS_VERSION
ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) );
UsernameComboBox->lineEdit()->setText("root");
PortSpinBox->setValue( 4242);
remotePath->setText( currentRemoteDir = "/");
// ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) );
@@ -278,31 +285,31 @@ void OpieFtp::cleanUp()
if(sfile.right(1) != "/")
sfile+="/._temp";
else
sfile+="._temp";
QFile file( sfile);
if(file.exists())
file.remove();
}
void OpieFtp::tabChanged(QWidget *w)
{
if (TabWidget->currentPageIndex() == 0) {
- currentPathEdit->setText( currentDir.canonicalPath());
+ currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
}
if (TabWidget->currentPageIndex() == 1) {
- currentPathEdit->setText( currentRemoteDir );
+ currentPathCombo->lineEdit()->setText( currentRemoteDir );
tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
}
if (TabWidget->currentPageIndex() == 2) {
tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
}
}
void OpieFtp::newConnection()
@@ -535,35 +542,55 @@ void OpieFtp::populateLocalView()
} else {
// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
fileS.sprintf( "%10li", fi->size() );
fileL.sprintf( "%s",fi->fileName().data() );
fileDate= fi->lastModified().toString();
if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
fileL+="/";
isDir=TRUE;
// qDebug( fileL);
}
}
if(fileL !="./") {
- item = new QListViewItem( Local_View,fileL,fileS, fileDate);
- if(isDir || fileL.find("/",0,TRUE) != -1)
- item->setPixmap( 0, Resource::loadPixmap( "folder" ));
- else
- item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
+ item= new QListViewItem( ListView,fileL,fileS , fileDate);
+ QPixmap pm;
+ pm= Resource::loadPixmap( "folder" );
+
+ if(isDir || fileL.find("/",0,TRUE) != -1) {
+ if( !QDir( fi->filePath() ).isReadable())
+ pm = Resource::loadPixmap( "lockedfolder" );
+ item->setPixmap( 0,pm );
+ } else {
+ if( !fi->isReadable() )
+ pm = Resource::loadPixmap( "locked" );
+ else
+ pm = Resource::loadPixmap( "fileopen" );
+ item->setPixmap( 0,pm);
+ }
+ if( fileL.find("->",0,TRUE) != -1) {
+ // overlay link image
+ QPixmap lnk = Resource::loadPixmap( "symlink" );
+ QPainter painter( &pm );
+ painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
+ pm.setMask( pm.createHeuristicMask( FALSE ) );
+ item->setPixmap( 0, pm);
+ }
}
isDir=FALSE;
++it;
- }
+ }
Local_View->setSorting( 3,FALSE);
- currentPathEdit->setText( currentDir.canonicalPath() );
+ currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() );
+ fillCombo( (const QString &)currentDir);
+
}
bool OpieFtp::populateRemoteView( )
{
// qDebug("populate remoteview");
QString sfile=QDir::homeDirPath();
if(sfile.right(1) != "/")
sfile+="/._temp";
else
sfile+="._temp";
QFile file( sfile);
Remote_View->clear();
@@ -652,25 +679,26 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
} else {
currentRemoteDir = currentRemoteDir+strItem;
}
} else {
qDebug("download "+strItem);
}
}
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
if(currentRemoteDir.right(1) !="/")
currentRemoteDir +="/";
- currentPathEdit->setText( currentRemoteDir );
+ currentPathCombo->lineEdit()->setText( currentRemoteDir );
+ fillRemoteCombo( (const QString &)currentDir);
QCopEnvelope ( "QPE/System", "notBusy()" );
}
void OpieFtp::localListClicked(QListViewItem *selectedItem)
{
QString strItem=selectedItem->text(0);
QString strSize=selectedItem->text(1);
strSize=strSize.stripWhiteSpace();
if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
// is symlink
QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
if(QDir(strItem2).exists() ) {
@@ -923,45 +951,86 @@ void OpieFtp::localRename()
fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
fileDlg->inputText = curFile;
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString oldname = currentDir.canonicalPath() + "/" + curFile;
QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
if( rename(oldname.latin1(), newName.latin1())== -1)
QMessageBox::message(tr("Note"),tr("Could not rename"));
}
populateLocalView();
}
-void OpieFtp::currentPathEditChanged()
+void OpieFtp::currentPathComboActivated(const QString & currentPath) {
+ if (TabWidget->currentPageIndex() == 0) {
+ chdir( currentPath.latin1() );
+ currentDir.cd( currentPath, TRUE);
+ populateLocalList();
+ update();
+ } else {
+// chdir( currentPath.latin1() );
+// currentDir.cd( currentPath, TRUE);
+// populateList();
+// update();
+
+ }
+}
+
+void OpieFtp::fillCombo(const QString &currentPath) {
+
+ currentPathComboBox->lineEdit()->setText(currentPath);
+ if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
+ currentPathComboBox->clear();
+ localDirPathStringList.prepend(currentPath );
+ currentPathComboBox->insertStringList( localDirPathStringList,-1);
+ }
+ currentPathComboBox->lineEdit()->setText(currentPath);
+ if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
+ currentPathComboBox->clear();
+ remoteDirPathStringList.prepend(currentPath );
+ currentPathComboBox->insertStringList( remoteDirPathStringList,-1);
+ }
+}
+
+void OpieFtp::fillRemoteCombo(const QString &currentPath) {
+
+ dirPathCombo->lineEdit()->setText(currentPath);
+ if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
+ dirPathCombo->clear();
+ remoteDirPathStringList.prepend(currentPath );
+ dirPathCombo->insertStringList( remoteDirPathStringList,-1);
+ }
+}
+
+void OpieFtp::currentPathComboChanged()
{
QString oldRemoteCurrentDir = currentRemoteDir;
// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
if (TabWidget->currentPageIndex() == 0) {
- if(QDir( currentPathEdit->text()).exists()) {
- currentDir.setPath( currentPathEdit->text() );
+ if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
+ currentDir.setPath( currentPathCombo->lineEdit()->text() );
populateLocalView();
} else {
QMessageBox::message(tr("Note"),tr("That directory does not exist"));
}
}
if (TabWidget->currentPageIndex() == 1) {
- currentRemoteDir = currentPathEdit->text();
+ currentRemoteDir = currentPathCombo->lineEdit()->text();
if(currentRemoteDir.right(1) !="/") {
currentRemoteDir = currentRemoteDir +"/";
- currentPathEdit->setText( currentRemoteDir );
+ currentPathCombo->lineEdit()->setText( currentRemoteDir );
}
if( !remoteChDir( (const QString &)currentRemoteDir) ) {
currentRemoteDir = oldRemoteCurrentDir;
- currentPathEdit->setText( currentRemoteDir );
+ currentPathCombo->lineEdit()->setText( currentRemoteDir );
}
remoteDirList( (const QString &)currentRemoteDir);
}
}
void OpieFtp::switchToLocalTab()
{
TabWidget->setCurrentPage(0);
}
void OpieFtp::switchToRemoteTab()
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h
index 52ed885..57599b7 100644
--- a/noncore/net/opieftp/opieftp.h
+++ b/noncore/net/opieftp/opieftp.h
@@ -28,38 +28,39 @@ class QListviewItem;
class QLabel;
class QProgressBar;
class QSpinBox;
class QTabWidget;
class QWidget;
class QPEToolBar;
class QPEMenuBar;
class QPopupMenu;
class QFile;
class QListViewItem;
class QLineEdit;
class QPushButton;
+class QStringList;
class OpieFtp : public QMainWindow
{
Q_OBJECT
public:
OpieFtp( );
~OpieFtp();
QTabWidget *TabWidget;
QWidget *tab, *tab_2, *tab_3;
QListView *Local_View, *Remote_View;
- QComboBox *UsernameComboBox, *ServerComboBox;
+ QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo;
QLineEdit *PasswordEdit, *remotePath, *currentPathEdit;
QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;;
QSpinBox* PortSpinBox;
QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu;
QDir currentDir;
QString currentRemoteDir;
QString filterStr;
QListViewItem * item;
QPushButton *connectServerBtn;
bool b;
int currentServerConfig;
protected slots:
@@ -83,29 +84,34 @@ protected slots:
void ListPressed( int, QListViewItem *, const QPoint&, int);
void RemoteListPressed( int, QListViewItem *, const QPoint&, int);
void localMakDir();
void localDelete();
void remoteMakDir();
void remoteDelete();
bool remoteDirList(const QString &);
bool remoteChDir(const QString &);
void tabChanged(QWidget*);
void cleanUp();
void remoteRename();
void localRename();
- void currentPathEditChanged();
+ void currentPathComboChanged();
+ void fillCombos();
+ void fillCombo(const QString &);
+ void currentPathComboActivated(const QString &);
void switchToLocalTab();
void switchToRemoteTab();
void switchToConfigTab();
- void fillCombos();
+ void fillCombo();
+ void fillRemoteCombo();
void serverComboSelected(int);
void deleteServer();
void connectorBtnToggled(bool);
protected:
+ QStringList remoteDirPathStringList, localDirPathStringList;
void nullifyCallBack();
QGridLayout* tabLayout;
QGridLayout* tabLayout_2;
QGridLayout* tabLayout_3;
};
#endif // OPIEFTP_H