summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-09-02 13:46:42 (UTC)
committer llornkcor <llornkcor>2002-09-02 13:46:42 (UTC)
commit4d7f2095e3119cac9319ab6b48492705188ce5cb (patch) (unidiff)
tree0b59cbeab8ebbdc421dabb3049895ccdb69baaca
parent4ee373ce314d6790c50861834d1c6d16f13b15f1 (diff)
downloadopie-4d7f2095e3119cac9319ab6b48492705188ce5cb.zip
opie-4d7f2095e3119cac9319ab6b48492705188ce5cb.tar.gz
opie-4d7f2095e3119cac9319ab6b48492705188ce5cb.tar.bz2
added add To Documents in menus, and cleaned up compiler warnings
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp57
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
2 files changed, 45 insertions, 13 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 0f2555d..c054465 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -135,12 +135,13 @@ AdvancedFm::AdvancedFm( )
135 fileMenu->insertSeparator(); 135 fileMenu->insertSeparator();
136 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 136 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
137 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 137 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
138 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 138 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
139 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 139 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
140 fileMenu->insertSeparator(); 140 fileMenu->insertSeparator();
141 fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
141 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 142 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
142 fileMenu->setCheckable(TRUE); 143 fileMenu->setCheckable(TRUE);
143 144
144 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 145 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
145 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 146 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
146 viewMenu->insertSeparator(); 147 viewMenu->insertSeparator();
@@ -291,13 +292,13 @@ void AdvancedFm::cleanUp()
291 sfile+="._temp"; 292 sfile+="._temp";
292 QFile file( sfile); 293 QFile file( sfile);
293 if(file.exists()) 294 if(file.exists())
294 file.remove(); 295 file.remove();
295} 296}
296 297
297void AdvancedFm::tabChanged(QWidget *w) 298void AdvancedFm::tabChanged(QWidget *)
298{ 299{
299 if (TabWidget->currentPageIndex() == 0) { 300 if (TabWidget->currentPageIndex() == 0) {
300 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 301 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
301 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); 302 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE);
302 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); 303 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE);
303 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 304 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath());
@@ -329,17 +330,17 @@ void AdvancedFm::populateLocalView()
329 QFileInfoListIterator it(*list); 330 QFileInfoListIterator it(*list);
330 QFileInfo *fi; 331 QFileInfo *fi;
331 while ( (fi=it.current()) ) { 332 while ( (fi=it.current()) ) {
332 if (fi->isSymLink() ) { 333 if (fi->isSymLink() ) {
333 QString symLink=fi->readLink(); 334 QString symLink=fi->readLink();
334 QFileInfo sym( symLink); 335 QFileInfo sym( symLink);
335 fileS.sprintf( "%10li", sym.size() ); 336 fileS.sprintf( "%10i", sym.size() );
336 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 337 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
337 fileDate = sym.lastModified().toString(); 338 fileDate = sym.lastModified().toString();
338 } else { 339 } else {
339 fileS.sprintf( "%10li", fi->size() ); 340 fileS.sprintf( "%10i", fi->size() );
340 fileL.sprintf( "%s",fi->fileName().data() ); 341 fileL.sprintf( "%s",fi->fileName().data() );
341 fileDate= fi->lastModified().toString(); 342 fileDate= fi->lastModified().toString();
342 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { 343 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) {
343 fileL+="/"; 344 fileL+="/";
344 isDir=TRUE; 345 isDir=TRUE;
345 } 346 }
@@ -428,18 +429,18 @@ void AdvancedFm::populateRemoteView()
428 QFileInfo *fi; 429 QFileInfo *fi;
429 while ( (fi=it.current()) ) { 430 while ( (fi=it.current()) ) {
430 if (fi->isSymLink() ){ 431 if (fi->isSymLink() ){
431 QString symLink=fi->readLink(); 432 QString symLink=fi->readLink();
432 // qDebug("Symlink detected "+symLink); 433 // qDebug("Symlink detected "+symLink);
433 QFileInfo sym( symLink); 434 QFileInfo sym( symLink);
434 fileS.sprintf( "%10li", sym.size() ); 435 fileS.sprintf( "%10i", sym.size() );
435 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 436 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
436 fileDate = sym.lastModified().toString(); 437 fileDate = sym.lastModified().toString();
437 } else { 438 } else {
438 // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 439 // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
439 fileS.sprintf( "%10li", fi->size() ); 440 fileS.sprintf( "%10i", fi->size() );
440 fileL.sprintf( "%s",fi->fileName().data() ); 441 fileL.sprintf( "%s",fi->fileName().data() );
441 fileDate= fi->lastModified().toString(); 442 fileDate= fi->lastModified().toString();
442 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { 443 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) {
443 fileL+="/"; 444 fileL+="/";
444 isDir=TRUE; 445 isDir=TRUE;
445 // qDebug( fileL); 446 // qDebug( fileL);
@@ -626,26 +627,26 @@ void AdvancedFm::showRemoteHidden()
626 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 627 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
627 b=FALSE; 628 b=FALSE;
628 } 629 }
629 populateRemoteView(); 630 populateRemoteView();
630} 631}
631 632
632void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 633void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int )
633{ 634{
634 qDebug("list pressed"); 635 qDebug("list pressed");
635 switch (mouse) { 636 switch (mouse) {
636 case 1: 637 case 1:
637 break; 638 break;
638 case 2: 639 case 2:
639 menuTimer.start( 750, TRUE ); 640 menuTimer.start( 750, TRUE );
640 qDebug("Start menu timer\n"); 641 qDebug("Start menu timer\n");
641 break; 642 break;
642 }; 643 };
643} 644}
644 645
645void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 646void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int )
646{ 647{
647 648
648 switch (mouse) { 649 switch (mouse) {
649 case 1: 650 case 1:
650 break; 651 break;
651 case 2: 652 case 2:
@@ -1296,13 +1297,13 @@ void AdvancedFm::copySameDir() {
1296 QFile f(destFile); 1297 QFile f(destFile);
1297 if( f.exists()) { 1298 if( f.exists()) {
1298 switch (QMessageBox::warning(this,tr("Delete"), 1299 switch (QMessageBox::warning(this,tr("Delete"),
1299 destFile+tr(" already exists\nDo you really want to delete it?"), 1300 destFile+tr(" already exists\nDo you really want to delete it?"),
1300 tr("Yes"),tr("No"),0,0,1) ) { 1301 tr("Yes"),tr("No"),0,0,1) ) {
1301 case 0: 1302 case 0:
1302 qDebug(""); 1303
1303 f.remove(); 1304 f.remove();
1304 break; 1305 break;
1305 case 1: 1306 case 1:
1306 return; 1307 return;
1307 break; 1308 break;
1308 }; 1309 };
@@ -1797,13 +1798,13 @@ void AdvancedFm::doBeam() {
1797 } 1798 }
1798 } 1799 }
1799 } 1800 }
1800 1801
1801} 1802}
1802 1803
1803void AdvancedFm::fileBeamFinished( Ir *ir) { 1804void AdvancedFm::fileBeamFinished( Ir *) {
1804 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 1805 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
1805 1806
1806} 1807}
1807 1808
1808void AdvancedFm::showFileMenu() { 1809void AdvancedFm::showFileMenu() {
1809 1810
@@ -1853,17 +1854,18 @@ void AdvancedFm::showFileMenu() {
1853 1854
1854 m->insertItem( tr( "Copy" ), this, SLOT( copy() )); 1855 m->insertItem( tr( "Copy" ), this, SLOT( copy() ));
1855 m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 1856 m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
1856 m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); 1857 m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));
1857 m->insertItem( tr( "Move" ), this, SLOT( move() )); 1858 m->insertItem( tr( "Move" ), this, SLOT( move() ));
1858 m->insertSeparator(); 1859 m->insertSeparator();
1860 m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
1859 1861
1860 if(isLocalView) 1862// if(isLocalView)
1861 m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); 1863// m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() ));
1862 else 1864// else
1863 m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); 1865// m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() ));
1864 1866
1865 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 1867 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
1866 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 1868 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
1867 m->insertSeparator(); 1869 m->insertSeparator();
1868 1870
1869 if(isLocalView) 1871 if(isLocalView)
@@ -1878,12 +1880,13 @@ void AdvancedFm::showFileMenu() {
1878 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 1880 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
1879 m->setCheckable(TRUE); 1881 m->setCheckable(TRUE);
1880 if (!b) 1882 if (!b)
1881 m->setItemChecked(m->idAt(0),TRUE); 1883 m->setItemChecked(m->idAt(0),TRUE);
1882 else 1884 else
1883 m->setItemChecked(m->idAt(0),FALSE); 1885 m->setItemChecked(m->idAt(0),FALSE);
1886
1884 if(Ir::supported()) 1887 if(Ir::supported())
1885 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); 1888 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
1886 m->setFocus(); 1889 m->setFocus();
1887 m->exec( QCursor::pos() ); 1890 m->exec( QCursor::pos() );
1888 sleep(1); 1891 sleep(1);
1889 if(m) delete m; 1892 if(m) delete m;
@@ -1912,6 +1915,34 @@ QString AdvancedFm::checkDiskSpace(const QString &path) {
1912 1915
1913 return QString::number(availBlks * mult / div); 1916 return QString::number(availBlks * mult / div);
1914 } 1917 }
1915 return ""; 1918 return "";
1916} 1919}
1917 1920
1921void AdvancedFm::addToDocs() {
1922 QStringList strListPaths = getPath();
1923 if( strListPaths.count() > 0) {
1924 QString curFile;
1925 if (TabWidget->currentPageIndex() == 0) {
1926 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
1927 curFile = currentDir.canonicalPath()+"/"+(*it);
1928 qDebug(curFile);
1929 DocLnk f;
1930// curFile.replace(QRegExp("\\..*"),"");
1931 f.setName((*it));
1932 f.setFile( curFile);
1933 f.writeLink();
1934 }
1935 } else {
1936 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
1937 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1938 qDebug(curFile);
1939
1940 DocLnk f;
1941// curFile.replace(QRegExp("\\..*"),"");
1942 f.setName((*it));
1943 f.setFile( curFile);
1944 f.writeLink();
1945 }
1946 }
1947 }
1948}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 5b714ae..53dad50 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -64,12 +64,13 @@ public:
64 QString filterStr; 64 QString filterStr;
65 QListViewItem * item; 65 QListViewItem * item;
66 bool b; 66 bool b;
67 QStringList fileSystemTypeList, fsList; 67 QStringList fileSystemTypeList, fsList;
68 int currentServerConfig; 68 int currentServerConfig;
69protected slots: 69protected slots:
70 void addToDocs();
70 void doLocalCd(); 71 void doLocalCd();
71 void doRemoteCd(); 72 void doRemoteCd();
72// void copy(); 73// void copy();
73 void mkDir(); 74 void mkDir();
74 void del(); 75 void del();
75 void rn(); 76 void rn();