diff options
Diffstat (limited to 'tdeioslave')
86 files changed, 1178 insertions, 703 deletions
diff --git a/tdeioslave/CMakeLists.txt b/tdeioslave/CMakeLists.txt index 56b05c852..5b0f0c155 100644 --- a/tdeioslave/CMakeLists.txt +++ b/tdeioslave/CMakeLists.txt @@ -23,7 +23,6 @@ add_subdirectory( nfs ) add_subdirectory( nntp ) add_subdirectory( pop3 ) add_subdirectory( smtp ) -add_subdirectory( sftp ) add_subdirectory( tar ) add_subdirectory( finger ) add_subdirectory( thumbnail ) @@ -35,3 +34,4 @@ add_subdirectory( home ) add_subdirectory( system ) tde_conditional_add_subdirectory( WITH_LDAP ldap ) tde_conditional_add_subdirectory( WITH_SAMBA smb ) +tde_conditional_add_subdirectory( WITH_SFTP sftp ) diff --git a/tdeioslave/about/tdeio_about.cpp b/tdeioslave/about/tdeio_about.cpp index f8ac109f3..6c93a094b 100644 --- a/tdeioslave/about/tdeio_about.cpp +++ b/tdeioslave/about/tdeio_about.cpp @@ -22,7 +22,7 @@ #include <stdlib.h> #include <tqstring.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <kurl.h> using namespace TDEIO; @@ -57,7 +57,7 @@ void AboutProtocol::mimetype( const KURL& ) extern "C" { - int KDE_EXPORT kdemain( int argc, char **argv ) { + int TDE_EXPORT kdemain( int argc, char **argv ) { TDEInstance instance("tdeio_about"); diff --git a/tdeioslave/cgi/cgi.cpp b/tdeioslave/cgi/cgi.cpp index 4f54d6668..c1e4ced35 100644 --- a/tdeioslave/cgi/cgi.cpp +++ b/tdeioslave/cgi/cgi.cpp @@ -23,9 +23,9 @@ #include <tqregexp.h> #include <kdebug.h> -#include <kprocess.h> -#include <kstandarddirs.h> -#include <kinstance.h> +#include <tdeprocess.h> +#include <tdestandarddirs.h> +#include <tdeinstance.h> #include <tdelocale.h> #include <tdeconfig.h> @@ -250,7 +250,7 @@ void CgiProtocol::get( const KURL& url ) kdDebug(7124) << "CgiProtocol::get - done" << endl; } -extern "C" { int KDE_EXPORT kdemain( int argc, char **argv ); } +extern "C" { int TDE_EXPORT kdemain( int argc, char **argv ); } /*! The kdemain function generates an instance of the ioslave and starts its * dispatch loop. */ diff --git a/tdeioslave/cgi/kcmcgi/kcmcgi.cpp b/tdeioslave/cgi/kcmcgi/kcmcgi.cpp index 1b36daaae..95da88415 100644 --- a/tdeioslave/cgi/kcmcgi/kcmcgi.cpp +++ b/tdeioslave/cgi/kcmcgi/kcmcgi.cpp @@ -33,7 +33,7 @@ extern "C" { - KDE_EXPORT TDECModule *create_cgi( TQWidget *parent, const char * ) + TDE_EXPORT TDECModule *create_cgi( TQWidget *parent, const char * ) { TDEGlobal::locale()->insertCatalogue("kcmcgi"); return new KCMCgi( parent, "kcmcgi" ); @@ -57,11 +57,11 @@ KCMCgi::KCMCgi(TQWidget *parent, const char *name) buttonBox->setSpacing( KDialog::spacingHint() ); mAddButton = new TQPushButton( i18n("Add..."), buttonBox ); - connect( mAddButton, TQT_SIGNAL( clicked() ), TQT_SLOT( addPath() ) ); + connect( mAddButton, TQ_SIGNAL( clicked() ), TQ_SLOT( addPath() ) ); mRemoveButton = new TQPushButton( i18n("Remove"), buttonBox ); - connect( mRemoveButton, TQT_SIGNAL( clicked() ), TQT_SLOT( removePath() ) ); - connect( mListBox, TQT_SIGNAL( clicked ( TQListBoxItem * )),this, TQT_SLOT( slotItemSelected( TQListBoxItem *))); + connect( mRemoveButton, TQ_SIGNAL( clicked() ), TQ_SLOT( removePath() ) ); + connect( mListBox, TQ_SIGNAL( clicked ( TQListBoxItem * )),this, TQ_SLOT( slotItemSelected( TQListBoxItem *))); mConfig = new TDEConfig("kcmcgirc"); diff --git a/tdeioslave/filter/filter.cpp b/tdeioslave/filter/filter.cpp index a429103e1..ff0d4ece7 100644 --- a/tdeioslave/filter/filter.cpp +++ b/tdeioslave/filter/filter.cpp @@ -25,14 +25,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <stdio.h> #include <stdlib.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <kdebug.h> #include <kmimemagic.h> #include <kfilterbase.h> #include "filter.h" -extern "C" { KDE_EXPORT int kdemain(int argc, char **argv); } +extern "C" { TDE_EXPORT int kdemain(int argc, char **argv); } int kdemain( int argc, char ** argv) { diff --git a/tdeioslave/finger/tdeio_finger.cpp b/tdeioslave/finger/tdeio_finger.cpp index 643a699f0..dd44030cf 100644 --- a/tdeioslave/finger/tdeio_finger.cpp +++ b/tdeioslave/finger/tdeio_finger.cpp @@ -28,9 +28,9 @@ #include <tqregexp.h> #include <kdebug.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdeglobal.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdelocale.h> #include <kurl.h> @@ -43,7 +43,7 @@ static const TQString defaultRefreshRate = "60"; extern "C" { - KDE_EXPORT int kdemain( int argc, char **argv ) + TDE_EXPORT int kdemain( int argc, char **argv ) { TDEInstance instance( "tdeio_finger" ); @@ -126,10 +126,10 @@ void FingerProtocol::get(const KURL& url ) << *myFingerPath << *myFingerCSSFile << refreshRate << myURL->host() << myURL->user() ; - connect(myTDEProcess, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)), - this, TQT_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); - //connect(myTDEProcess, TQT_SIGNAL(receivedStderr(TDEProcess *, char *, int)), - // this, TQT_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); + connect(myTDEProcess, TQ_SIGNAL(receivedStdout(TDEProcess *, char *, int)), + this, TQ_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); + //connect(myTDEProcess, TQ_SIGNAL(receivedStderr(TDEProcess *, char *, int)), + // this, TQ_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); myTDEProcess->start(TDEProcess::Block, TDEProcess::All); diff --git a/tdeioslave/finger/tdeio_finger.h b/tdeioslave/finger/tdeio_finger.h index 079c82305..dc0245aa2 100644 --- a/tdeioslave/finger/tdeio_finger.h +++ b/tdeioslave/finger/tdeio_finger.h @@ -24,7 +24,7 @@ #include <tqcstring.h> #include <kurl.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <tdeio/global.h> #include <tdeio/slavebase.h> diff --git a/tdeioslave/fish/CMakeLists.txt b/tdeioslave/fish/CMakeLists.txt index d7a30416b..c228c27ca 100644 --- a/tdeioslave/fish/CMakeLists.txt +++ b/tdeioslave/fish/CMakeLists.txt @@ -35,8 +35,14 @@ tde_create_translated_desktop( ##### tdeio_fish (module) ######################### add_custom_command( OUTPUT fishcode.h - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/genfishcode.pl ${CMAKE_CURRENT_SOURCE_DIR}/fish.pl > fishcode.h - DEPENDS fish.pl ) + COMMAND ${CMAKE_COMMAND} + -DMASTER_CURRENT_SOURCE_DIR:FILEPATH="${CMAKE_CURRENT_SOURCE_DIR}" + -DFISH_CODE_SOURCE:FILEPATH="fish.pl" + -DFISH_CODE_OUTPUT:FILEPATH="fishcode.h" + -P "${CMAKE_CURRENT_SOURCE_DIR}/genfishcode.cmake" + COMMENT "Generate fishcode.h" + DEPENDS fish.pl +) set_property( SOURCE fish.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/fishcode.h ) diff --git a/tdeioslave/fish/fish.cpp b/tdeioslave/fish/fish.cpp index 6f6cd93c6..70e42758b 100644 --- a/tdeioslave/fish/fish.cpp +++ b/tdeioslave/fish/fish.cpp @@ -63,9 +63,9 @@ #include <kdebug.h> #include <tdemessagebox.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdeglobal.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdelocale.h> #include <kremoteencoding.h> #include <kurl.h> @@ -124,7 +124,7 @@ static void ripper(int) } } -int KDE_EXPORT kdemain( int argc, char **argv ) +int TDE_EXPORT kdemain( int argc, char **argv ) { TDELocale::setMainCatalogue("tdeio_fish"); TDEInstance instance("fish"); diff --git a/tdeioslave/fish/fish.h b/tdeioslave/fish/fish.h index 43dd5477d..0fd2b7bf4 100644 --- a/tdeioslave/fish/fish.h +++ b/tdeioslave/fish/fish.h @@ -23,7 +23,7 @@ #include <kurl.h> #include <tdeio/global.h> #include <tdeio/slavebase.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <tdeio/authinfo.h> #include <time.h> diff --git a/tdeioslave/fish/fish.pl b/tdeioslave/fish/fish.pl index ace813bb9..ace813bb9 100755..100644 --- a/tdeioslave/fish/fish.pl +++ b/tdeioslave/fish/fish.pl diff --git a/tdeioslave/fish/genfishcode.cmake b/tdeioslave/fish/genfishcode.cmake index 9b35a51ec..e66df099b 100644 --- a/tdeioslave/fish/genfishcode.cmake +++ b/tdeioslave/fish/genfishcode.cmake @@ -1,8 +1,64 @@ -#!/bin/sh +################################################# +# +# (C) 2024 Slávek Banko +# slavek (DOT) banko (AT) axis.cz +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# -SUM=$( @MD5SUM@ @CMAKE_CURRENT_SOURCE_DIR@/fish.pl | cut -d ' ' @MD5SUM_CUT@ ) +# check and set variables +if( NOT "${MASTER_CURRENT_SOURCE_DIR}" STREQUAL "" ) + set( CMAKE_CURRENT_SOURCE_DIR "${MASTER_CURRENT_SOURCE_DIR}" ) +endif() +if( "${FISH_CODE_SOURCE}" STREQUAL "" ) + set( FISH_CODE_SOURCE "fish.pl" ) +endif() +if( "${FISH_CODE_OUTPUT}" STREQUAL "" ) + set( FISH_CODE_OUTPUT "fishcode.h" ) +endif() +if( NOT IS_ABSOLUTE ${FISH_CODE_SOURCE} ) + set( FISH_CODE_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/${FISH_CODE_SOURCE}" ) +endif() +if( NOT IS_ABSOLUTE ${FISH_CODE_OUTPUT} ) + set( FISH_CODE_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FISH_CODE_OUTPUT}" ) +endif() +if( NOT EXISTS ${FISH_CODE_SOURCE} ) + message( FATAL_ERROR "Source file ${FISH_CODE_SOURCE} not exists!" ) +endif() -#echo "#define CHECKSUM "\"$SUM\"" > fishcode.h -#echo 'static const char *fishCode(' >> fishcode.h -#sed -e 's/\\/\\\\/g;s/"/\\"/g;s/^[ ]*/"/;/^"# /d;s/[ ]*$$/\\n"/;/^"\\n"$$/d;s/{CHECKSUM}/'$$SUM'/;' @CMAKE_CURRENT_SOURCE_DIR@/fish.pl >> fishcode.h -#echo ');' >> fishcode.h +# load fish code source +file( READ ${FISH_CODE_SOURCE} _fish_code ) +string( REGEX REPLACE "[^\n]" "" _fish_len ${_fish_code} ) +string( LENGTH "+${_fish_len}" _fish_len ) +string( MD5 _fish_md5 "${_fish_code}" ) + +# prepare for C code +set( _fish_pos 0 ) +set( _fish_output "\ +#define CHECKSUM \"${_fish_md5}\" +static const char *fishCode( +") +string( REGEX REPLACE "\\\\" "\\\\\\\\" _fish_code "${_fish_code}" ) +string( REGEX REPLACE "\"" "\\\\\"" _fish_code "${_fish_code}" ) +while( _fish_pos LESS ${_fish_len} ) + # pick line + string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\1" _fish_line "${_fish_code}" ) + string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\2" _fish_code "${_fish_code}" ) + math( EXPR _fish_pos "${_fish_pos}+1" ) + + # skip comments and empty lines + string( REGEX REPLACE "^[ \t]+" "" _fish_line "${_fish_line}" ) + if( "${_fish_line}" STREQUAL "" OR "${_fish_line}" MATCHES "^# " ) + continue() + endif() + + # add line to output + set( _fish_output "${_fish_output}\"${_fish_line}\\n\"\n" ) +endwhile() +set( _fish_output "${_fish_output});\n" ) + +# write code to output file +file( WRITE ${FISH_CODE_OUTPUT} "${_fish_output}" ) diff --git a/tdeioslave/fish/genfishcode.pl b/tdeioslave/fish/genfishcode.pl deleted file mode 100755 index 60dfff8de..000000000 --- a/tdeioslave/fish/genfishcode.pl +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/perl -use strict; -use warnings; - -use Digest::MD5; - -sub md5sum { - my $filename = shift; - my $digest; - eval { - open( my $FILE, '<', $filename ) - or die "Can't find file $filename\n"; - my $ctx = Digest::MD5->new; - $ctx->addfile($FILE); - $digest = $ctx->hexdigest; - close($FILE); - }; - if ($@) { - warn $@; - } - return $digest; -} - -my $file = $ARGV[0] or die "Missing filename argument"; - -my $fish_md5 = md5sum($file) - or die "Couldn't compute MD5 for some reason\n"; -print qq{#define CHECKSUM "$fish_md5"\n}; -print qq{static const char *fishCode(\n}; - -open( my $FISH, "<", "$file" ) or die "Can't open $file\n"; -while (<$FISH>) { - chomp; - s|\\|\\\\|g; - s|"|\\"|g; - s/^\s*/"/; - next if /^"# /; - s/\s*$/\\n"/; - next if /^"\\n"$/; - print "$_\n"; -} -close($FISH); -print qq{);\n}; diff --git a/tdeioslave/floppy/tdeio_floppy.cpp b/tdeioslave/floppy/tdeio_floppy.cpp index 50303f1b7..4f9227b1e 100644 --- a/tdeioslave/floppy/tdeio_floppy.cpp +++ b/tdeioslave/floppy/tdeio_floppy.cpp @@ -42,14 +42,14 @@ #include "tdeio_floppy.h" -#include <kinstance.h> +#include <tdeinstance.h> #include <kdebug.h> #include <tdeio/global.h> #include <tdelocale.h> using namespace TDEIO; -extern "C" { KDE_EXPORT int kdemain(int argc, char **argv); } +extern "C" { TDE_EXPORT int kdemain(int argc, char **argv); } int kdemain( int argc, char **argv ) { diff --git a/tdeioslave/home/homeimpl.cpp b/tdeioslave/home/homeimpl.cpp index ea3dad520..8967e5ea4 100644 --- a/tdeioslave/home/homeimpl.cpp +++ b/tdeioslave/home/homeimpl.cpp @@ -193,8 +193,8 @@ TDEIO::UDSEntry HomeImpl::extractUrlInfos(const KURL &url) m_entryBuffer.clear(); TDEIO::StatJob *job = TDEIO::stat(url, false); - connect( job, TQT_SIGNAL( result(TDEIO::Job *) ), - this, TQT_SLOT( slotStatResult(TDEIO::Job *) ) ); + connect( job, TQ_SIGNAL( result(TDEIO::Job *) ), + this, TQ_SLOT( slotStatResult(TDEIO::Job *) ) ); tqApp->eventLoop()->enterLoop(); TDEIO::UDSEntry::iterator it = m_entryBuffer.begin(); diff --git a/tdeioslave/home/kdedmodule/homedirnotifymodule.cpp b/tdeioslave/home/kdedmodule/homedirnotifymodule.cpp index ac4e79f66..cc2dea334 100644 --- a/tdeioslave/home/kdedmodule/homedirnotifymodule.cpp +++ b/tdeioslave/home/kdedmodule/homedirnotifymodule.cpp @@ -28,7 +28,7 @@ HomeDirNotifyModule::HomeDirNotifyModule(const TQCString &obj) } extern "C" { - KDE_EXPORT KDEDModule *create_homedirnotify(const TQCString &obj) + TDE_EXPORT KDEDModule *create_homedirnotify(const TQCString &obj) { TDEGlobal::locale()->insertCatalogue("tdeio_home"); return new HomeDirNotifyModule(obj); diff --git a/tdeioslave/home/tdeio_home.cpp b/tdeioslave/home/tdeio_home.cpp index c4db91128..352fadc8e 100644 --- a/tdeioslave/home/tdeio_home.cpp +++ b/tdeioslave/home/tdeio_home.cpp @@ -38,7 +38,7 @@ static const TDECmdLineOptions options[] = }; extern "C" { - int KDE_EXPORT kdemain( int argc, char **argv ) + int TDE_EXPORT kdemain( int argc, char **argv ) { // TDEApplication is necessary to use other ioslaves putenv(strdup("SESSION_MANAGER=")); diff --git a/tdeioslave/info/info.cpp b/tdeioslave/info/info.cpp index 83b41dae8..f436ffeee 100644 --- a/tdeioslave/info/info.cpp +++ b/tdeioslave/info/info.cpp @@ -8,10 +8,10 @@ #include <tqregexp.h> #include <kdebug.h> -#include <kprocess.h> -#include <kstandarddirs.h> +#include <tdeprocess.h> +#include <tdestandarddirs.h> #include <kiconloader.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdelocale.h> #include "info.h" @@ -240,7 +240,7 @@ void InfoProtocol::stat( const KURL & ) finished(); } -extern "C" { int KDE_EXPORT kdemain( int argc, char **argv ); } +extern "C" { int TDE_EXPORT kdemain( int argc, char **argv ); } int kdemain( int argc, char **argv ) { diff --git a/tdeioslave/ldap/tdeio_ldap.cpp b/tdeioslave/ldap/tdeio_ldap.cpp index b61c2af74..61afd6b62 100644 --- a/tdeioslave/ldap/tdeio_ldap.cpp +++ b/tdeioslave/ldap/tdeio_ldap.cpp @@ -10,7 +10,7 @@ #include <netinet/in.h> #include <kdebug.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdelocale.h> #ifdef HAVE_SASL_SASL_H //prefer libsasl2 @@ -27,7 +27,7 @@ using namespace TDEIO; using namespace TDEABC; -extern "C" { int KDE_EXPORT kdemain(int argc, char **argv); } +extern "C" { int TDE_EXPORT kdemain(int argc, char **argv); } /** * The main program. diff --git a/tdeioslave/mac/tdeio_mac.cpp b/tdeioslave/mac/tdeio_mac.cpp index caef50784..fb6bed31e 100644 --- a/tdeioslave/mac/tdeio_mac.cpp +++ b/tdeioslave/mac/tdeio_mac.cpp @@ -18,7 +18,7 @@ #define PARTITION "/dev/hda11" -#include <kinstance.h> +#include <tdeinstance.h> #include <kdebug.h> #include <tdelocale.h> #include <tdeconfig.h> @@ -35,7 +35,7 @@ using namespace TDEIO; extern "C" { - int KDE_EXPORT kdemain(int, char **argv) { + int TDE_EXPORT kdemain(int, char **argv) { TDEInstance instance("tdeio_mac"); MacProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); @@ -105,8 +105,8 @@ void MacProtocol::get(const KURL& url) { *myTDEProcess << "hpcopy" << mode << path << "-"; //data is now sent directly from the slot - connect(myTDEProcess, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)), - this, TQT_SLOT(slotSetDataStdOutput(TDEProcess *, char *, int))); + connect(myTDEProcess, TQ_SIGNAL(receivedStdout(TDEProcess *, char *, int)), + this, TQ_SLOT(slotSetDataStdOutput(TDEProcess *, char *, int))); myTDEProcess->start(TDEProcess::Block, TDEProcess::All); @@ -134,8 +134,8 @@ void MacProtocol::listDir(const KURL& url) { *myTDEProcess << "hpls" << "-la" << filename; standardOutputStream = TQString::null; - connect(myTDEProcess, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)), - this, TQT_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); + connect(myTDEProcess, TQ_SIGNAL(receivedStdout(TDEProcess *, char *, int)), + this, TQ_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); myTDEProcess->start(TDEProcess::Block, TDEProcess::All); @@ -146,8 +146,8 @@ void MacProtocol::listDir(const KURL& url) { //clean up delete myTDEProcess; myTDEProcess = 0; - disconnect(myTDEProcess, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)), - this, TQT_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); + disconnect(myTDEProcess, TQ_SIGNAL(receivedStdout(TDEProcess *, char *, int)), + this, TQ_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); UDSEntry entry; if (!standardOutputStream.isEmpty()) { @@ -191,8 +191,8 @@ TQValueList<TDEIO::UDSAtom> MacProtocol::doStat(const KURL& url) { *myTDEProcess << "hpls" << "-ld" << filename; standardOutputStream = TQString::null; - connect(myTDEProcess, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)), - this, TQT_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); + connect(myTDEProcess, TQ_SIGNAL(receivedStdout(TDEProcess *, char *, int)), + this, TQ_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); myTDEProcess->start(TDEProcess::Block, TDEProcess::All); @@ -203,8 +203,8 @@ TQValueList<TDEIO::UDSAtom> MacProtocol::doStat(const KURL& url) { //clean up delete myTDEProcess; myTDEProcess = 0; - disconnect(myTDEProcess, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)), - this, TQT_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); + disconnect(myTDEProcess, TQ_SIGNAL(receivedStdout(TDEProcess *, char *, int)), + this, TQ_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); if (standardOutputStream.isEmpty()) { filename.replace("\\ ", " "); //get rid of escapes @@ -257,8 +257,8 @@ TQString MacProtocol::prepareHP(const KURL& url) { myTDEProcess = new TDEProcess(); *myTDEProcess << "hpmount"; standardOutputStream = TQString::null; - connect(myTDEProcess, TQT_SIGNAL(receivedStderr(TDEProcess *, char *, int)), - this, TQT_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); + connect(myTDEProcess, TQ_SIGNAL(receivedStderr(TDEProcess *, char *, int)), + this, TQ_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); myTDEProcess->start(TDEProcess::Block, TDEProcess::All); @@ -269,8 +269,8 @@ TQString MacProtocol::prepareHP(const KURL& url) { } delete myTDEProcess; myTDEProcess = 0; - disconnect(myTDEProcess, TQT_SIGNAL(receivedStderr(TDEProcess *, char *, int)), - this, TQT_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); + disconnect(myTDEProcess, TQ_SIGNAL(receivedStderr(TDEProcess *, char *, int)), + this, TQ_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); //now mount the drive myTDEProcess = new TDEProcess(); diff --git a/tdeioslave/mac/tdeio_mac.h b/tdeioslave/mac/tdeio_mac.h index ca4f8b95a..0a71778aa 100644 --- a/tdeioslave/mac/tdeio_mac.h +++ b/tdeioslave/mac/tdeio_mac.h @@ -19,7 +19,7 @@ #include <tdeio/slavebase.h> #include <tdeio/global.h> #include <kurl.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <tqstring.h> #include <tqcstring.h> diff --git a/tdeioslave/man/kmanpart.cpp b/tdeioslave/man/kmanpart.cpp index 556b287e4..ea0dda8ec 100644 --- a/tdeioslave/man/kmanpart.cpp +++ b/tdeioslave/man/kmanpart.cpp @@ -20,17 +20,17 @@ #include "kmanpart.h" #include <tqstring.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdeglobal.h> #include <kdebug.h> #include <tdelocale.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdeaboutdata.h> #include <tdeversion.h> extern "C" { - KDE_EXPORT void* init_libkmanpart() + TDE_EXPORT void* init_libkmanpart() { return new KManPartFactory; } @@ -95,8 +95,8 @@ bool KManPart::openFile() url.setPath( m_file ); m_job = TDEIO::get( url, true, false ); - connect( m_job, TQT_SIGNAL( data( TDEIO::Job *, const TQByteArray &) ), TQT_SLOT( readData( TDEIO::Job *, const TQByteArray &) ) ); - connect( m_job, TQT_SIGNAL( result( TDEIO::Job * ) ), TQT_SLOT( jobDone( TDEIO::Job * ) ) ); + connect( m_job, TQ_SIGNAL( data( TDEIO::Job *, const TQByteArray &) ), TQ_SLOT( readData( TDEIO::Job *, const TQByteArray &) ) ); + connect( m_job, TQ_SIGNAL( result( TDEIO::Job * ) ), TQ_SLOT( jobDone( TDEIO::Job * ) ) ); return true; } diff --git a/tdeioslave/man/man2html.cpp b/tdeioslave/man/man2html.cpp index 3f27feb68..cf3d8dc6a 100644 --- a/tdeioslave/man/man2html.cpp +++ b/tdeioslave/man/man2html.cpp @@ -774,13 +774,13 @@ static void add_links(char *c) if (g!=NULL && f>c && (g-f)<12 && (isalnum(f[-1]) || f[-1]=='>' || ( f[-1] == ';' ) ) && isdigit(f[1]) && f[1]!='0' && ((g-f)<=2 || isalpha(f[2]))) { - ok = TRUE; + ok = true; h = f+2; while (h<g) { if (!isalnum(*h++)) { - ok = FALSE; + ok = false; break; } } @@ -1075,7 +1075,7 @@ static TQCString set_font( const TQCString& name ) /// \deprecated static TQCString set_font( const char ch ) #ifndef SIMPLE_MAN2HTML - KDE_DEPRECATED; + TDE_DEPRECATED; static TQCString set_font( const char ch ) #endif diff --git a/tdeioslave/man/tdeio_man.cpp b/tdeioslave/man/tdeio_man.cpp index 13fc3b4d5..9a67b8f5c 100644 --- a/tdeioslave/man/tdeio_man.cpp +++ b/tdeioslave/man/tdeio_man.cpp @@ -32,10 +32,10 @@ #include <tqregexp.h> #include <kdebug.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdeglobal.h> -#include <kstandarddirs.h> -#include <kprocess.h> +#include <tdestandarddirs.h> +#include <tdeprocess.h> #include <tdelocale.h> #include <kmimetype.h> @@ -204,8 +204,8 @@ TQMap<TQString, TQString> MANProtocol::buildIndexMap(const TQString §ion) TDEProcess proc; proc << "whatis" << "-M" << (*it_dir) << "-w" << "*"; myStdStream = TQString::null; - connect( &proc, TQT_SIGNAL( receivedStdout(TDEProcess *, char *, int ) ), - TQT_SLOT( slotGetStdOutput( TDEProcess *, char *, int ) ) ); + connect( &proc, TQ_SIGNAL( receivedStdout(TDEProcess *, char *, int ) ), + TQ_SLOT( slotGetStdOutput( TDEProcess *, char *, int ) ) ); proc.start( TDEProcess::Block, TDEProcess::Stdout ); TQTextStream t( &myStdStream, IO_ReadOnly ); parseWhatIs( i, t, mark ); @@ -555,8 +555,8 @@ char *MANProtocol::readManPage(const char *_filename) getProgramPath(); proc << mySgml2RoffPath << filename; - TQApplication::connect(&proc, TQT_SIGNAL(receivedStdout (TDEProcess *, char *, int)), - this, TQT_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); + TQApplication::connect(&proc, TQ_SIGNAL(receivedStdout (TDEProcess *, char *, int)), + this, TQ_SLOT(slotGetStdOutput(TDEProcess *, char *, int))); proc.start(TDEProcess::Block, TDEProcess::All); const TQCString cstr=myStdStream.latin1(); @@ -589,8 +589,8 @@ char *MANProtocol::readManPage(const char *_filename) proc << "man" << "--recode" << "UTF-8" << filename; - TQApplication::connect(&proc, TQT_SIGNAL(receivedStdout (TDEProcess *, char *, int)), - this, TQT_SLOT(slotGetStdOutputUtf8(TDEProcess *, char *, int))); + TQApplication::connect(&proc, TQ_SIGNAL(receivedStdout (TDEProcess *, char *, int)), + this, TQ_SLOT(slotGetStdOutputUtf8(TDEProcess *, char *, int))); proc.start(TDEProcess::Block, TDEProcess::All); const TQCString cstr=myStdStream.utf8(); @@ -738,7 +738,7 @@ void MANProtocol::stat( const KURL& url) extern "C" { - int KDE_EXPORT kdemain( int argc, char **argv ) { + int TDE_EXPORT kdemain( int argc, char **argv ) { TDEInstance instance("tdeio_man"); @@ -1317,7 +1317,7 @@ void MANProtocol::showIndex(const TQString& section) #else /* !_USE_QSORT */ QManIndexList manpages; - manpages.setAutoDelete(TRUE); + manpages.setAutoDelete(true); #endif /* _USE_QSORT */ diff --git a/tdeioslave/media/libmediacommon/notifierserviceaction.cpp b/tdeioslave/media/libmediacommon/notifierserviceaction.cpp index c0b11043c..0888a8f40 100644 --- a/tdeioslave/media/libmediacommon/notifierserviceaction.cpp +++ b/tdeioslave/media/libmediacommon/notifierserviceaction.cpp @@ -22,8 +22,8 @@ #include <tqdir.h> #include <tqfile.h> #include <tqfileinfo.h> -#include <kstddirs.h> -#include <kdesktopfile.h> +#include <tdestandarddirs.h> +#include <tdedesktopfile.h> #include <tdelocale.h> NotifierServiceAction::NotifierServiceAction() @@ -150,7 +150,7 @@ bool NotifierServiceAction::supportsMimetype(const TQString &mimetype) const void NotifierServiceAction::save() const { TQFile::remove( m_filePath ); - KDesktopFile desktopFile(m_filePath); + TDEDesktopFile desktopFile(m_filePath); desktopFile.setGroup(TQString("Desktop Action ") + m_service.m_strName); desktopFile.writeEntry(TQString("Icon"), m_service.m_strIcon); diff --git a/tdeioslave/media/libmediacommon/notifiersettings.cpp b/tdeioslave/media/libmediacommon/notifiersettings.cpp index aaa90fefc..86e118acc 100644 --- a/tdeioslave/media/libmediacommon/notifiersettings.cpp +++ b/tdeioslave/media/libmediacommon/notifiersettings.cpp @@ -20,8 +20,8 @@ #include "notifiersettings.h" #include <tdeglobal.h> -#include <kdesktopfile.h> -#include <kstandarddirs.h> +#include <tdedesktopfile.h> +#include <tdestandarddirs.h> #include <tqdir.h> #include <tqfile.h> @@ -279,7 +279,7 @@ void NotifierSettings::save() delete a; } - KSimpleConfig config( "medianotifierrc" ); + TDESimpleConfig config( "medianotifierrc" ); config.setGroup( "Auto Actions" ); TQMap<TQString,NotifierAction*>::iterator auto_it = m_autoMimetypesMap.begin(); @@ -298,7 +298,7 @@ void NotifierSettings::save() } } -TQValueList<NotifierServiceAction*> NotifierSettings::loadActions( KDesktopFile &desktop ) const +TQValueList<NotifierServiceAction*> NotifierSettings::loadActions( TDEDesktopFile &desktop ) const { desktop.setDesktopGroup(); @@ -328,7 +328,7 @@ TQValueList<NotifierServiceAction*> NotifierSettings::loadActions( KDesktopFile } -bool NotifierSettings::shouldLoadActions( KDesktopFile &desktop, const TQString &mimetype ) const +bool NotifierSettings::shouldLoadActions( TDEDesktopFile &desktop, const TQString &mimetype ) const { desktop.setDesktopGroup(); @@ -386,7 +386,7 @@ TQValueList<NotifierServiceAction*> NotifierSettings::listServices( const TQStri { TQString filename = *dir_it + *entry_it; - KDesktopFile desktop( filename, true ); + TDEDesktopFile desktop( filename, true ); if ( shouldLoadActions(desktop, mimetype) ) { diff --git a/tdeioslave/media/libmediacommon/notifiersettings.h b/tdeioslave/media/libmediacommon/notifiersettings.h index dee5c440b..0bb033945 100644 --- a/tdeioslave/media/libmediacommon/notifiersettings.h +++ b/tdeioslave/media/libmediacommon/notifiersettings.h @@ -51,8 +51,8 @@ public: private: TQValueList<NotifierServiceAction*> listServices( const TQString &mimetype = TQString() ) const; - bool shouldLoadActions( KDesktopFile &desktop, const TQString &mimetype ) const; - TQValueList<NotifierServiceAction*> loadActions( KDesktopFile &desktop ) const; + bool shouldLoadActions( TDEDesktopFile &desktop, const TQString &mimetype ) const; + TQValueList<NotifierServiceAction*> loadActions( TDEDesktopFile &desktop ) const; TQStringList m_supportedMimetypes; TQValueList<NotifierAction*> m_actions; diff --git a/tdeioslave/media/mediaimpl.cpp b/tdeioslave/media/mediaimpl.cpp index aacbcc5e2..efa26e884 100644 --- a/tdeioslave/media/mediaimpl.cpp +++ b/tdeioslave/media/mediaimpl.cpp @@ -242,12 +242,12 @@ bool MediaImpl::ensureMediumMounted(Medium &medium) medium.deviceNode(), medium.mountPoint()); job->setAutoWarningHandlingEnabled(false); - connect( job, TQT_SIGNAL( result( TDEIO::Job * ) ), - this, TQT_SLOT( slotMountResult( TDEIO::Job * ) ) ); - connect( job, TQT_SIGNAL( warning( TDEIO::Job *, const TQString & ) ), - this, TQT_SLOT( slotWarning( TDEIO::Job *, const TQString & ) ) ); + connect( job, TQ_SIGNAL( result( TDEIO::Job * ) ), + this, TQ_SLOT( slotMountResult( TDEIO::Job * ) ) ); + connect( job, TQ_SIGNAL( warning( TDEIO::Job *, const TQString & ) ), + this, TQ_SLOT( slotWarning( TDEIO::Job *, const TQString & ) ) ); */ - kapp->dcopClient() + tdeApp->dcopClient() ->connectDCOPSignal("kded", "mediamanager", "mediumChanged(TQString, bool)", "mediaimpl", @@ -272,7 +272,7 @@ bool MediaImpl::ensureMediumMounted(Medium &medium) mp_mounting = 0L; - kapp->dcopClient() + tdeApp->dcopClient() ->disconnectDCOPSignal("kded", "mediamanager", "mediumChanged(TQString, bool)", "mediaimpl", @@ -365,10 +365,10 @@ TDEIO::UDSEntry MediaImpl::extractUrlInfos(const KURL &url) TDEIO::StatJob *job = TDEIO::stat(url, false); job->setAutoWarningHandlingEnabled( false ); - connect( job, TQT_SIGNAL( result(TDEIO::Job *) ), - this, TQT_SLOT( slotStatResult(TDEIO::Job *) ) ); - connect( job, TQT_SIGNAL( warning( TDEIO::Job *, const TQString & ) ), - this, TQT_SLOT( slotWarning( TDEIO::Job *, const TQString & ) ) ); + connect( job, TQ_SIGNAL( result(TDEIO::Job *) ), + this, TQ_SLOT( slotStatResult(TDEIO::Job *) ) ); + connect( job, TQ_SIGNAL( warning( TDEIO::Job *, const TQString & ) ), + this, TQ_SLOT( slotWarning( TDEIO::Job *, const TQString & ) ) ); tqApp->eventLoop()->enterLoop(); TDEIO::UDSEntry::iterator it = m_entryBuffer.begin(); diff --git a/tdeioslave/media/mediamanager/dialog.cpp b/tdeioslave/media/mediamanager/dialog.cpp index b2e9ff5f5..ddfd041a0 100644 --- a/tdeioslave/media/mediamanager/dialog.cpp +++ b/tdeioslave/media/mediamanager/dialog.cpp @@ -37,7 +37,7 @@ Dialog::Dialog(TQString url, TQString iconName) : TQPixmap pixmap = TDEGlobal::iconLoader()->loadIcon(iconName, TDEIcon::NoGroup, TDEIcon::SizeLarge); unlockDialog->encryptedIcon->setPixmap( pixmap ); - connect(unlockDialog->passwordEdit, TQT_SIGNAL (textChanged(const TQString &)), this, TQT_SLOT (slotPasswordChanged(const TQString &))); + connect(unlockDialog->passwordEdit, TQ_SIGNAL (textChanged(const TQString &)), this, TQ_SLOT (slotPasswordChanged(const TQString &))); setMainWidget(unlockDialog); } diff --git a/tdeioslave/media/mediamanager/fstabbackend.cpp b/tdeioslave/media/mediamanager/fstabbackend.cpp index 6549723fe..2f60dfcbf 100644 --- a/tdeioslave/media/mediamanager/fstabbackend.cpp +++ b/tdeioslave/media/mediamanager/fstabbackend.cpp @@ -43,7 +43,7 @@ #include <kdirwatch.h> #include <kurl.h> #include <kmountpoint.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #ifdef _OS_SOLARIS_ #define FSTAB "/etc/vfstab" @@ -61,8 +61,8 @@ FstabBackend::FstabBackend(MediaList &list, bool networkSharesOnly) KDirWatch::self()->addFile(MTAB); KDirWatch::self()->addFile(FSTAB); - connect( KDirWatch::self(), TQT_SIGNAL( dirty(const TQString&) ), - this, TQT_SLOT( slotDirty(const TQString&) ) ); + connect( KDirWatch::self(), TQ_SIGNAL( dirty(const TQString&) ), + this, TQ_SLOT( slotDirty(const TQString&) ) ); handleFstabChange(false); handleMtabChange(false); @@ -70,8 +70,8 @@ FstabBackend::FstabBackend(MediaList &list, bool networkSharesOnly) KDirWatch::self()->startScan(); #if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) - connect( &m_mtabTimer, TQT_SIGNAL( timeout() ), - this, TQT_SLOT( handleMtabChange() ) ); + connect( &m_mtabTimer, TQ_SIGNAL( timeout() ), + this, TQ_SLOT( handleMtabChange() ) ); m_mtabTimer.start(250); #endif } diff --git a/tdeioslave/media/mediamanager/linuxcdpolling.cpp b/tdeioslave/media/mediamanager/linuxcdpolling.cpp index 9a5a0a223..66074f40e 100644 --- a/tdeioslave/media/mediamanager/linuxcdpolling.cpp +++ b/tdeioslave/media/mediamanager/linuxcdpolling.cpp @@ -176,19 +176,19 @@ private: LinuxCDPolling::LinuxCDPolling(MediaList &list) : TQObject(), BackendBase(list) { - connect(&m_mediaList, TQT_SIGNAL(mediumAdded(const TQString &, + connect(&m_mediaList, TQ_SIGNAL(mediumAdded(const TQString &, const TQString &, bool)), - this, TQT_SLOT(slotMediumAdded(const TQString &)) ); + this, TQ_SLOT(slotMediumAdded(const TQString &)) ); - connect(&m_mediaList, TQT_SIGNAL(mediumRemoved(const TQString &, + connect(&m_mediaList, TQ_SIGNAL(mediumRemoved(const TQString &, const TQString &, bool)), - this, TQT_SLOT(slotMediumRemoved(const TQString &)) ); + this, TQ_SLOT(slotMediumRemoved(const TQString &)) ); - connect(&m_mediaList, TQT_SIGNAL(mediumStateChanged(const TQString &, + connect(&m_mediaList, TQ_SIGNAL(mediumStateChanged(const TQString &, const TQString &, bool, bool)), - this, TQT_SLOT(slotMediumStateChanged(const TQString &)) ); + this, TQ_SLOT(slotMediumStateChanged(const TQString &)) ); - connect(&m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotTimeout())); + connect(&m_timer, TQ_SIGNAL(timeout()), this, TQ_SLOT(slotTimeout())); } LinuxCDPolling::~LinuxCDPolling() diff --git a/tdeioslave/media/mediamanager/mediamanager.cpp b/tdeioslave/media/mediamanager/mediamanager.cpp index f8c2a574b..dc1671b22 100644 --- a/tdeioslave/media/mediamanager/mediamanager.cpp +++ b/tdeioslave/media/mediamanager/mediamanager.cpp @@ -26,7 +26,7 @@ #include <tdelocale.h> #include <kdirnotify_stub.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include "mediamanagersettings.h" @@ -43,15 +43,15 @@ MediaManager::MediaManager(const TQCString &obj) : KDEDModule(obj), m_dirNotify(m_mediaList) { - connect( &m_mediaList, TQT_SIGNAL(mediumAdded(const TQString&, const TQString&, bool)), - TQT_SLOT(slotMediumAdded(const TQString&, const TQString&, bool)) ); - connect( &m_mediaList, TQT_SIGNAL(mediumRemoved(const TQString&, const TQString&, bool)), - TQT_SLOT(slotMediumRemoved(const TQString&, const TQString&, bool)) ); + connect( &m_mediaList, TQ_SIGNAL(mediumAdded(const TQString&, const TQString&, bool)), + TQ_SLOT(slotMediumAdded(const TQString&, const TQString&, bool)) ); + connect( &m_mediaList, TQ_SIGNAL(mediumRemoved(const TQString&, const TQString&, bool)), + TQ_SLOT(slotMediumRemoved(const TQString&, const TQString&, bool)) ); connect( &m_mediaList, - TQT_SIGNAL(mediumStateChanged(const TQString&, const TQString&, bool, bool)), - TQT_SLOT(slotMediumChanged(const TQString&, const TQString&, bool, bool)) ); + TQ_SIGNAL(mediumStateChanged(const TQString&, const TQString&, bool, bool)), + TQ_SLOT(slotMediumChanged(const TQString&, const TQString&, bool, bool)) ); - TQTimer::singleShot( 10, this, TQT_SLOT( loadBackends() ) ); + TQTimer::singleShot( 10, this, TQ_SLOT( loadBackends() ) ); } MediaManager::~MediaManager() @@ -483,7 +483,7 @@ void MediaManager::slotMediumChanged(const TQString &/*id*/, const TQString &nam extern "C" { - KDE_EXPORT KDEDModule *create_mediamanager(const TQCString &obj) + TDE_EXPORT KDEDModule *create_mediamanager(const TQCString &obj) { TDEGlobal::locale()->insertCatalogue("tdeio_media"); return new MediaManager(obj); diff --git a/tdeioslave/media/mediamanager/removablebackend.cpp b/tdeioslave/media/mediamanager/removablebackend.cpp index dacb9b704..9e8b447f4 100644 --- a/tdeioslave/media/mediamanager/removablebackend.cpp +++ b/tdeioslave/media/mediamanager/removablebackend.cpp @@ -22,7 +22,7 @@ #include <kdirwatch.h> #include <kurl.h> #include <kmountpoint.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #ifdef _OS_SOLARIS_ #define MTAB "/etc/mnttab" @@ -37,8 +37,8 @@ RemovableBackend::RemovableBackend(MediaList &list) { KDirWatch::self()->addFile(MTAB); - connect( KDirWatch::self(), TQT_SIGNAL( dirty(const TQString&) ), - this, TQT_SLOT( slotDirty(const TQString&) ) ); + connect( KDirWatch::self(), TQ_SIGNAL( dirty(const TQString&) ), + this, TQ_SLOT( slotDirty(const TQString&) ) ); KDirWatch::self()->startScan(); } diff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp index b12aa6ea9..d26188927 100644 --- a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp +++ b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp @@ -27,13 +27,13 @@ #include <tdelocale.h> #include <tdeconfig.h> #include <tdeio/job.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <kmimetype.h> #include <kmountpoint.h> #include <tdemessagebox.h> #include <tdeapplication.h> #include <kprotocolinfo.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include "dialog.h" @@ -55,9 +55,9 @@ TDEBackend::TDEBackend(MediaList &list, TQObject* parent) TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); // Connect device monitoring signals/slots - connect(hwdevices, TQT_SIGNAL(hardwareAdded(TDEGenericDevice*)), this, TQT_SLOT(AddDeviceHandler(TDEGenericDevice*))); - connect(hwdevices, TQT_SIGNAL(hardwareRemoved(TDEGenericDevice*)), this, TQT_SLOT(RemoveDeviceHandler(TDEGenericDevice*))); - connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(ModifyDeviceHandler(TDEGenericDevice*))); + connect(hwdevices, TQ_SIGNAL(hardwareAdded(TDEGenericDevice*)), this, TQ_SLOT(AddDeviceHandler(TDEGenericDevice*))); + connect(hwdevices, TQ_SIGNAL(hardwareRemoved(TDEGenericDevice*)), this, TQ_SLOT(RemoveDeviceHandler(TDEGenericDevice*))); + connect(hwdevices, TQ_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQ_SLOT(ModifyDeviceHandler(TDEGenericDevice*))); // List devices at startup ListDevices(); @@ -771,9 +771,8 @@ void TDEBackend::setVolumeProperties(Medium* medium) diskLabel = i18n("%1 Fixed Disk (%2)").arg(sdevice->deviceFriendlySize(), sdevice->deviceNode()); } - if (sdevice->isDiskOfType(TDEDiskDeviceType::USB) - || sdevice->checkDiskStatus(TDEDiskDeviceStatus::Removable) - || sdevice->checkDiskStatus(TDEDiskDeviceStatus::Hotpluggable)) { + if (sdevice->isDiskOfType(TDEDiskDeviceType::USB) || + sdevice->checkDiskStatus(TDEDiskDeviceStatus::Removable)) { mimeType = "media/removable" + MOUNT_MEDIA_SUFFIX; if (useDefaultLabel) { diskLabel = i18n("%1 Removable Disk (%2)").arg(sdevice->deviceFriendlySize(), sdevice->deviceNode()); @@ -910,7 +909,7 @@ void TDEBackend::setCameraProperties(Medium* medium) TQString device = "camera:/"; - TQStringList devNodeList = TQStringList::split("/", sdevice->deviceNode(), TRUE); + TQStringList devNodeList = TQStringList::split("/", sdevice->deviceNode(), true); TQString devNode0 = devNodeList[devNodeList.count()-2]; TQString devNode1 = devNodeList[devNodeList.count()-1]; @@ -1035,7 +1034,7 @@ TQStringList TDEBackend::mountoptions(const TQString &name) bool removable = false; if (!drive_udi.isNull()) { - removable = ((sdevice->checkDiskStatus(TDEDiskDeviceStatus::Removable)) || (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Hotpluggable))); + removable = sdevice->checkDiskStatus(TDEDiskDeviceStatus::Removable); } TQString tmp; @@ -1235,12 +1234,12 @@ TQStringVariantMap TDEBackend::mount(const Medium *medium) data.medium = medium; TDEIO::Job *job = TDEIO::mount(false, 0, medium->deviceNode(), mountPoint); - connect(job, TQT_SIGNAL(result(TDEIO::Job*)), TQT_SLOT(slotResult(TDEIO::Job*))); + connect(job, TQ_SIGNAL(result(TDEIO::Job*)), TQ_SLOT(slotResult(TDEIO::Job*))); mount_jobs[job] = &data; // The caller expects the device to be mounted when the function // completes. Thus block until the job completes. while (!data.completed) { - kapp->eventLoop()->enterLoop(); + tdeApp->eventLoop()->enterLoop(); } if (!data.error) { result["result"] = true; @@ -1269,7 +1268,7 @@ TQStringVariantMap TDEBackend::mount(const Medium *medium) } if (diskLabel.isEmpty()) { // Try to use a pretty mount point if possible - TQStringList pieces = TQStringList::split("/", sdevice->deviceNode(), FALSE); + TQStringList pieces = TQStringList::split("/", sdevice->deviceNode(), false); TQString node = pieces[pieces.count()-1]; diskLabel = medium->label() + " (" + node + ")"; diskLabel.replace("/", "_"); @@ -1346,12 +1345,12 @@ TQStringVariantMap TDEBackend::unmount(const TQString &id) data.medium = medium; TDEIO::Job *job = TDEIO::unmount( medium->mountPoint(), false ); - connect(job, TQT_SIGNAL(result(TDEIO::Job*)), TQT_SLOT(slotResult(TDEIO::Job*))); + connect(job, TQ_SIGNAL(result(TDEIO::Job*)), TQ_SLOT(slotResult(TDEIO::Job*))); mount_jobs[job] = &data; // The caller expects the device to be unmounted when the function // completes. Thus block until the job completes. while (!data.completed) { - kapp->eventLoop()->enterLoop(); + tdeApp->eventLoop()->enterLoop(); } if (!data.error) { result["result"] = true; @@ -1683,7 +1682,7 @@ void TDEBackend::slotResult(TDEIO::Job *job) /* Job completed. Notify the caller */ data->error = job->error(); data->completed = true; - kapp->eventLoop()->exitLoop(); + tdeApp->eventLoop()->exitLoop(); } TQString TDEBackend::isInFstab(const Medium *medium) diff --git a/tdeioslave/media/medianotifier/medianotifier.cpp b/tdeioslave/media/medianotifier/medianotifier.cpp index 1e75b2501..d47ee0129 100644 --- a/tdeioslave/media/medianotifier/medianotifier.cpp +++ b/tdeioslave/media/medianotifier/medianotifier.cpp @@ -43,11 +43,11 @@ #include <tdeglobal.h> #include <kdebug.h> #include <tdelocale.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <krun.h> #include <tdemessagebox.h> #include <kstdguiitem.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include "notificationdialog.h" #include "notifiersettings.h" @@ -67,9 +67,9 @@ MediaNotifier::MediaNotifier(const TQCString &name) : KDEDModule(name) connectDCOPSignal( "kded", "mediamanager", "mediumRemoved(TQString, bool)", "onMediumRemove(TQString, bool)", true ); - m_notificationDialogList.setAutoDelete(FALSE); + m_notificationDialogList.setAutoDelete(false); m_freeTimer = new TQTimer( this ); - connect( m_freeTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( checkFreeDiskSpace() ) ); + connect( m_freeTimer, TQ_SIGNAL( timeout() ), TQ_SLOT( checkFreeDiskSpace() ) ); m_freeTimer->start( 1000*6*2 /* 20 minutes */ ); m_freeDialog = 0; } @@ -114,7 +114,7 @@ void MediaNotifier::onMediumChange( const TQString &name, bool allowNotification // in the background due to focus stealing prevention. Entering a new media can // be seen as a kind of user activity after all. It'd be better to update the timestamp // as soon as the media is entered, but it apparently takes some time to get here. - kapp->updateUserTimestamp(); + tdeApp->updateUserTimestamp(); KURL url( "system:/media/"+name ); @@ -123,8 +123,8 @@ void MediaNotifier::onMediumChange( const TQString &name, bool allowNotification m_allowNotificationMap[job] = allowNotification; - connect( job, TQT_SIGNAL( result( TDEIO::Job * ) ), - this, TQT_SLOT( slotStatResult( TDEIO::Job * ) ) ); + connect( job, TQ_SIGNAL( result( TDEIO::Job * ) ), + this, TQ_SLOT( slotStatResult( TDEIO::Job * ) ) ); } void MediaNotifier::slotStatResult( TDEIO::Job *job ) @@ -347,7 +347,7 @@ void MediaNotifier::notify( KFileItem &medium ) if ( actions.size()>1 ) { NotificationDialog* notifier = new NotificationDialog( medium, settings ); - connect(notifier, TQT_SIGNAL(destroyed(TQObject*)), this, TQT_SLOT(notificationDialogDestroyed(TQObject*))); + connect(notifier, TQ_SIGNAL(destroyed(TQObject*)), this, TQ_SLOT(notificationDialogDestroyed(TQObject*))); m_notificationDialogList.append(notifier); notifier->show(); } @@ -367,7 +367,7 @@ void MediaNotifier::notificationDialogDestroyed(TQObject* object) extern "C" { - KDE_EXPORT KDEDModule *create_medianotifier(const TQCString &name) + TDE_EXPORT KDEDModule *create_medianotifier(const TQCString &name) { TDEGlobal::locale()->insertCatalogue("kay"); return new MediaNotifier(name); @@ -407,8 +407,8 @@ void MediaNotifier::checkFreeDiskSpace() i18n("Do not ask again"), &checkboxResult, KMessageBox::Notify | KMessageBox::NoExec); m_freeDialog->show(); - connect( m_freeDialog, TQT_SIGNAL( yesClicked() ), TQT_SLOT( slotFreeContinue() ) ); - connect( m_freeDialog, TQT_SIGNAL( noClicked() ), TQT_SLOT( slotFreeCancel() ) ); + connect( m_freeDialog, TQ_SIGNAL( yesClicked() ), TQ_SLOT( slotFreeContinue() ) ); + connect( m_freeDialog, TQ_SIGNAL( noClicked() ), TQ_SLOT( slotFreeCancel() ) ); } } } diff --git a/tdeioslave/media/medianotifier/notificationdialog.cpp b/tdeioslave/media/medianotifier/notificationdialog.cpp index fc6d87647..0859e2e5e 100644 --- a/tdeioslave/media/medianotifier/notificationdialog.cpp +++ b/tdeioslave/media/medianotifier/notificationdialog.cpp @@ -26,7 +26,7 @@ #include <krun.h> #include <tdelocale.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdeio/global.h> #include <tdelistbox.h> #include <tqlabel.h> @@ -71,17 +71,17 @@ NotificationDialog::NotificationDialog( KFileItem medium, NotifierSettings *sett setButtonText( User1, i18n("Configure...") ); - connect( m_actionWatcher, TQT_SIGNAL( dirty( const TQString & ) ), - this, TQT_SLOT( slotActionsChanged( const TQString & ) ) ); - connect( this , TQT_SIGNAL( okClicked() ), - this, TQT_SLOT( slotOk() ) ); - connect( this, TQT_SIGNAL( user1Clicked() ), - this, TQT_SLOT( slotConfigure() ) ); - connect( m_view->actionsList, TQT_SIGNAL( doubleClicked ( TQListBoxItem*, const TQPoint & ) ), - this, TQT_SLOT( slotOk() ) ); - - connect( this, TQT_SIGNAL( finished() ), - this, TQT_SLOT( delayedDestruct() ) ); + connect( m_actionWatcher, TQ_SIGNAL( dirty( const TQString & ) ), + this, TQ_SLOT( slotActionsChanged( const TQString & ) ) ); + connect( this , TQ_SIGNAL( okClicked() ), + this, TQ_SLOT( slotOk() ) ); + connect( this, TQ_SIGNAL( user1Clicked() ), + this, TQ_SLOT( slotConfigure() ) ); + connect( m_view->actionsList, TQ_SIGNAL( doubleClicked ( TQListBoxItem*, const TQPoint & ) ), + this, TQ_SLOT( slotOk() ) ); + + connect( this, TQ_SIGNAL( finished() ), + this, TQ_SLOT( delayedDestruct() ) ); m_actionWatcher->startScan(); TQPushButton * btn = actionButton( Ok ); diff --git a/tdeioslave/media/mounthelper/dialog.cpp b/tdeioslave/media/mounthelper/dialog.cpp index d16c6d974..a257ca6d8 100644 --- a/tdeioslave/media/mounthelper/dialog.cpp +++ b/tdeioslave/media/mounthelper/dialog.cpp @@ -36,7 +36,7 @@ Dialog::Dialog(TQString url, TQString iconName) : TQPixmap pixmap = TDEGlobal::iconLoader()->loadIcon(iconName, TDEIcon::NoGroup, TDEIcon::SizeLarge); unlockDialog->encryptedIcon->setPixmap( pixmap ); - connect(unlockDialog->passwordEdit, TQT_SIGNAL (textChanged(const TQString &)), this, TQT_SLOT (slotPasswordChanged(const TQString &))); + connect(unlockDialog->passwordEdit, TQ_SIGNAL (textChanged(const TQString &)), this, TQ_SLOT (slotPasswordChanged(const TQString &))); setMainWidget(unlockDialog); } diff --git a/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp b/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp index 9094b8e56..a68759d3b 100644 --- a/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp +++ b/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp @@ -34,7 +34,7 @@ #include <stdlib.h> #include <kdebug.h> #include <tdeglobal.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <tdestartupinfo.h> #include <kmimetype.h> #ifdef WITH_TDEHWLIB @@ -50,7 +50,7 @@ const Medium MountHelper::findMedium(const TQString &device) DCOPReply reply = mediamanager.call("properties", device); if (!reply.isValid()) { - m_errorStr = i18n("The TDE mediamanager is not running.\n"); + m_errorStr = i18n("The TDE mediamanager is not running."); return Medium(TQString::null, TQString::null, TQString::null); } const Medium &medium = Medium::create(reply); @@ -102,8 +102,8 @@ void MountHelper::unlock(const Medium &medium) } m_mediumId = medium.id(); m_dialog = new Dialog(device, iconName); - connect(m_dialog, TQT_SIGNAL(user1Clicked()), this, TQT_SLOT(slotSendPassword())); - connect(m_dialog, TQT_SIGNAL(cancelClicked()), this, TQT_SLOT(slotCancel())); + connect(m_dialog, TQ_SIGNAL(user1Clicked()), this, TQ_SLOT(slotSendPassword())); + connect(m_dialog, TQ_SIGNAL(cancelClicked()), this, TQ_SLOT(slotCancel())); m_dialog->show(); } @@ -143,10 +143,10 @@ void MountHelper::eject(const Medium &medium) #endif // Otherwise fall back to tdeeject - TDEProcess *proc = new TDEProcess(TQT_TQOBJECT(this)); + TDEProcess *proc = new TDEProcess(this); *proc << "tdeeject"; *proc << medium.deviceNode(); - connect(proc, TQT_SIGNAL(processExited(TDEProcess*)), this, TQT_SLOT(ejectFinished(TDEProcess*))); + connect(proc, TQ_SIGNAL(processExited(TDEProcess*)), this, TQ_SLOT(ejectFinished(TDEProcess*))); proc->start(); } diff --git a/tdeioslave/media/propsdlgplugin/propertiespage.cpp b/tdeioslave/media/propsdlgplugin/propertiespage.cpp index 5b54c8c5a..57fff8573 100644 --- a/tdeioslave/media/propsdlgplugin/propertiespage.cpp +++ b/tdeioslave/media/propsdlgplugin/propertiespage.cpp @@ -64,43 +64,43 @@ PropertiesPage::PropertiesPage(TQWidget* parent, const TQString &_id) option_ro->hide(); else option_ro->setChecked(options["ro"] == "true"); - connect( option_ro, TQT_SIGNAL( stateChanged(int) ), TQT_SIGNAL( changed() ) ); + connect( option_ro, TQ_SIGNAL( stateChanged(int) ), TQ_SIGNAL( changed() ) ); if (!options.contains("quiet")) option_quiet->hide(); else option_quiet->setChecked(options["quiet"] == "true"); - connect( option_quiet, TQT_SIGNAL( stateChanged(int) ), TQT_SIGNAL( changed() ) ); + connect( option_quiet, TQ_SIGNAL( stateChanged(int) ), TQ_SIGNAL( changed() ) ); if (!options.contains("sync")) option_sync->hide(); else option_sync->setChecked(options["sync"] == "true"); - connect( option_sync, TQT_SIGNAL( stateChanged(int) ), TQT_SIGNAL( changed() ) ); + connect( option_sync, TQ_SIGNAL( stateChanged(int) ), TQ_SIGNAL( changed() ) ); if (!options.contains("atime")) option_atime->hide(); else option_atime->setChecked(options["atime"] == "true"); - connect( option_atime, TQT_SIGNAL( stateChanged(int) ), TQT_SIGNAL( changed() ) ); + connect( option_atime, TQ_SIGNAL( stateChanged(int) ), TQ_SIGNAL( changed() ) ); if (!options.contains("flush")) option_flush->hide(); else option_flush->setChecked(options["flush"] == "true"); - connect( option_flush, TQT_SIGNAL( stateChanged(int) ), TQT_SIGNAL( changed() ) ); + connect( option_flush, TQ_SIGNAL( stateChanged(int) ), TQ_SIGNAL( changed() ) ); if (!options.contains("utf8")) option_utf8->hide(); else option_utf8->setChecked(options["utf8"] == "true"); - connect( option_utf8, TQT_SIGNAL( stateChanged(int) ), TQT_SIGNAL( changed() ) ); + connect( option_utf8, TQ_SIGNAL( stateChanged(int) ), TQ_SIGNAL( changed() ) ); if (!options.contains("uid")) option_uid->hide(); else option_uid->setChecked(options["uid"] == "true"); - connect( option_uid, TQT_SIGNAL( stateChanged(int) ), TQT_SIGNAL( changed() ) ); + connect( option_uid, TQ_SIGNAL( stateChanged(int) ), TQ_SIGNAL( changed() ) ); if (!options.contains("shortname")) { @@ -115,7 +115,7 @@ PropertiesPage::PropertiesPage(TQWidget* parent, const TQString &_id) option_shortname->setCurrentItem(index); break; } - connect( option_shortname, TQT_SIGNAL( activated(int) ), TQT_SIGNAL( changed() ) ); + connect( option_shortname, TQ_SIGNAL( activated(int) ), TQ_SIGNAL( changed() ) ); } if (!options.contains("journaling")) @@ -131,14 +131,14 @@ PropertiesPage::PropertiesPage(TQWidget* parent, const TQString &_id) option_journaling->setCurrentItem(index); break; } - connect( option_journaling, TQT_SIGNAL( activated(int) ), TQT_SIGNAL( changed() ) ); + connect( option_journaling, TQ_SIGNAL( activated(int) ), TQ_SIGNAL( changed() ) ); } label_filesystem->setText(i18n("Filesystem: %1").arg(options["filesystem"])); option_mountpoint->setText(options["mountpoint"]); - connect( option_mountpoint, TQT_SIGNAL( textChanged( const TQString &) ), TQT_SIGNAL( changed() ) ); + connect( option_mountpoint, TQ_SIGNAL( textChanged( const TQString &) ), TQ_SIGNAL( changed() ) ); option_automount->setChecked(options["automount"] == "true"); - connect( option_automount, TQT_SIGNAL( stateChanged(int) ), TQT_SIGNAL( changed() ) ); + connect( option_automount, TQ_SIGNAL( stateChanged(int) ), TQ_SIGNAL( changed() ) ); bool has_groupbox_specific = true; if (!options.contains("journaling") && @@ -152,11 +152,11 @@ PropertiesPage::PropertiesPage(TQWidget* parent, const TQString &_id) // The order is important - we want groupboxes to hide automatically depending on use_defaults // but don't want to emit changed() until user actually changes something. - connect( option_defaults, TQT_SIGNAL( toggled(bool) ), groupbox_generic, SLOT( setHidden(bool) ) ); + connect( option_defaults, TQ_SIGNAL( toggled(bool) ), groupbox_generic, TQ_SLOT( setHidden(bool) ) ); if (has_groupbox_specific) - connect( option_defaults, TQT_SIGNAL( toggled(bool) ), groupbox_specific, SLOT( setHidden(bool) ) ); + connect( option_defaults, TQ_SIGNAL( toggled(bool) ), groupbox_specific, TQ_SLOT( setHidden(bool) ) ); option_defaults->setChecked(options["use_defaults"] == "true"); - connect( option_defaults, TQT_SIGNAL( stateChanged(int) ), TQT_SIGNAL( changed() ) ); + connect( option_defaults, TQ_SIGNAL( stateChanged(int) ), TQ_SIGNAL( changed() ) ); } else { diff --git a/tdeioslave/media/propsdlgplugin/propertiespagegui.ui b/tdeioslave/media/propsdlgplugin/propertiespagegui.ui index 2a6ff899e..5d461b406 100644 --- a/tdeioslave/media/propsdlgplugin/propertiespagegui.ui +++ b/tdeioslave/media/propsdlgplugin/propertiespagegui.ui @@ -372,12 +372,12 @@ Display the short name as is; store a long name when the short name is not all u <variables> <variable>bool m_hasChanged;</variable> </variables> -<Q_SIGNALS> +<signals> <signal>changed()</signal> -</Q_SIGNALS> -<Q_SLOTS> +</signals> +<slots> <slot access="protected">changedSlot()</slot> -</Q_SLOTS> +</slots> <functions> <function returnType="bool">hasChanged()</function> </functions> diff --git a/tdeioslave/media/propsdlgplugin/propsdlgshareplugin.cpp b/tdeioslave/media/propsdlgplugin/propsdlgshareplugin.cpp index ea830d2e1..f89e8a20a 100644 --- a/tdeioslave/media/propsdlgplugin/propsdlgshareplugin.cpp +++ b/tdeioslave/media/propsdlgplugin/propsdlgshareplugin.cpp @@ -28,8 +28,8 @@ #include <kpushbutton.h> #include <tdefileshare.h> #include <tdemessagebox.h> -#include <kprocess.h> -#include <kstandarddirs.h> +#include <tdeprocess.h> +#include <tdestandarddirs.h> #include <kdialog.h> #include <tdeglobal.h> #include <dcopref.h> @@ -70,10 +70,10 @@ PropsDlgSharePlugin::PropsDlgSharePlugin( KPropertiesDialog *dlg, d = new Private(); d->page = new PropertiesPage(vbox, Medium::create(reply).id()); - connect(d->page, TQT_SIGNAL(changed()), - TQT_SLOT(slotChanged())); + connect(d->page, TQ_SIGNAL(changed()), + TQ_SLOT(slotChanged())); - // TQTimer::singleShot(100, this, TQT_SLOT(slotChanged())); + // TQTimer::singleShot(100, this, TQ_SLOT(slotChanged())); } diff --git a/tdeioslave/media/tdecmodule/main.cpp b/tdeioslave/media/tdecmodule/main.cpp index e2d367e7d..dabac39aa 100644 --- a/tdeioslave/media/tdecmodule/main.cpp +++ b/tdeioslave/media/tdecmodule/main.cpp @@ -49,13 +49,13 @@ MediaModule::MediaModule( TQWidget *parent, const char *name, const TQStringList m_notifierModule = new NotifierModule( this, "notifier" ); tab->addTab( m_notifierModule, i18n( "&Notifications" ) ); - connect( m_notifierModule, TQT_SIGNAL( changed( bool ) ), - this, TQT_SLOT( moduleChanged( bool ) ) ); + connect( m_notifierModule, TQ_SIGNAL( changed( bool ) ), + this, TQ_SLOT( moduleChanged( bool ) ) ); m_managerModule = new ManagerModule( this, "manager" ); tab->addTab( m_managerModule, i18n( "&Advanced" ) ); - connect( m_managerModule, TQT_SIGNAL( changed( bool ) ), - this, TQT_SLOT( moduleChanged( bool ) ) ); + connect( m_managerModule, TQ_SIGNAL( changed( bool ) ), + this, TQ_SLOT( moduleChanged( bool ) ) ); diff --git a/tdeioslave/media/tdecmodule/managermodule.cpp b/tdeioslave/media/tdecmodule/managermodule.cpp index 9a443e551..03a5ea500 100644 --- a/tdeioslave/media/tdecmodule/managermodule.cpp +++ b/tdeioslave/media/tdecmodule/managermodule.cpp @@ -51,16 +51,16 @@ ManagerModule::ManagerModule( TQWidget* parent, const char* name ) #endif view->kcfg_CdPollingEnabled->setEnabled( false ); - connect( view->option_automount, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); - connect( view->option_ro, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); - connect( view->option_quiet, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); - connect( view->option_flush, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); - connect( view->option_uid, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); - connect( view->option_utf8, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); - connect( view->option_sync, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); - connect( view->option_atime, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) ); - connect( view->option_shortname, SIGNAL( activated(int) ), this, SLOT( emitChanged() ) ); - connect( view->option_journaling, SIGNAL( activated(int) ), this, SLOT( emitChanged() ) ); + connect( view->option_automount, TQ_SIGNAL( stateChanged(int) ), this, TQ_SLOT( emitChanged() ) ); + connect( view->option_ro, TQ_SIGNAL( stateChanged(int) ), this, TQ_SLOT( emitChanged() ) ); + connect( view->option_quiet, TQ_SIGNAL( stateChanged(int) ), this, TQ_SLOT( emitChanged() ) ); + connect( view->option_flush, TQ_SIGNAL( stateChanged(int) ), this, TQ_SLOT( emitChanged() ) ); + connect( view->option_uid, TQ_SIGNAL( stateChanged(int) ), this, TQ_SLOT( emitChanged() ) ); + connect( view->option_utf8, TQ_SIGNAL( stateChanged(int) ), this, TQ_SLOT( emitChanged() ) ); + connect( view->option_sync, TQ_SIGNAL( stateChanged(int) ), this, TQ_SLOT( emitChanged() ) ); + connect( view->option_atime, TQ_SIGNAL( stateChanged(int) ), this, TQ_SLOT( emitChanged() ) ); + connect( view->option_shortname, TQ_SIGNAL( activated(int) ), this, TQ_SLOT( emitChanged() ) ); + connect( view->option_journaling, TQ_SIGNAL( activated(int) ), this, TQ_SLOT( emitChanged() ) ); load(); } diff --git a/tdeioslave/media/tdecmodule/notifiermodule.cpp b/tdeioslave/media/tdecmodule/notifiermodule.cpp index 4364d93ad..edce1789d 100644 --- a/tdeioslave/media/tdecmodule/notifiermodule.cpp +++ b/tdeioslave/media/tdecmodule/notifiermodule.cpp @@ -57,18 +57,18 @@ NotifierModule::NotifierModule(TQWidget *parent, const char *name) updateListBox(); - connect( m_view->mimetypesCombo, TQT_SIGNAL( activated(int) ), - this, TQT_SLOT( slotMimeTypeChanged(int) ) ); - connect( m_view->actionsList, TQT_SIGNAL( selectionChanged(TQListBoxItem*) ), - this, TQT_SLOT( slotActionSelected(TQListBoxItem*) ) ); - connect( m_view->addButton, TQT_SIGNAL( clicked() ), - this, TQT_SLOT( slotAdd() ) ); - connect( m_view->editButton, TQT_SIGNAL( clicked() ), - this, TQT_SLOT( slotEdit() ) ); - connect( m_view->deleteButton, TQT_SIGNAL( clicked() ), - this, TQT_SLOT( slotDelete() ) ); - connect( m_view->toggleAutoButton, TQT_SIGNAL( clicked() ), - this, TQT_SLOT( slotToggleAuto() ) ); + connect( m_view->mimetypesCombo, TQ_SIGNAL( activated(int) ), + this, TQ_SLOT( slotMimeTypeChanged(int) ) ); + connect( m_view->actionsList, TQ_SIGNAL( selectionChanged(TQListBoxItem*) ), + this, TQ_SLOT( slotActionSelected(TQListBoxItem*) ) ); + connect( m_view->addButton, TQ_SIGNAL( clicked() ), + this, TQ_SLOT( slotAdd() ) ); + connect( m_view->editButton, TQ_SIGNAL( clicked() ), + this, TQ_SLOT( slotEdit() ) ); + connect( m_view->deleteButton, TQ_SIGNAL( clicked() ), + this, TQ_SLOT( slotDelete() ) ); + connect( m_view->toggleAutoButton, TQ_SIGNAL( clicked() ), + this, TQ_SLOT( slotToggleAuto() ) ); } NotifierModule::~NotifierModule() @@ -129,7 +129,7 @@ void NotifierModule::slotActionSelected(TQListBoxItem *item) bool isWritable = action!=0L && action->isWritable(); m_view->deleteButton->setEnabled( isWritable ); m_view->editButton->setEnabled( isWritable ); - m_view->addButton->setEnabled( TRUE ); + m_view->addButton->setEnabled( true ); m_view->toggleAutoButton->setEnabled( action!=0L && !m_mimetype.isEmpty() ); } diff --git a/tdeioslave/media/tdecmodule/serviceconfigdialog.cpp b/tdeioslave/media/tdecmodule/serviceconfigdialog.cpp index 4147e437c..bcf533b9d 100644 --- a/tdeioslave/media/tdecmodule/serviceconfigdialog.cpp +++ b/tdeioslave/media/tdecmodule/serviceconfigdialog.cpp @@ -78,10 +78,10 @@ ServiceConfigDialog::ServiceConfigDialog(NotifierServiceAction *action, setMainWidget(m_view); setCaption( m_action->label() ); - connect( m_view->iconButton, TQT_SIGNAL( iconChanged(TQString) ), - this, TQT_SLOT( slotIconChanged() ) ); - connect( m_view->commandButton, TQT_SIGNAL( clicked() ), - this, TQT_SLOT( slotCommand() ) ); + connect( m_view->iconButton, TQ_SIGNAL( iconChanged(TQString) ), + this, TQ_SLOT( slotIconChanged() ) ); + connect( m_view->commandButton, TQ_SIGNAL( clicked() ), + this, TQ_SLOT( slotCommand() ) ); } bool operator==( KDEDesktopMimeType::Service s1, KDEDesktopMimeType::Service s2 ) diff --git a/tdeioslave/media/tdeio_media.cpp b/tdeioslave/media/tdeio_media.cpp index 9124568c1..33bc4a05b 100644 --- a/tdeioslave/media/tdeio_media.cpp +++ b/tdeioslave/media/tdeio_media.cpp @@ -40,7 +40,7 @@ static const TDECmdLineOptions options[] = }; extern "C" { - int KDE_EXPORT kdemain( int argc, char **argv ) + int TDE_EXPORT kdemain( int argc, char **argv ) { // TDEApplication is necessary to use other ioslaves putenv(strdup("SESSION_MANAGER=")); @@ -62,8 +62,8 @@ MediaProtocol::MediaProtocol(const TQCString &protocol, const TQCString &pool, const TQCString &app) : ForwardingSlaveBase(protocol, pool, app) { - connect( &m_impl, TQT_SIGNAL( warning( const TQString & ) ), - this, TQT_SLOT( slotWarning( const TQString & ) ) ); + connect( &m_impl, TQ_SIGNAL( warning( const TQString & ) ), + this, TQ_SLOT( slotWarning( const TQString & ) ) ); } MediaProtocol::~MediaProtocol() diff --git a/tdeioslave/nfs/tdeio_nfs.cpp b/tdeioslave/nfs/tdeio_nfs.cpp index e2908f815..b29c66681 100644 --- a/tdeioslave/nfs/tdeio_nfs.cpp +++ b/tdeioslave/nfs/tdeio_nfs.cpp @@ -49,7 +49,7 @@ #include <tqdir.h> #include <kdebug.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdelocale.h> #include <tdeio/global.h> @@ -109,7 +109,7 @@ int x_getdomainname(char *name, size_t len) //#endif -extern "C" { int KDE_EXPORT kdemain(int argc, char **argv); } +extern "C" { int TDE_EXPORT kdemain(int argc, char **argv); } int kdemain( int argc, char **argv ) { @@ -135,9 +135,9 @@ static bool isRoot(const TQString& path) static bool isAbsoluteLink(const TQString& path) { //hmm, don't know - if (path.isEmpty()) return TRUE; - if (path[0]=='/') return TRUE; - return FALSE; + if (path.isEmpty()) return true; + if (path[0]=='/') return true; + return false; } static void createVirtualDirEntry(UDSEntry & entry) @@ -190,14 +190,14 @@ static TQString removeFirstPart(const TQString& path) } NFSFileHandle::NFSFileHandle() -:m_isInvalid(FALSE) +:m_isInvalid(false) { memset(m_handle,'\0',NFS_FHSIZE+1); // m_detectTime=time(0); } NFSFileHandle::NFSFileHandle(const NFSFileHandle & handle) -:m_isInvalid(FALSE) +:m_isInvalid(false) { m_handle[NFS_FHSIZE]='\0'; memcpy(m_handle,handle.m_handle,NFS_FHSIZE); @@ -220,11 +220,11 @@ NFSFileHandle& NFSFileHandle::operator= (const char* src) { if (src==0) { - m_isInvalid=TRUE; + m_isInvalid=true; return *this; }; memcpy(m_handle,src,NFS_FHSIZE); - m_isInvalid=FALSE; + m_isInvalid=false; // m_detectTime=time(0); return *this; } @@ -455,7 +455,7 @@ void NFSProtocol::openConnection() if (!checkForError(clnt_stat, 0, m_currentHost.latin1())) return; fhstatus fhStatus; - bool atLeastOnceSucceeded(FALSE); + bool atLeastOnceSucceeded(false); for(; exportlist!=0;exportlist = exportlist->ex_next) { kdDebug(7121) << "found export: " << exportlist->ex_dir << endl; @@ -463,7 +463,7 @@ void NFSProtocol::openConnection() clnt_stat = clnt_call(m_client, MOUNTPROC_MNT,(xdrproc_t) xdr_dirpath, (char*)(&(exportlist->ex_dir)), (xdrproc_t) xdr_fhstatus,(char*) &fhStatus,total_timeout); if (fhStatus.fhs_status==0) { - atLeastOnceSucceeded=TRUE; + atLeastOnceSucceeded=true; NFSFileHandle fh; fh=fhStatus.fhstatus_u.fhs_fhandle; TQString fname; @@ -1018,7 +1018,7 @@ bool NFSProtocol::checkForError(int clientStat, int nfsStat, const TQString& tex kdDebug(7121)<<"rpc error: "<<clientStat<<endl; //does this mapping make sense ? error(ERR_CONNECTION_BROKEN,i18n("An RPC error occurred.")); - return FALSE; + return false; } if (nfsStat!=NFS_OK) { @@ -1083,9 +1083,9 @@ bool NFSProtocol::checkForError(int clientStat, int nfsStat, const TQString& tex error(ERR_UNKNOWN,text); break; } - return FALSE; + return false; } - return TRUE; + return true; } void NFSProtocol::del( const KURL& url, bool isfile) @@ -1585,7 +1585,7 @@ void NFSProtocol::symlink( const TQString &target, const KURL &dest, bool ) bool NFSProtocol::isValidLink(const TQString& parentDir, const TQString& linkDest) { kdDebug(7121)<<"isValidLink: parent: "<<parentDir<<" link: "<<linkDest<<endl; - if (linkDest.isEmpty()) return FALSE; + if (linkDest.isEmpty()) return false; if (isAbsoluteLink(linkDest)) { kdDebug(7121)<<"is an absolute link"<<endl; @@ -1601,7 +1601,7 @@ bool NFSProtocol::isValidLink(const TQString& parentDir, const TQString& linkDes absDest=TQDir::cleanDirPath(absDest); kdDebug(7121)<<"simplified to "<<absDest<<endl; if (absDest.find("../")==0) - return FALSE; + return false; kdDebug(7121)<<"is inside the nfs tree"<<endl; absDest=parentDir+"/"+linkDest; @@ -1610,6 +1610,6 @@ bool NFSProtocol::isValidLink(const TQString& parentDir, const TQString& linkDes NFSFileHandle fh=getFileHandle(absDest); return (!fh.isInvalid()); } - return FALSE; + return false; } diff --git a/tdeioslave/nfs/tdeio_nfs.h b/tdeioslave/nfs/tdeio_nfs.h index 0930924a2..d71c57329 100644 --- a/tdeioslave/nfs/tdeio_nfs.h +++ b/tdeioslave/nfs/tdeio_nfs.h @@ -45,7 +45,7 @@ class NFSFileHandle NFSFileHandle& operator= (const char* src); operator const char* () const {return m_handle;} bool isInvalid() const {return m_isInvalid;} - void setInvalid() {m_isInvalid=TRUE;} + void setInvalid() {m_isInvalid=true;} // time_t age() const; protected: char m_handle[NFS_FHSIZE+1]; diff --git a/tdeioslave/nntp/nntp.cpp b/tdeioslave/nntp/nntp.cpp index 7b5fedf6c..1aba9025b 100644 --- a/tdeioslave/nntp/nntp.cpp +++ b/tdeioslave/nntp/nntp.cpp @@ -15,7 +15,7 @@ #include <tqdir.h> #include <tqregexp.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <kdebug.h> #include <tdeglobal.h> #include <tdelocale.h> @@ -35,7 +35,7 @@ using namespace TDEIO; -extern "C" { int KDE_EXPORT kdemain(int argc, char **argv); } +extern "C" { int TDE_EXPORT kdemain(int argc, char **argv); } int kdemain(int argc, char **argv) { diff --git a/tdeioslave/pop3/pop3.cpp b/tdeioslave/pop3/pop3.cpp index f45f06d60..0132dc92c 100644 --- a/tdeioslave/pop3/pop3.cpp +++ b/tdeioslave/pop3/pop3.cpp @@ -52,7 +52,7 @@ extern "C" { #include <tqregexp.h> #include <kdebug.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdelocale.h> #include <kmdcodec.h> #include <tdeprotocolmanager.h> @@ -70,7 +70,7 @@ extern "C" { #define POP3_DEBUG kdDebug(7105) extern "C" { - int KDE_EXPORT kdemain(int argc, char **argv); + int TDE_EXPORT kdemain(int argc, char **argv); } using namespace TDEIO; diff --git a/tdeioslave/remote/kdedmodule/remotedirnotify.cpp b/tdeioslave/remote/kdedmodule/remotedirnotify.cpp index 5b042295d..22bd19e7b 100644 --- a/tdeioslave/remote/kdedmodule/remotedirnotify.cpp +++ b/tdeioslave/remote/kdedmodule/remotedirnotify.cpp @@ -21,8 +21,8 @@ #include <kdebug.h> #include <tdelocale.h> #include <tdeglobal.h> -#include <kstandarddirs.h> -#include <kdesktopfile.h> +#include <tdestandarddirs.h> +#include <tdedesktopfile.h> #include <kdirnotify_stub.h> diff --git a/tdeioslave/remote/kdedmodule/remotedirnotifymodule.cpp b/tdeioslave/remote/kdedmodule/remotedirnotifymodule.cpp index a93ec7eae..e3e32fb5c 100644 --- a/tdeioslave/remote/kdedmodule/remotedirnotifymodule.cpp +++ b/tdeioslave/remote/kdedmodule/remotedirnotifymodule.cpp @@ -28,7 +28,7 @@ RemoteDirNotifyModule::RemoteDirNotifyModule(const TQCString &obj) } extern "C" { - KDE_EXPORT KDEDModule *create_remotedirnotify(const TQCString &obj) + TDE_EXPORT KDEDModule *create_remotedirnotify(const TQCString &obj) { TDEGlobal::locale()->insertCatalogue("tdeio_remote"); return new RemoteDirNotifyModule(obj); diff --git a/tdeioslave/remote/remoteimpl.cpp b/tdeioslave/remote/remoteimpl.cpp index a0f37b624..659273834 100644 --- a/tdeioslave/remote/remoteimpl.cpp +++ b/tdeioslave/remote/remoteimpl.cpp @@ -21,8 +21,8 @@ #include <kdebug.h> #include <tdeglobalsettings.h> -#include <kstandarddirs.h> -#include <kdesktopfile.h> +#include <tdestandarddirs.h> +#include <tdedesktopfile.h> #include <kservice.h> #include <tdelocale.h> @@ -140,7 +140,7 @@ KURL RemoteImpl::findBaseURL(const TQString &filename) const TQString file = findDesktopFile(filename); if (!file.isEmpty()) { - KDesktopFile desktop(file, true); + TDEDesktopFile desktop(file, true); return desktop.readURL(); } @@ -218,7 +218,8 @@ void RemoteImpl::createEntry(TDEIO::UDSEntry &entry, { kdDebug(1220) << "RemoteImpl::createEntry" << endl; - KDesktopFile desktop(directory+file, true); + TQString desktopPath(directory + file); + TDEDesktopFile desktop(desktopPath, true); kdDebug(1220) << "path = " << directory << file << endl; @@ -237,6 +238,8 @@ void RemoteImpl::createEntry(TDEIO::UDSEntry &entry, addAtom(entry, TDEIO::UDS_ICON_NAME, 0, icon); addAtom(entry, TDEIO::UDS_LINK_DEST, 0, desktop.readURL()); + + addAtom(entry, TDEIO::UDS_LOCAL_PATH, 0, desktopPath); } bool RemoteImpl::statNetworkFolder(TDEIO::UDSEntry &entry, const TQString &filename) const @@ -286,7 +289,7 @@ bool RemoteImpl::renameFolders(const TQString &src, const TQString &dest, bool res = dir.rename(src+".desktop", dest+".desktop"); if (res) { - KDesktopFile desktop(directory+dest+".desktop"); + TDEDesktopFile desktop(directory+dest+".desktop"); desktop.writeEntry("Name", dest); } return res; diff --git a/tdeioslave/remote/tdeio_remote.cpp b/tdeioslave/remote/tdeio_remote.cpp index 271b0913f..258102a97 100644 --- a/tdeioslave/remote/tdeio_remote.cpp +++ b/tdeioslave/remote/tdeio_remote.cpp @@ -38,7 +38,7 @@ static const TDECmdLineOptions options[] = }; extern "C" { - int KDE_EXPORT kdemain( int argc, char **argv ) + int TDE_EXPORT kdemain( int argc, char **argv ) { // TDEApplication is necessary to use other ioslaves putenv(strdup("SESSION_MANAGER=")); diff --git a/tdeioslave/settings/tdeio_settings.cpp b/tdeioslave/settings/tdeio_settings.cpp index 5d1e67a0e..3bdbd00eb 100644 --- a/tdeioslave/settings/tdeio_settings.cpp +++ b/tdeioslave/settings/tdeio_settings.cpp @@ -18,7 +18,7 @@ */ #include <tdeio/slavebase.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <kdebug.h> #include <tqtextstream.h> #include <tdelocale.h> @@ -26,10 +26,10 @@ #include <dcopclient.h> #include <tqdatastream.h> #include <time.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <kservice.h> #include <kservicegroup.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> class SettingsProtocol : public TDEIO::SlaveBase { @@ -49,7 +49,7 @@ private: }; extern "C" { - KDE_EXPORT int kdemain( int, char **argv ) + TDE_EXPORT int kdemain( int, char **argv ) { kdDebug() << "kdemain for settings tdeioslave" << endl; TDEInstance instance( "tdeio_settings" ); diff --git a/tdeioslave/sftp/tdeio_sftp.cpp b/tdeioslave/sftp/tdeio_sftp.cpp index d62e7e062..3e88b8e65 100644 --- a/tdeioslave/sftp/tdeio_sftp.cpp +++ b/tdeioslave/sftp/tdeio_sftp.cpp @@ -33,6 +33,10 @@ #include <tqfile.h> #include <tqdir.h> +#include <numeric> +#include <functional> +#include <vector> + #include <stdlib.h> #include <unistd.h> #include <errno.h> @@ -50,7 +54,7 @@ #include <kdebug.h> #include <tdemessagebox.h> #include <tdeglobal.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdelocale.h> #include <kurl.h> #include <tdeio/ioslave_defaults.h> @@ -68,7 +72,7 @@ using namespace TDEIO; extern "C" { - int KDE_EXPORT kdemain( int argc, char **argv ) + int TDE_EXPORT kdemain( int argc, char **argv ) { TDEInstance instance( "tdeio_sftp" ); @@ -92,6 +96,54 @@ extern "C" } } +// Some helper functions/classes +namespace { + +// A quick and dirty scope guard implementation +class ExitGuard { +public: + template<class Callable> + ExitGuard(Callable && undo_func) : f(std::forward<Callable>(undo_func)) {} + ExitGuard(ExitGuard && other) : f(std::move(other.f)) { + other.f = nullptr; + } + + ~ExitGuard() { + run(); + } + + void run() noexcept { + if(f) { f(); f = nullptr; } + } + + void abort() { + f = nullptr; + } + + ExitGuard(const ExitGuard&) = delete; + void operator= (const ExitGuard&) = delete; + +private: + std::function<void()> f; +}; + +// A small helper to purge passwords. Paranoiac's note: this is not enough to guarantee the +// complete purge of the password and all its copy from memory (ioslaves are sending the passwords +// via dcop, so it's far beyond calling it "secure" in any way), but it's still better than nothing. +void purgeString(TQString &s) { + s.fill('\0'); + s.setLength(0); + s = TQString::null; +} + +// A helper class to cleanup password when it goes out of the scope +class PasswordPurger: public ExitGuard { +public: + PasswordPurger(TQString &pw) : ExitGuard( [&pw](){purgeString(pw);} ) {} +}; + +} /* namespace */ + // The callback function for libssh int auth_callback(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata) @@ -120,6 +172,68 @@ void log_callback(ssh_session session, int priority, const char *message, slave->log_callback(session, priority, message, userdata); } +class PublicKeyAuth: public SSHAuthMethod { +public: + unsigned flag() override {return SSH_AUTH_METHOD_PUBLICKEY;}; + int authenticate(sftpProtocol *ioslave) const override { + return ioslave->authenticatePublicKey(); + } + SSHAuthMethod* clone() override {return new PublicKeyAuth; } +}; + +class KeyboardInteractiveAuth: public SSHAuthMethod { +public: + KeyboardInteractiveAuth(bool noPaswordQuery = false): mNoPaswordQuery(noPaswordQuery) {} + + unsigned flag() override {return SSH_AUTH_METHOD_INTERACTIVE;}; + int authenticate(sftpProtocol *ioslave) const override { + return ioslave->authenticateKeyboardInteractive(mNoPaswordQuery); + } + SSHAuthMethod* clone() override {return new KeyboardInteractiveAuth(mNoPaswordQuery); } + +private: + const bool mNoPaswordQuery; +}; + +class PasswordAuth: public SSHAuthMethod { +public: + PasswordAuth(bool noPaswordQuery = false): mNoPaswordQuery(noPaswordQuery) {} + + unsigned flag() override {return SSH_AUTH_METHOD_PASSWORD;}; + int authenticate(sftpProtocol *ioslave) const override { + return ioslave->authenticatePassword(mNoPaswordQuery); + } + SSHAuthMethod* clone() override {return new PasswordAuth(mNoPaswordQuery); } + +private: + const bool mNoPaswordQuery; +}; + +TQString SSHAuthMethod::flagToStr (unsigned m) { + switch (m) { + case SSH_AUTH_METHOD_NONE : return TQString::fromLatin1 ( "none" ); + case SSH_AUTH_METHOD_PASSWORD : return TQString::fromLatin1 ( "password" ); + case SSH_AUTH_METHOD_PUBLICKEY : return TQString::fromLatin1 ( "publickey" ); + case SSH_AUTH_METHOD_HOSTBASED : return TQString::fromLatin1 ( "hostbased" ); + case SSH_AUTH_METHOD_INTERACTIVE : return TQString::fromLatin1 ( "keyboard-interactive" ); + case SSH_AUTH_METHOD_GSSAPI_MIC : return TQString::fromLatin1 ( "gssapi-with-mic" ); + default : return TQString::fromLatin1 ( "unknown" ); + } +} + +TQStringList SSHAuthMethod::bitsetToStr (unsigned m) { + TQStringList rv; + + for (int i=0; m>>i; i++) { + unsigned flag = m & (1 << i); + if (flag) { + rv.append(flagToStr(flag)); + } + } + return rv; +} + + // Public key authentication int sftpProtocol::auth_callback(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata) @@ -128,42 +242,82 @@ int sftpProtocol::auth_callback(const char *prompt, char *buf, size_t len, (void) echo; (void) verify; (void) userdata; + (void) prompt; + + Q_ASSERT(len>0); kdDebug(TDEIO_SFTP_DB) << "Entering public key authentication callback" << endl; - if(!pubKeyInfo) - { - pubKeyInfo = new TDEIO::AuthInfo; - } - else - { - // TODO: inform user about incorrect password - } + int rc=0; + bool firstTimeCalled = !mPubKeyAuthData.wasCalled; + mPubKeyAuthData.wasCalled = true; - pubKeyInfo->url.setProtocol("sftp"); - pubKeyInfo->url.setHost(mHost); - pubKeyInfo->url.setPort(mPort); - pubKeyInfo->url.setUser(mUsername); + AuthInfo pubKeyInfo = authInfo(); - pubKeyInfo->caption = i18n("SFTP Login"); - pubKeyInfo->comment = "sftp://" + mUsername + "@" + mHost; - pubKeyInfo->username = mUsername; - pubKeyInfo->readOnly = false; - pubKeyInfo->prompt = TQString::fromUtf8(prompt); - pubKeyInfo->keepPassword = false; // don't save passwords for public key, + pubKeyInfo.keepPassword = false; // don't save passwords for public key, // that's the task of ssh-agent. + pubKeyInfo.readOnly = true; // We don't want to handle user name change when authing with a key - if (!openPassDlg(*pubKeyInfo)) { - kdDebug(TDEIO_SFTP_DB) << "User canceled entry of public key password." << endl; - return -1; + TQString errMsg; + TQString keyFile; +#if LIBSSH_VERSION_INT < SSH_VERSION_INT(0, 10, 0) + // no way to determine keyfile name on older libssh +#else + char *ssh_key_file = 0; + rc = ssh_userauth_publickey_auto_get_current_identity(mSession, &ssh_key_file); + + if (rc == 0 && ssh_key_file && ssh_key_file[0]) { + keyFile = ssh_key_file; } + ssh_string_free_char(ssh_key_file); +#endif - strncpy(buf, pubKeyInfo->password.utf8().data(), len - 1); + bool firstTry = !mPubKeyAuthData.attemptedKeys.contains(keyFile); - pubKeyInfo->password.fill('x'); - pubKeyInfo->password = ""; + if (firstTry) { + SlaveBase::s_seqNr = mPubKeyAuthData.current_seqNr; + } else { + errMsg = i18n("Incorrect or invalid passphrase.").append('\n'); + } - return 0; + // libssh prompt is trash and we know we use this function only for publickey auth, so we'll give + // the user a descent prompt + if (!keyFile.isEmpty()) { + pubKeyInfo.prompt = i18n("Please enter the passphrase for next public key:\n%1").arg(keyFile); + } else { // Generally shouldn't happend but on older libssh + pubKeyInfo.prompt = i18n("Please enter the passphrase for your public key."); + } + + // We don't want to clobber with normal passwords in kpasswdserver's cache + pubKeyInfo.realmValue = "keyfile passphrase:" + keyFile; + + if (openPassDlg(pubKeyInfo, errMsg)) { + if (len < pubKeyInfo.password.utf8().length()+1) { + kdDebug(TDEIO_SFTP_DB) << "Insufficient buffer size for password: " << len + << " (" << pubKeyInfo.password.utf8().length()+1 << "needed)" << endl; + } + + strncpy(buf, pubKeyInfo.password.utf8().data(), len-1); + buf[len-1]=0; // Just to be on the safe side + + purgeString(pubKeyInfo.password); + + // take a note that we already tried unlocking this keyfile + if(firstTry) { + mPubKeyAuthData.attemptedKeys.append(keyFile); + } + + // we consider publickey auth canceled only if we cancel all the key dialogs + mPubKeyAuthData.wasCanceled = false; + } else { + kdDebug(TDEIO_SFTP_DB) << "User canceled entry of public key passphrase" << endl; + rc = -1; + if (firstTimeCalled) { + mPubKeyAuthData.wasCanceled = true; + } + } + + return rc; } void sftpProtocol::log_callback(ssh_session session, int priority, @@ -174,91 +328,323 @@ void sftpProtocol::log_callback(ssh_session session, int priority, kdDebug(TDEIO_SFTP_DB) << "[" << priority << "] " << message << endl; } -int sftpProtocol::authenticateKeyboardInteractive(AuthInfo &info) { - TQString name, instruction, prompt; - int err = SSH_AUTH_ERROR; +int sftpProtocol::authenticatePublicKey(){ + kdDebug(TDEIO_SFTP_DB) << "Trying to authenticate with public key" << endl; + + // First let's do some cleanup + mPubKeyAuthData.attemptedKeys.clear(); + mPubKeyAuthData.current_seqNr = SlaveBase::s_seqNr; + mPubKeyAuthData.wasCalled = 0; + mPubKeyAuthData.wasCanceled = 0; + + int rc; + + while (1) { + mPubKeyAuthData.wasCalled = 0; + rc = ssh_userauth_publickey_auto(mSession, nullptr, nullptr); + + kdDebug(TDEIO_SFTP_DB) << "ssh_userauth_publickey_auto returned rc=" << rc + << " ssh_err=" << ssh_get_error_code(mSession) + << " (" << ssh_get_error(mSession) << ")" << endl; + if (rc == SSH_AUTH_DENIED) { + if (!mPubKeyAuthData.wasCalled) { + kdDebug(TDEIO_SFTP_DB) << "Passkey auth denied because it has no matching key" << endl; + break; /* rc == SSH_AUTH_DENIED */ + } else if (mPubKeyAuthData.wasCanceled) { + kdDebug(TDEIO_SFTP_DB) << "Passkey auth denied because user canceled" << endl; + rc = sftpProtocol::SSH_AUTH_CANCELED; + break; + } else { + kdDebug(TDEIO_SFTP_DB) << "User entered wrong passphrase for the key" << endl; + mPubKeyAuthData.current_seqNr = SlaveBase::s_seqNr; + // Try it again + } + } else { + // every other rc is either error or success + break; + } + } + + return rc; +} +int sftpProtocol::authenticateKeyboardInteractive(bool noPaswordQuery) { kdDebug(TDEIO_SFTP_DB) << "Entering keyboard interactive function" << endl; - err = ssh_userauth_kbdint(mSession, mUsername.utf8().data(), NULL); - while (err == SSH_AUTH_INFO) { + int rc = SSH_AUTH_ERROR; + + bool retryDenied = false; // a flag to avoid infinite looping + + TQString cachablePassword; + PasswordPurger cachePurger(cachablePassword); + + // Different prompts during a single pass should be queried with the same s_seqNr value + long current_seqNr = SlaveBase::s_seqNr; + + while (1) { int n = 0; int i = 0; + rc = ssh_userauth_kbdint(mSession, NULL, NULL); + + if (rc == SSH_AUTH_DENIED) { // do nothing + kdDebug(TDEIO_SFTP_DB) << "kb-interactive auth was denied; retrying again" << endl; + if (retryDenied) { + // If we were denied update the s_seqNr + current_seqNr = SlaveBase::s_seqNr; + continue; + } else { + break; + } + } else if (rc != SSH_AUTH_INFO) { + kdDebug(TDEIO_SFTP_DB) << "Finishing kb-interactive auth rc=" << rc + << " ssh_err=" << ssh_get_error_code(mSession) + << " (" << ssh_get_error(mSession) << ")" << endl; + break; + } + + // See "RFC4256 Section 3.3 User Interface" for meaning of the values + TQString name, instruction, prompt; name = TQString::fromUtf8(ssh_userauth_kbdint_getname(mSession)); instruction = TQString::fromUtf8(ssh_userauth_kbdint_getinstruction(mSession)); n = ssh_userauth_kbdint_getnprompts(mSession); + if (n>0) { + // If there is at least one prompt we will want to retry auth if we fail + retryDenied = true; + } + kdDebug(TDEIO_SFTP_DB) << "name=" << name << " instruction=" << instruction - << " prompts" << n << endl; + << " prompts:" << n << endl; for (i = 0; i < n; ++i) { char echo; - const char *answer = ""; + bool isPassword=false; + TQString answer; + TQString errMsg; + + // restore the s_seqNr so it would be the same for all the prompts + SlaveBase::s_seqNr = current_seqNr; prompt = TQString::fromUtf8(ssh_userauth_kbdint_getprompt(mSession, i, &echo)); kdDebug(TDEIO_SFTP_DB) << "prompt=" << prompt << " echo=" << TQString::number(echo) << endl; - if (echo) { - // See RFC4256 Section 3.3 User Interface - TQString newPrompt; - TDEIO::AuthInfo infoKbdInt; - infoKbdInt.url.setProtocol("sftp"); - infoKbdInt.url.setHost(mHost); - infoKbdInt.url.setPort(mPort); + TDEIO::AuthInfo infoKbdInt = authInfo(); + infoKbdInt.realmValue = prompt; // each prompt will be treated on its own by kpasswdserver + infoKbdInt.keepPassword = false; + + if (!name.isEmpty()) { + infoKbdInt.caption = TQString(i18n("SFTP Login") + " - " + name); + } + + // Those strings might or might not contain some sensitive information + PasswordPurger answerPurger{answer}; + PasswordPurger infoPurger{infoKbdInt.password}; - infoKbdInt.caption = i18n("SFTP Login"); - infoKbdInt.comment = "sftp://" + mUsername + "@" + mHost; + if (!echo) { + // ssh server requests us to ask user a question without displaying an answer. In normal + // circumstances this is probably a password, but it might be something else depending + // on the server configuration. + if (prompt.lower().startsWith("password")) { + // We can assume that the ssh server asks for a password and we will handle that case + // with more care since it's what most users will see + isPassword = true; + if (noPaswordQuery) { // if we have a cached password we might use it + kdDebug(TDEIO_SFTP_DB) << "Using cached password" << endl; + answer = mPassword; + cachablePassword = mPassword; + purgeString(mPassword); // if we used up password purge it + } else { + infoKbdInt.prompt = i18n("Please enter your password."); + infoKbdInt.realmValue = TQString(); // passwords use generic realm + infoKbdInt.keepPassword = true; + + if (mPasswordWasPrompted) { + errMsg = i18n("Login failed: incorrect password or username.").append('\n'); + } + mPasswordWasPrompted = true; + } + } else { + // If the server's request doesn't look like a password, keep the servers prompt but + // don't prompt for saving the answer + infoKbdInt.prompt = i18n("Please enter answer for the next request:"); + if (!instruction.isEmpty()) { + infoKbdInt.prompt.append("\n\n").append(instruction); + } + infoKbdInt.prompt.append("\n\n").append(prompt); + infoKbdInt.readOnly = true; // set username readonly (enable changing it only with password) + } + + if (answer.isNull()) { + if (openPassDlg(infoKbdInt, errMsg)) { + answer = infoKbdInt.password; + kdDebug(TDEIO_SFTP_DB) << "Got the answer from the password dialog" << endl; - if (!name.isEmpty()) { - infoKbdInt.caption = TQString(i18n("SFTP Login") + " - " + name); + if (isPassword) { + TQString sshUser=sshUsername(); + if (infoKbdInt.username != sshUser) { + kdDebug(TDEIO_SFTP_DB) << "Username changed from " << sshUser + << " to " << infoKbdInt.username << endl; + mCachedUsername = infoKbdInt.username; + mPassword = infoKbdInt.password; + + return sftpProtocol::SSH_AUTH_NEED_RECONNECT; + } + } + } else { + return sftpProtocol::SSH_AUTH_CANCELED; + } } + } else { + // ssh server asks for some clear-text information from a user (e.g. a one-time + // identification code) which should be echoed while user enters it. As for now tdeio has + // no means to handle that correctly, so we will have to be creative with the password + // dialog. + TQString newPrompt; if (!instruction.isEmpty()) { newPrompt = instruction + "\n\n"; } + newPrompt.append(prompt).append("\n\n"); + newPrompt.append(i18n("Use the username input field to answer this question.")); + infoKbdInt.prompt = newPrompt; - newPrompt.append(prompt + "\n\n"); - infoKbdInt.readOnly = false; - infoKbdInt.keepPassword = false; - infoKbdInt.prompt = i18n("Use the username input field to answer this question."); + infoKbdInt.url.setUser(infoKbdInt.username); + infoKbdInt.username = TQString::null; + infoKbdInt.readOnly = false; if (openPassDlg(infoKbdInt)) { - kdDebug(TDEIO_SFTP_DB) << "Got the answer from the password dialog" << endl; - answer = info.username.utf8().data(); + answer = infoKbdInt.username; + kdDebug(TDEIO_SFTP_DB) << "Got the answer from the password dialog: " << answer << endl; + } else { + return sftpProtocol::SSH_AUTH_CANCELED; } + } - if (ssh_userauth_kbdint_setanswer(mSession, i, answer) < 0) { - kdDebug(TDEIO_SFTP_DB) << "An error occurred setting the answer: " - << ssh_get_error(mSession) << endl; - return SSH_AUTH_ERROR; - } - break; - } else { - if (prompt.lower().startsWith("password")) { - answer = mPassword.utf8().data(); - } else { - info.readOnly = true; // set username readonly - info.prompt = prompt; + if (ssh_userauth_kbdint_setanswer(mSession, i, answer.utf8().data()) < 0) { + kdDebug(TDEIO_SFTP_DB) << "An error occurred setting the answer: " + << ssh_get_error(mSession) << endl; + return SSH_AUTH_ERROR; + } + } // for each ssh_userauth_kbdint_getprompt() + } // while (1) - if (openPassDlg(info)) { - kdDebug(TDEIO_SFTP_DB) << "Got the answer from the password dialog" << endl; - answer = info.password.utf8().data(); - } - } + if (!mPasswordWasPrompted && !cachablePassword.isEmpty() && (rc == SSH_AUTH_SUCCESS || rc == SSH_AUTH_PARTIAL)) { + // if the password was never prompted, it was never cached, so we should cache it manually + TDEIO::AuthInfo info = authInfo(); + info.password = cachablePassword; + info.keepPassword = false; + cacheAuthentication(info); + purgeString(info.password); + } - if (ssh_userauth_kbdint_setanswer(mSession, i, answer) < 0) { - kdDebug(TDEIO_SFTP_DB) << "An error occurred setting the answer: " - << ssh_get_error(mSession) << endl; - return SSH_AUTH_ERROR; - } + return rc; +} + +int sftpProtocol::authenticatePassword(bool noPaswordQuery) { + kdDebug(TDEIO_SFTP_DB) << "Trying to authenticate with password" << endl; + + AuthInfo info = authInfo(); + info.keepPassword = true; + info.prompt = i18n("Please enter your username and password."); + + PasswordPurger pPurger(info.password); + + int rc; + do { + TQString errMsg; + + if(noPaswordQuery) { // on the first try use cached password + info.password = mPassword; + purgeString(mPassword); + } else { + if (mPasswordWasPrompted) { + errMsg = i18n("Login failed: incorrect password or username.").append('\n'); + } + + mPasswordWasPrompted = true; + + // Handle user canceled or dialog failed to open... + if (!openPassDlg(info, errMsg)) { + kdDebug(TDEIO_SFTP_DB) << "User canceled password dialog" << endl; + return sftpProtocol::SSH_AUTH_CANCELED; + } + + TQString sshUser=sshUsername(); + if (info.username != sshUser) { + kdDebug(TDEIO_SFTP_DB) << "Username changed from " << sshUser + << " to " << info.username << endl; + mCachedUsername = info.username; + mPassword = info.password; + // libssh doc says that most servers don't permit changing the username during + // authentication, so we should reinitialize the session here + return sftpProtocol::SSH_AUTH_NEED_RECONNECT; } } - err = ssh_userauth_kbdint(mSession, mUsername.utf8().data(), NULL); + + rc = ssh_userauth_password(mSession, NULL, info.password.utf8().data()); + + } while (rc == SSH_AUTH_DENIED && !noPaswordQuery); + + if (!mPasswordWasPrompted && (rc == SSH_AUTH_SUCCESS || rc == SSH_AUTH_PARTIAL)) { + // if the password was never prompted, it was never cached, so we should cache it manually + info.keepPassword = false; + cacheAuthentication(info); + } + return rc; +} + + +TQString sftpProtocol::sshUsername() { + int rc; + TQString rv; + + char *ssh_username = NULL; + rc = ssh_options_get(mSession, SSH_OPTIONS_USER, &ssh_username); + if (rc == 0 && ssh_username && ssh_username[0]) { + rv = TQString::fromUtf8(ssh_username); } + ssh_string_free_char(ssh_username); - return err; + return rv; +} + + +TQString sftpProtocol::sshError(TQString errMsg) { + if (ssh_get_error_code(mSession)) { + errMsg.append("\n\n").append(i18n("SSH error: \"%1\" (%2)") + .arg(TQString::fromUtf8(ssh_get_error(mSession))).arg(ssh_get_error_code(mSession))); + } + return errMsg; +} + +TDEIO::AuthInfo sftpProtocol::authInfo() { + TDEIO::AuthInfo rv; + + rv.url.setProtocol("sftp"); + rv.url.setHost(mHost); + rv.url.setPort(mPort); + rv.url.setUser(mUsername); + + rv.caption = i18n("SFTP Login"); + rv.comment = "sftp://" + mHost + ':' + TQString::number(mPort); + rv.commentLabel = i18n("site:"); + + if(!mUsername.isEmpty()) { + rv.username = mUsername; + } if(!mCachedUsername.isEmpty()) { + rv.username = mCachedUsername; + } else if (mSession) { + rv.username = sshUsername(); + } + + // if username was specified in the address string it shouldn't be changed + if (!mUsername.isEmpty()) { + rv.readOnly = true; + } + + return rv; } void sftpProtocol::reportError(const KURL &url, const int err) { @@ -447,7 +833,7 @@ TQString sftpProtocol::canonicalizePath(const TQString &path) { sftpProtocol::sftpProtocol(const TQCString &pool_socket, const TQCString &app_socket) : SlaveBase("tdeio_sftp", pool_socket, app_socket), mConnected(false), mPort(-1), mSession(NULL), mSftp(NULL) { -#ifndef Q_WS_WIN +#ifndef TQ_WS_WIN kdDebug(TDEIO_SFTP_DB) << "pid = " << getpid() << endl; kdDebug(TDEIO_SFTP_DB) << "debug = " << getenv("TDEIO_SFTP_LOG_VERBOSITY") << endl; @@ -470,15 +856,17 @@ sftpProtocol::sftpProtocol(const TQCString &pool_socket, const TQCString &app_so } sftpProtocol::~sftpProtocol() { -#ifndef Q_WS_WIN +#ifndef TQ_WS_WIN kdDebug(TDEIO_SFTP_DB) << "pid = " << getpid() << endl; #endif closeConnection(); - delete mCallbacks; + free(mCallbacks); /* cleanup and shut down cryto stuff */ ssh_finalize(); + + purgeString(mPassword); } void sftpProtocol::setHost(const TQString& h, int port, const TQString& user, const TQString& pass) { @@ -505,53 +893,11 @@ void sftpProtocol::setHost(const TQString& h, int port, const TQString& user, co mUsername = user; mPassword = pass; + mCachedUsername = TQString::null; } -void sftpProtocol::openConnection() { - - if (mConnected) { - return; - } - - kdDebug(TDEIO_SFTP_DB) << "username=" << mUsername << ", host=" << mHost << ", port=" << mPort << endl; - - infoMessage(i18n("Opening SFTP connection to host %1:%2").arg(mHost).arg(mPort)); - - if (mHost.isEmpty()) { - kdDebug(TDEIO_SFTP_DB) << "openConnection(): Need hostname..." << endl; - error(TDEIO::ERR_UNKNOWN_HOST, i18n("No hostname specified.")); - return; - } - - // Setup AuthInfo for use with password caching and the - // password dialog box. - AuthInfo info; - - info.url.setProtocol("sftp"); - info.url.setHost(mHost); - info.url.setPort(mPort); - info.url.setUser(mUsername); - info.caption = i18n("SFTP Login"); - info.comment = "sftp://" + mHost + ':' + TQString::number(mPort); - info.commentLabel = i18n("site:"); - info.username = mUsername; - info.keepPassword = true; // make the "keep Password" check box visible to the user. - - // Check for cached authentication info if no password is specified... - if (mPassword.isEmpty()) { - kdDebug(TDEIO_SFTP_DB) << "checking cache: info.username = " << info.username - << ", info.url = " << info.url.prettyURL() << endl; - - if (checkCachedAuthentication(info)) { - kdDebug() << "using cached" << endl; - mUsername = info.username; - mPassword = info.password; - } - } - // Start the ssh connection. - TQString msg; // msg for dialog box - TQString caption; // dialog box caption +int sftpProtocol::initializeConnection() { unsigned char *hash = NULL; // the server hash char *hexa; char *verbosity; @@ -561,7 +907,7 @@ void sftpProtocol::openConnection() { mSession = ssh_new(); if (mSession == NULL) { error(TDEIO::ERR_INTERNAL, i18n("Could not create a new SSH session.")); - return; + return SSH_ERROR; } kdDebug(TDEIO_SFTP_DB) << "Creating the SSH session and setting options" << endl; @@ -591,23 +937,24 @@ void sftpProtocol::openConnection() { rc = ssh_options_set(mSession, SSH_OPTIONS_HOST, mHost.utf8().data()); if (rc < 0) { error(TDEIO::ERR_OUT_OF_MEMORY, i18n("Could not set host.")); - return; + return SSH_ERROR; } if (mPort > 0) { rc = ssh_options_set(mSession, SSH_OPTIONS_PORT, &mPort); if (rc < 0) { - error(TDEIO::ERR_OUT_OF_MEMORY, i18n("Could not set port.")); - return; + error(TDEIO::ERR_OUT_OF_MEMORY, i18n("Could not set port.")); + return SSH_ERROR; } } // Set the username - if (!mUsername.isEmpty()) { - rc = ssh_options_set(mSession, SSH_OPTIONS_USER, mUsername.utf8().data()); + if (!mCachedUsername.isEmpty() || !mUsername.isEmpty()) { + TQString username = !mCachedUsername.isEmpty() ? mCachedUsername : mUsername; + rc = ssh_options_set(mSession, SSH_OPTIONS_USER, username.utf8().data()); if (rc < 0) { error(TDEIO::ERR_OUT_OF_MEMORY, i18n("Could not set username.")); - return; + return rc; } } @@ -616,7 +963,7 @@ void sftpProtocol::openConnection() { rc = ssh_options_set(mSession, SSH_OPTIONS_LOG_VERBOSITY_STR, verbosity); if (rc < 0) { error(TDEIO::ERR_OUT_OF_MEMORY, i18n("Could not set log verbosity.")); - return; + return rc; } } @@ -624,7 +971,7 @@ void sftpProtocol::openConnection() { rc = ssh_options_parse_config(mSession, NULL); if (rc < 0) { error(TDEIO::ERR_INTERNAL, i18n("Could not parse the config file.")); - return; + return rc; } ssh_set_callbacks(mSession, mCallbacks); @@ -634,9 +981,8 @@ void sftpProtocol::openConnection() { /* try to connect */ rc = ssh_connect(mSession); if (rc < 0) { - error(TDEIO::ERR_COULD_NOT_CONNECT, TQString::fromUtf8(ssh_get_error(mSession))); - closeConnection(); - return; + error(TDEIO::ERR_COULD_NOT_CONNECT, sshError()); + return rc; } kdDebug(TDEIO_SFTP_DB) << "Getting the SSH server hash" << endl; @@ -644,24 +990,24 @@ void sftpProtocol::openConnection() { /* get the hash */ ssh_key serverKey; #if LIBSSH_VERSION_INT < SSH_VERSION_INT(0, 7, 90) - if (ssh_get_publickey(mSession, &serverKey) < 0) { + rc = ssh_get_publickey(mSession, &serverKey); #else - if (ssh_get_server_publickey(mSession, &serverKey) < 0) { + rc = ssh_get_server_publickey(mSession, &serverKey); #endif - error(TDEIO::ERR_COULD_NOT_CONNECT, TQString::fromUtf8(ssh_get_error(mSession))); - closeConnection(); - return; + if (rc<0) { + error(TDEIO::ERR_COULD_NOT_CONNECT, sshError()); + return rc; } size_t hlen; #if LIBSSH_VERSION_INT < SSH_VERSION_INT(0, 8, 90) - if (ssh_get_publickey_hash(serverKey, SSH_PUBLICKEY_HASH_MD5, &hash, &hlen) < 0) { + rc = ssh_get_publickey_hash(serverKey, SSH_PUBLICKEY_HASH_MD5, &hash, &hlen); #else - if (ssh_get_publickey_hash(serverKey, SSH_PUBLICKEY_HASH_SHA256, &hash, &hlen) < 0) { + rc = ssh_get_publickey_hash(serverKey, SSH_PUBLICKEY_HASH_SHA256, &hash, &hlen); #endif - error(TDEIO::ERR_COULD_NOT_CONNECT, TQString::fromUtf8(ssh_get_error(mSession))); - closeConnection(); - return; + if (rc<0) { + error(TDEIO::ERR_COULD_NOT_CONNECT, sshError()); + return rc; } kdDebug(TDEIO_SFTP_DB) << "Checking if the SSH server is known" << endl; @@ -682,8 +1028,7 @@ void sftpProtocol::openConnection() { "An attacker might change the default server key to confuse your " "client into thinking the key does not exist.\n" "Please contact your system administrator.\n%1").arg(TQString::fromUtf8(ssh_get_error(mSession)))); - closeConnection(); - return; + return SSH_ERROR; case TDEIO_SSH_KNOWN_HOSTS_CHANGED: hexa = ssh_get_hexa(hash, hlen); delete hash; @@ -695,10 +1040,11 @@ void sftpProtocol::openConnection() { "Please contact your system administrator.\n%3").arg( mHost).arg(TQString::fromUtf8(hexa)).arg(TQString::fromUtf8(ssh_get_error(mSession)))); delete hexa; - closeConnection(); - return; + return SSH_ERROR; case TDEIO_SSH_KNOWN_HOSTS_NOT_FOUND: - case TDEIO_SSH_KNOWN_HOSTS_UNKNOWN: + case TDEIO_SSH_KNOWN_HOSTS_UNKNOWN: { + TQString msg; // msg for dialog box + TQString caption; // dialog box caption hexa = ssh_get_hexa(hash, hlen); delete hash; caption = i18n("Warning: Cannot verify host's identity."); @@ -708,9 +1054,8 @@ void sftpProtocol::openConnection() { delete hexa; if (KMessageBox::Yes != messageBox(WarningYesNo, msg, caption)) { - closeConnection(); error(TDEIO::ERR_USER_CANCELED, TQString()); - return; + return SSH_ERROR; } /* write the known_hosts file */ @@ -720,136 +1065,200 @@ void sftpProtocol::openConnection() { #else if (ssh_session_update_known_hosts(mSession) != SSH_OK) { #endif - error(TDEIO::ERR_USER_CANCELED, TQString::fromUtf8(ssh_get_error(mSession))); - closeConnection(); - return; + error(TDEIO::ERR_USER_CANCELED, sshError()); + return SSH_ERROR; } break; + } case TDEIO_SSH_KNOWN_HOSTS_ERROR: delete hash; - error(TDEIO::ERR_COULD_NOT_CONNECT, TQString::fromUtf8(ssh_get_error(mSession))); - return; + error(TDEIO::ERR_COULD_NOT_CONNECT, sshError()); + return SSH_ERROR; } kdDebug(TDEIO_SFTP_DB) << "Trying to authenticate with the server" << endl; - // Try to authenticate - rc = ssh_userauth_none(mSession, NULL); - if (rc == SSH_AUTH_ERROR) { - closeConnection(); - error(TDEIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed (method: %1).") - .arg(i18n("none"))); + return SSH_OK; +} + + +void sftpProtocol::openConnection() { + + if (mConnected) { return; } - int method = ssh_auth_list(mSession); - if (!method && rc != SSH_AUTH_SUCCESS) - { - error(TDEIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed." - " The server did not send any authentication methods!")); + kdDebug(TDEIO_SFTP_DB) << "username=" << mUsername << ", host=" << mHost << ", port=" << mPort << endl; + + infoMessage(i18n("Opening SFTP connection to host %1:%2").arg(mHost).arg(mPort)); + + if (mHost.isEmpty()) { + kdDebug(TDEIO_SFTP_DB) << "openConnection(): Need hostname..." << endl; + error(TDEIO::ERR_UNKNOWN_HOST, i18n("No hostname specified.")); return; } - bool firstTime = true; - bool dlgResult; - while (rc != SSH_AUTH_SUCCESS) { - // Try to authenticate with public key first - if (rc != SSH_AUTH_SUCCESS && (method & SSH_AUTH_METHOD_PUBLICKEY) && !mPassword) - { - kdDebug(TDEIO_SFTP_DB) << "Trying to authenticate with public key" << endl; - for(;;) - { - rc = ssh_userauth_publickey_auto(mSession, nullptr, nullptr); - if (rc == SSH_AUTH_ERROR) - { - clearPubKeyAuthInfo(); - closeConnection(); - error(TDEIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed (method: %1).") - .arg(i18n("public key"))); - return; - } - if (rc == SSH_AUTH_DENIED || !pubKeyInfo || !pubKeyInfo->isModified()) - { - clearPubKeyAuthInfo(); - break; - } - } + // Check for cached authentication info if no password is specified... + if (mPassword.isEmpty()) { + AuthInfo info = authInfo(); + + kdDebug(TDEIO_SFTP_DB) << "checking cache: info.username = " << info.username + << ", info.url = " << info.url.prettyURL() << endl; + + if (checkCachedAuthentication(info)) { + kdDebug() << "using cached" << endl; + mCachedUsername = info.username; + mPassword = info.password; + + purgeString(info.password); //< not really necessary because of Qt's implicit data sharing } + } - // Try to authenticate with keyboard interactive - if (rc != SSH_AUTH_SUCCESS && (method & SSH_AUTH_METHOD_INTERACTIVE)) - { - kdDebug(TDEIO_SFTP_DB) << "Trying to authenticate with keyboard interactive" << endl; + mPasswordWasPrompted = false; + PasswordPurger pwPurger{mPassword}; - TDEIO::AuthInfo tmpInfo(info); - rc = authenticateKeyboardInteractive(tmpInfo); - if (rc == SSH_AUTH_SUCCESS) - { - info = tmpInfo; - } - else if (rc == SSH_AUTH_ERROR) - { - closeConnection(); - error(TDEIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed (method: %1).") - .arg(i18n("keyboard interactive"))); - return; - } - } + int rc; + ExitGuard connectionCloser([this](){ closeConnection(); }); - // Try to authenticate with password - if (rc != SSH_AUTH_SUCCESS && (method & SSH_AUTH_METHOD_PASSWORD)) - { - kdDebug(TDEIO_SFTP_DB) << "Trying to authenticate with password" << endl; - - info.keepPassword = true; - for(;;) - { - if(!firstTime || mPassword.isEmpty()) - { - if (firstTime) { - info.prompt = i18n("Please enter your username and password."); - } else { - info.prompt = i18n("Login failed.\nPlease confirm your username and password, and enter them again."); - } - dlgResult = openPassDlg(info); - - // Handle user canceled or dialog failed to open... - if (!dlgResult) { - kdDebug(TDEIO_SFTP_DB) << "User canceled, dlgResult = " << dlgResult << endl; - closeConnection(); - error(TDEIO::ERR_USER_CANCELED, TQString()); - return; - } + do { // A loop to restart connection when needed + // Start the ssh connection. + if (initializeConnection() < 0) { + return; + } - firstTime = false; - } + // Try to authenticate (this required before calling ssh_auth_list()) + rc = ssh_userauth_none(mSession, NULL); + if (rc == SSH_AUTH_ERROR) { + error(TDEIO::ERR_COULD_NOT_LOGIN, sshError(i18n("Authentication failed (method: %1).") + .arg(i18n("none")))); + return; + } - if (mUsername != info.username) { - kdDebug(TDEIO_SFTP_DB) << "Username changed from " << mUsername - << " to " << info.username << endl; - } - mUsername = info.username; - mPassword = info.password; + // Preinit the list of supported auth methods + static const auto authMethodsNormal = [](){ + std::vector<std::unique_ptr<SSHAuthMethod>> rv; + rv.emplace_back(std::unique_ptr<PublicKeyAuth>(new PublicKeyAuth)); + rv.emplace_back(std::unique_ptr<KeyboardInteractiveAuth>(new KeyboardInteractiveAuth)); + rv.emplace_back(std::unique_ptr<PasswordAuth>(new PasswordAuth)); + return rv; + }(); + + const static int supportedMethods = std::accumulate( + authMethodsNormal.begin(), authMethodsNormal.end(), + SSH_AUTH_METHOD_NONE, //< none is supported by default + [](int acc, const std::unique_ptr<SSHAuthMethod> &m){ return acc |= m->flag(); }); + + unsigned attemptedMethods = 0; + + // Backup of the value of the SlaveBase::s_seqNr. This is used to query different data values + // with openPassDlg() with the same seqNr. Otherwise it will result in the prompting of the pass + // dialog to the user in cases the values should be recovered from the cache. + // This is a bit hacky but necessary + long current_seqNr = SlaveBase::s_seqNr; + + while (rc != SSH_AUTH_SUCCESS) { + // Note this loop can rerun in case of multistage ssh authentication e.g. "password,publickey" + // which will require user to provide a valid password at first and then a valid public key. + // see AuthenticationMethods in man 5 sshd_config for more info + bool wasCanceled = false; + unsigned availableMethodes = ssh_auth_list(mSession); + + SlaveBase::s_seqNr = current_seqNr; + + if (!availableMethodes) { + // Technically libssh docs suggest that the server merely MAY send auth methods, but it's + // highly unclear what we should do in such case and it looks like openssh doesn't have an + // option for that, so let's just consider this server a jerk and don't talk to him anymore. + error(TDEIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed.\n" + "The server did not send any authentication methods!")); + return; + } else if (!(availableMethodes & supportedMethods)) { + error(TDEIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed.\n" + "The server sent only unsupported authentication methods (%1)!") + .arg(SSHAuthMethod::bitsetToStr(availableMethodes).join(", "))); + return; + } - rc = ssh_userauth_password(mSession, mUsername.utf8().data(), - mPassword.utf8().data()); - if (rc == SSH_AUTH_ERROR) { - closeConnection(); - error(TDEIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed (method: %1).") - .arg(i18n("password"))); + const auto *authMethods = &authMethodsNormal; + + // If we have cached password we want try to use it before public key + if(!mPassword.isEmpty()) { + static const auto authMethodsWithPassword = []() { + std::vector<std::unique_ptr<SSHAuthMethod>> rv; + rv.emplace_back(std::unique_ptr<KeyboardInteractiveAuth>( + new KeyboardInteractiveAuth(/* noPasswordQuery = */true) ) ); + rv.emplace_back(std::unique_ptr<PasswordAuth>( + new PasswordAuth(/* noPasswordQuery = */true) ) ); + for (const auto &m: authMethodsNormal) { rv.emplace_back(m->clone()); } + return rv; + }(); + + authMethods = &authMethodsWithPassword; + } + + // Actually iterate over the list of methods and try them out + for (const auto &method: *authMethods) { + if (!(availableMethodes & method->flag())) { continue; } + + rc = method->authenticate( this ); + attemptedMethods |= method->flag(); + if (rc == SSH_AUTH_SUCCESS || rc == SSH_AUTH_PARTIAL) { + kdDebug(TDEIO_SFTP_DB) << "method=" << method->name() << ": auth " + << (rc == SSH_AUTH_SUCCESS ? "success" : "partial") << endl; + break; // either next auth method or continue on with the connect + } else if (rc == SSH_AUTH_ERROR || rc == SSH_AUTH_AGAIN) { + TQString errMsg = i18n("Authentication failed (method: %1).").arg(method->name()); + // SSH_AUTH_AGAIN returned in case of some errors when server hangs up unexpectedly like + // in case there were too many failed authentication attempts + if (rc == SSH_AUTH_AGAIN) { + errMsg.append("\n").append(i18n("Server is slow to respond or hung up unexpectedly.")); + } + error(TDEIO::ERR_COULD_NOT_LOGIN, sshError(errMsg)); return; - } else if (rc == SSH_AUTH_SUCCESS) { + } else if (rc == SSH_AUTH_CANCELED) { + kdDebug(TDEIO_SFTP_DB) << "method=" << method->name() << " was canceled by user" << endl; + // don't quit immediately due to that the user might have canceled one method to use another + wasCanceled = true; + } else if (rc == SSH_AUTH_NEED_RECONNECT) { + kdDebug(TDEIO_SFTP_DB) << "method=" << method->name() << " requested reconnection" << endl; break; + } else if (rc == SSH_AUTH_DENIED) { + kdDebug(TDEIO_SFTP_DB) << "Auth for method=" << method->name() << " was denied" << endl; + // do nothing, just proceed with next auth method + } else { + // Shouldn't happen, but to be on the safe side better handle it + error(TDEIO::ERR_UNKNOWN, sshError(i18n("Authentication failed unexpectedly"))); + return; } } - } - } + + // At this point rc values should be one of: + // SSH_AUTH_SUCCESS, SSH_AUTH_PARTIAL, SSH_AUTH_DENIED, SSH_AUTH_CANCELED or SSH_AUTH_NEED_RECONNECT + if(rc == SSH_AUTH_NEED_RECONNECT) { + closeConnection(); //< have to do it manually + break; + } else if (wasCanceled && (rc == SSH_AUTH_CANCELED || rc == SSH_AUTH_DENIED)) { + error(TDEIO::ERR_USER_CANCELED, TQString::null); + return; + } else if (rc != SSH_AUTH_SUCCESS && rc != SSH_AUTH_PARTIAL) { + TQString errMsg = i18n("Authentication denied (attempted methods: %1).") + .arg(SSHAuthMethod::bitsetToStr(attemptedMethods).join(", ")); + if (availableMethodes & ~supportedMethods) { + errMsg.append("\n") + .append(i18n("Note: server also declares some unsupported authentication methods (%1)") + .arg(SSHAuthMethod::bitsetToStr(availableMethodes & ~supportedMethods).join(", "))); + } + error(TDEIO::ERR_COULD_NOT_LOGIN, errMsg); + return; + } + } // while (rc != SSH_AUTH_SUCCESS) + } while(rc == SSH_AUTH_NEED_RECONNECT); + // start sftp session kdDebug(TDEIO_SFTP_DB) << "Trying to request the sftp session" << endl; mSftp = sftp_new(mSession); if (mSftp == NULL) { - closeConnection(); error(TDEIO::ERR_COULD_NOT_LOGIN, i18n("Unable to request the SFTP subsystem. " "Make sure SFTP is enabled on the server.")); return; @@ -857,34 +1266,19 @@ void sftpProtocol::openConnection() { kdDebug(TDEIO_SFTP_DB) << "Trying to initialize the sftp session" << endl; if (sftp_init(mSftp) < 0) { - closeConnection(); error(TDEIO::ERR_COULD_NOT_LOGIN, i18n("Could not initialize the SFTP session.")); return; } // Login succeeded! infoMessage(i18n("Successfully connected to %1").arg(mHost)); - info.url.setProtocol("sftp"); - info.url.setHost(mHost); - info.url.setPort(mPort); - info.url.setUser(mUsername); - info.username = mUsername; - info.password = mPassword; - - kdDebug(TDEIO_SFTP_DB) << "Caching info.username = " << info.username - << ", info.url = " << info.url.prettyURL() << endl; - - cacheAuthentication(info); //setTimeoutSpecialCommand(TDEIO_SFTP_SPECIAL_TIMEOUT); mConnected = true; - connected(); + connectionCloser.abort(); - mPassword.fill('x'); - mPassword = ""; - info.password.fill('x'); - info.password = ""; + connected(); return; } @@ -925,7 +1319,7 @@ void sftpProtocol::special(const TQByteArray &data) { } if (rc < 0) { - kdDebug(TDEIO_SFTP_DB) << "channel_poll failed: " << ssh_get_error(mSession); + kdDebug(TDEIO_SFTP_DB) << "channel_poll failed: " << ssh_get_error(mSession) << endl; } setTimeoutSpecialCommand(TDEIO_SFTP_SPECIAL_TIMEOUT); @@ -1833,12 +2227,3 @@ void sftpProtocol::slave_status() { kdDebug(TDEIO_SFTP_DB) << "connected to " << mHost << "?: " << mConnected << endl; slaveStatus((mConnected ? mHost : TQString()), mConnected); } - -void sftpProtocol::clearPubKeyAuthInfo() -{ - if (!pubKeyInfo) - { - delete pubKeyInfo; - pubKeyInfo = nullptr; - } -} diff --git a/tdeioslave/sftp/tdeio_sftp.h b/tdeioslave/sftp/tdeio_sftp.h index 8e46d815c..75b295cfd 100644 --- a/tdeioslave/sftp/tdeio_sftp.h +++ b/tdeioslave/sftp/tdeio_sftp.h @@ -31,6 +31,7 @@ #include <tdeio/slavebase.h> #include <kdebug.h> #include <stdint.h> +#include <memory> #include <libssh/libssh.h> #include <libssh/sftp.h> @@ -95,10 +96,18 @@ public: void log_callback(ssh_session session, int priority, const char *message, void *userdata); + // Callbacks for SSHAuthMethod-derived strategies + int authenticatePublicKey(); + int authenticateKeyboardInteractive(bool noPaswordQuery = false); + int authenticatePassword(bool noPaswordQuery = false); + + /** Some extra authentication failure reasons intended to use alongside was declared in libssh */ + enum extra_ssh_auth_e { + SSH_AUTH_CANCELED=128, //< user canceled password entry dialog + SSH_AUTH_NEED_RECONNECT //< it is required to reinitialize connection from scratch + }; private: // Private variables - void statMime(const KURL &url); - void closeFile(); /** True if ioslave is connected to sftp server. */ bool mConnected; @@ -114,10 +123,16 @@ private: // Private variables /** The sftp session for the connection */ sftp_session mSftp; - /** Username to use when connecting */ + /** Username to use when connecting, Note: it's the one passed in the URL */ TQString mUsername; - /** User's password */ + /** Username to use with the next connection attempt: it's either from the cached data or from + * the password dialog that was prompted to the user. */ + TQString mCachedUsername; + + /** User's password. Note: the password would be set only if it was somehow cached: passed to + * setHost(), received from passwdserver's cache or was entered by user before reconnection + */ TQString mPassword; /** The open file */ @@ -138,12 +153,39 @@ private: // Private variables // TQString text; //}; - TDEIO::AuthInfo *pubKeyInfo; + /** Some data needed to interact with auth_callback() */ + struct { + /** List of keys user was already prompted to enter the passphrase for. + * Note: Under most sane circumstances the list shouldn't go beyond size=2, + * so no fancy containers here + */ + TQStringList attemptedKeys; + /** A backup for SlaveBase::s_seqNr to pass the same value to prompts for different keys */ + long current_seqNr; + /** true if callback was called */ + bool wasCalled; + /** true if user canceled all passphrase entry dialogues */ + bool wasCanceled; + } mPubKeyAuthData; + + /** true if the password dialog was prompted to the user at leas once */ + bool mPasswordWasPrompted = false; private: // private methods + void statMime(const KURL &url); + void closeFile(); - int authenticateKeyboardInteractive(TDEIO::AuthInfo &info); - void clearPubKeyAuthInfo(); + /** @returns username used by libssh during the connection */ + TQString sshUsername(); + + /** Adds ssh error (if any) to the given message string */ + TQString sshError(TQString errMsg=TQString()); + + /** A small helper function to construct auth info skeleton for the protocol */ + TDEIO::AuthInfo authInfo(); + + /** A helper function encapsulating creation of an ssh connection before authentication */ + int initializeConnection(); void reportError(const KURL &url, const int err); @@ -153,4 +195,25 @@ private: // private methods TQString canonicalizePath(const TQString &path); }; +/** A base class for ssh authentication methods. */ +class SSHAuthMethod { +public: + /** libssh's flag for he method */ + virtual unsigned flag() = 0; + /** The user-friendly (probably translated) name of the method */ + virtual TQString name() {return flagToStr(flag());} + /** Actually do perform the auth process */ + virtual int authenticate(sftpProtocol *ioslave) const = 0; + /** Creates a copy of derived class */ + virtual SSHAuthMethod* clone() = 0; + + virtual ~SSHAuthMethod() {}; + + /** Returns a name for the given libssh auth method flag */ + static TQString flagToStr(unsigned method); + + /** Returns a list of names for all the methods set in the given libssh auth method bitset */ + static TQStringList bitsetToStr(unsigned method); +}; + #endif diff --git a/tdeioslave/smb/tdeio_smb.cpp b/tdeioslave/smb/tdeio_smb.cpp index 28c54b3ac..d21af7e4f 100644 --- a/tdeioslave/smb/tdeio_smb.cpp +++ b/tdeioslave/smb/tdeio_smb.cpp @@ -56,7 +56,7 @@ SMBSlave::~SMBSlave() SMBSlave* G_TheSlave; //=========================================================================== -int KDE_EXPORT kdemain( int argc, char **argv ) +int TDE_EXPORT kdemain( int argc, char **argv ) { TDEInstance instance( "tdeio_smb" ); diff --git a/tdeioslave/smb/tdeio_smb.h b/tdeioslave/smb/tdeio_smb.h index 56c296c31..f56b11cbd 100644 --- a/tdeioslave/smb/tdeio_smb.h +++ b/tdeioslave/smb/tdeio_smb.h @@ -49,7 +49,7 @@ // KDE includes //-------------- #include <kdebug.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdeio/global.h> #include <tdeio/slavebase.h> #include <kurl.h> diff --git a/tdeioslave/smb/tdeio_smb_auth.cpp b/tdeioslave/smb/tdeio_smb_auth.cpp index 87dd8c026..e025f837e 100644 --- a/tdeioslave/smb/tdeio_smb_auth.cpp +++ b/tdeioslave/smb/tdeio_smb_auth.cpp @@ -32,7 +32,7 @@ #include "tdeio_smb.h" #include "tdeio_smb_internal.h" -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #include <tqdir.h> #include <stdlib.h> @@ -163,7 +163,7 @@ bool SMBSlave::auth_initialize_smbc() if(m_initialized_smbc == false) { kdDebug(TDEIO_SMB) << "smbc_init call" << endl; - KSimpleConfig cfg( "tdeioslaverc", true ); + TDESimpleConfig cfg( "tdeioslaverc", true ); cfg.setGroup( "SMB" ); int debug_level = cfg.readNumEntry( "DebugLevel", 0 ); diff --git a/tdeioslave/smb/tdeio_smb_mount.cpp b/tdeioslave/smb/tdeio_smb_mount.cpp index 0aef92698..ea4928bec 100644 --- a/tdeioslave/smb/tdeio_smb_mount.cpp +++ b/tdeioslave/smb/tdeio_smb_mount.cpp @@ -19,11 +19,11 @@ */ #include "tdeio_smb.h" -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tqcstring.h> #include <unistd.h> #include <tqdir.h> -#include <kprocess.h> +#include <tdeprocess.h> void SMBSlave::readOutput(TDEProcess *, char *buffer, int buflen) { @@ -113,11 +113,11 @@ void SMBSlave::special( const TQByteArray & data) proc << TDEProcess::quote(mountPoint.local8Bit()); proc << options; - connect(&proc, TQT_SIGNAL( receivedStdout(TDEProcess *, char *, int )), - TQT_SLOT(readOutput(TDEProcess *, char *, int))); + connect(&proc, TQ_SIGNAL( receivedStdout(TDEProcess *, char *, int )), + TQ_SLOT(readOutput(TDEProcess *, char *, int))); - connect(&proc, TQT_SIGNAL( receivedStderr(TDEProcess *, char *, int )), - TQT_SLOT(readStdErr(TDEProcess *, char *, int))); + connect(&proc, TQ_SIGNAL( receivedStderr(TDEProcess *, char *, int )), + TQ_SLOT(readStdErr(TDEProcess *, char *, int))); if (!proc.start( TDEProcess::Block, TDEProcess::AllOutput )) { @@ -154,11 +154,11 @@ void SMBSlave::special( const TQByteArray & data) mybuf.truncate(0); mystderr.truncate(0); - connect(&proc, TQT_SIGNAL( receivedStdout(TDEProcess *, char *, int )), - TQT_SLOT(readOutput(TDEProcess *, char *, int))); + connect(&proc, TQ_SIGNAL( receivedStdout(TDEProcess *, char *, int )), + TQ_SLOT(readOutput(TDEProcess *, char *, int))); - connect(&proc, TQT_SIGNAL( receivedStderr(TDEProcess *, char *, int )), - TQT_SLOT(readStdErr(TDEProcess *, char *, int))); + connect(&proc, TQ_SIGNAL( receivedStderr(TDEProcess *, char *, int )), + TQ_SLOT(readStdErr(TDEProcess *, char *, int))); if ( !proc.start( TDEProcess::Block, TDEProcess::AllOutput ) ) { diff --git a/tdeioslave/smtp/interactivesmtpserver.cpp b/tdeioslave/smtp/interactivesmtpserver.cpp index 4055a47a4..ed13d7253 100644 --- a/tdeioslave/smtp/interactivesmtpserver.cpp +++ b/tdeioslave/smtp/interactivesmtpserver.cpp @@ -55,8 +55,8 @@ InteractiveSMTPServerWindow::~InteractiveSMTPServerWindow() { if ( mSocket ) { mSocket->close(); if ( mSocket->state() == TQSocket::Closing ) - connect( mSocket, TQT_SIGNAL(delayedCloseFinished()), - mSocket, TQT_SLOT(deleteLater()) ); + connect( mSocket, TQ_SIGNAL(delayedCloseFinished()), + mSocket, TQ_SLOT(deleteLater()) ); else mSocket->deleteLater(); mSocket = 0; @@ -108,17 +108,17 @@ InteractiveSMTPServerWindow::InteractiveSMTPServerWindow( TQSocket * socket, TQW hlay->addWidget( mLineEdit, 1 ); hlay->addWidget( but ); - connect( mLineEdit, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotSendResponse()) ); - connect( but, TQT_SIGNAL(clicked()), TQT_SLOT(slotSendResponse()) ); + connect( mLineEdit, TQ_SIGNAL(returnPressed()), TQ_SLOT(slotSendResponse()) ); + connect( but, TQ_SIGNAL(clicked()), TQ_SLOT(slotSendResponse()) ); but = new TQPushButton( "&Close Connection", this ); vlay->addWidget( but ); - connect( but, TQT_SIGNAL(clicked()), TQT_SLOT(slotConnectionClosed()) ); + connect( but, TQ_SIGNAL(clicked()), TQ_SLOT(slotConnectionClosed()) ); - connect( socket, TQT_SIGNAL(connectionClosed()), TQT_SLOT(slotConnectionClosed()) ); - connect( socket, TQT_SIGNAL(error(int)), TQT_SLOT(slotError(int)) ); - connect( socket, TQT_SIGNAL(readyRead()), TQT_SLOT(slotReadyRead()) ); + connect( socket, TQ_SIGNAL(connectionClosed()), TQ_SLOT(slotConnectionClosed()) ); + connect( socket, TQ_SIGNAL(error(int)), TQ_SLOT(slotError(int)) ); + connect( socket, TQ_SIGNAL(readyRead()), TQ_SLOT(slotReadyRead()) ); mLineEdit->setText( "220 hi there" ); mLineEdit->setFocus(); diff --git a/tdeioslave/smtp/smtp.cpp b/tdeioslave/smtp/smtp.cpp index 00dff3684..1197de853 100644 --- a/tdeioslave/smtp/smtp.cpp +++ b/tdeioslave/smtp/smtp.cpp @@ -61,7 +61,7 @@ using KioSMTP::TransactionState; #include <tdeemailsettings.h> #include <ksock.h> #include <kdebug.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdeio/connection.h> #include <tdeio/slaveinterface.h> #include <tdelocale.h> @@ -71,7 +71,6 @@ using KioSMTP::TransactionState; #include <tqcstring.h> #include <memory> -using std::auto_ptr; #include <ctype.h> #include <stdlib.h> @@ -91,7 +90,7 @@ using std::auto_ptr; extern "C" { - KDE_EXPORT int kdemain(int argc, char **argv); + TDE_EXPORT int kdemain(int argc, char **argv); } int kdemain(int argc, char **argv) @@ -446,8 +445,8 @@ void SMTPProtocol::queueCommand( int type ) { } bool SMTPProtocol::execute( int type, TransactionState * ts ) { - auto_ptr<Command> cmd( Command::createSimpleCommand( type, this ) ); - kdFatal( !cmd.get(), 7112 ) << "Command::createSimpleCommand( " << type << " ) returned null!" << endl; + std::unique_ptr<Command> cmd( Command::createSimpleCommand( type, this ) ); + kdFatal( !cmd, 7112 ) << "Command::createSimpleCommand( " << type << " ) returned null!" << endl; return execute( cmd.get(), ts ); } diff --git a/tdeioslave/system/kdedmodule/systemdirnotify.cpp b/tdeioslave/system/kdedmodule/systemdirnotify.cpp index 059c7cfc9..80e27d212 100644 --- a/tdeioslave/system/kdedmodule/systemdirnotify.cpp +++ b/tdeioslave/system/kdedmodule/systemdirnotify.cpp @@ -21,8 +21,8 @@ #include <kdebug.h> #include <tdelocale.h> #include <tdeglobal.h> -#include <kstandarddirs.h> -#include <kdesktopfile.h> +#include <tdestandarddirs.h> +#include <tdedesktopfile.h> #include <kdirnotify_stub.h> @@ -65,7 +65,7 @@ void SystemDirNotify::init() { if (!names_found.contains(*name)) { - KDesktopFile desktop(*dirpath+*name, true); + TDEDesktopFile desktop(*dirpath+*name, true); TQString system_name = *name; system_name.truncate(system_name.length()-8); diff --git a/tdeioslave/system/kdedmodule/systemdirnotifymodule.cpp b/tdeioslave/system/kdedmodule/systemdirnotifymodule.cpp index ec95c0e32..7b12ffb7f 100644 --- a/tdeioslave/system/kdedmodule/systemdirnotifymodule.cpp +++ b/tdeioslave/system/kdedmodule/systemdirnotifymodule.cpp @@ -28,7 +28,7 @@ SystemDirNotifyModule::SystemDirNotifyModule(const TQCString &obj) } extern "C" { - KDE_EXPORT KDEDModule *create_systemdirnotify(const TQCString &obj) + TDE_EXPORT KDEDModule *create_systemdirnotify(const TQCString &obj) { TDEGlobal::locale()->insertCatalogue("tdeio_system"); return new SystemDirNotifyModule(obj); diff --git a/tdeioslave/system/systemimpl.cpp b/tdeioslave/system/systemimpl.cpp index 21a9da7da..52f1ace36 100644 --- a/tdeioslave/system/systemimpl.cpp +++ b/tdeioslave/system/systemimpl.cpp @@ -21,8 +21,8 @@ #include <kdebug.h> #include <tdeglobalsettings.h> -#include <kstandarddirs.h> -#include <kdesktopfile.h> +#include <tdestandarddirs.h> +#include <tdedesktopfile.h> #include <tqapplication.h> #include <tqeventloop.h> @@ -169,7 +169,7 @@ KURL SystemImpl::findBaseURL(const TQString &filename) const { if (*name==filename+".desktop") { - KDesktopFile desktop(*dirpath+filename+".desktop", true); + TDEDesktopFile desktop(*dirpath+filename+".desktop", true); if ( desktop.readURL().isEmpty() ) { KURL url; @@ -226,7 +226,7 @@ TQString SystemImpl::readPathINL(TQString filename) line = s.readLine(); } if (isPathExpanded == false) { - KDesktopFile desktop(filename, true); + TDEDesktopFile desktop(filename, true); return desktop.readPath(); } else { @@ -240,7 +240,7 @@ void SystemImpl::createEntry(TDEIO::UDSEntry &entry, { kdDebug() << "SystemImpl::createEntry" << endl; - KDesktopFile desktop(directory+file, true); + TDEDesktopFile desktop(directory+file, true); kdDebug() << "path = " << directory << file << endl; @@ -279,12 +279,12 @@ void SystemImpl::createEntry(TDEIO::UDSEntry &entry, m_lastListingEmpty = true; TDEIO::ListJob *job = TDEIO::listDir(url, false, false); - connect( job, TQT_SIGNAL( entries(TDEIO::Job *, + connect( job, TQ_SIGNAL( entries(TDEIO::Job *, const TDEIO::UDSEntryList &) ), - this, TQT_SLOT( slotEntries(TDEIO::Job *, + this, TQ_SLOT( slotEntries(TDEIO::Job *, const TDEIO::UDSEntryList &) ) ); - connect( job, TQT_SIGNAL( result(TDEIO::Job *) ), - this, TQT_SLOT( slotResult(TDEIO::Job *) ) ); + connect( job, TQ_SIGNAL( result(TDEIO::Job *) ), + this, TQ_SLOT( slotResult(TDEIO::Job *) ) ); tqApp->eventLoop()->enterLoop(); if (m_lastListingEmpty) icon = empty_icon; diff --git a/tdeioslave/system/systemimpl.h b/tdeioslave/system/systemimpl.h index d4cc0e1cb..41d0242a3 100644 --- a/tdeioslave/system/systemimpl.h +++ b/tdeioslave/system/systemimpl.h @@ -22,7 +22,7 @@ #include <tdeio/global.h> #include <tdeio/job.h> -#include <kdesktopfile.h> +#include <tdedesktopfile.h> #include <kurl.h> #include <dcopobject.h> diff --git a/tdeioslave/system/tdeio_system.cpp b/tdeioslave/system/tdeio_system.cpp index 54dd0da6d..76bfc7f82 100644 --- a/tdeioslave/system/tdeio_system.cpp +++ b/tdeioslave/system/tdeio_system.cpp @@ -39,7 +39,7 @@ static const TDECmdLineOptions options[] = }; extern "C" { - KDE_EXPORT int kdemain( int argc, char **argv ) + TDE_EXPORT int kdemain( int argc, char **argv ) { // TDEApplication is necessary to use other ioslaves putenv(strdup("SESSION_MANAGER=")); diff --git a/tdeioslave/tar/ktartest.cpp b/tdeioslave/tar/ktartest.cpp index efb1e42fe..2fe00d32c 100644 --- a/tdeioslave/tar/ktartest.cpp +++ b/tdeioslave/tar/ktartest.cpp @@ -1,7 +1,7 @@ #include "ktar.h" #include <stdio.h> #include <tqfile.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <kdebug.h> void recursive_print( const KTarDirectory * dir, const TQString & path ) diff --git a/tdeioslave/tar/tar.cpp b/tdeioslave/tar/tar.cpp index b7ba70687..a006d537f 100644 --- a/tdeioslave/tar/tar.cpp +++ b/tdeioslave/tar/tar.cpp @@ -12,7 +12,7 @@ #include <tdeglobal.h> #include <kurl.h> #include <kdebug.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <ktar.h> #include <kzip.h> #include <kar.h> @@ -28,7 +28,7 @@ using namespace TDEIO; -extern "C" { int KDE_EXPORT kdemain(int argc, char **argv); } +extern "C" { int TDE_EXPORT kdemain(int argc, char **argv); } int kdemain( int argc, char **argv ) { diff --git a/tdeioslave/thumbnail/cursorcreator.cpp b/tdeioslave/thumbnail/cursorcreator.cpp index a8f6a2eb9..42a573d1d 100644 --- a/tdeioslave/thumbnail/cursorcreator.cpp +++ b/tdeioslave/thumbnail/cursorcreator.cpp @@ -20,7 +20,7 @@ #include <tqimage.h> #include <tqfile.h> -#include <kdemacros.h> +#include <tdemacros.h> #include "cursorcreator.h" @@ -29,7 +29,7 @@ extern "C" { - KDE_EXPORT ThumbCreator *new_creator() + TDE_EXPORT ThumbCreator *new_creator() { return new CursorCreator; } diff --git a/tdeioslave/thumbnail/djvucreator.cpp b/tdeioslave/thumbnail/djvucreator.cpp index 20a32fb26..31b4fcfe1 100644 --- a/tdeioslave/thumbnail/djvucreator.cpp +++ b/tdeioslave/thumbnail/djvucreator.cpp @@ -39,7 +39,7 @@ #include <tqfile.h> #include <tqimage.h> -#include <kdemacros.h> +#include <tdemacros.h> #include "djvucreator.h" @@ -47,7 +47,7 @@ extern "C" { - KDE_EXPORT ThumbCreator *new_creator() + TDE_EXPORT ThumbCreator *new_creator() { return new DjVuCreator; } diff --git a/tdeioslave/thumbnail/exrcreator.cpp b/tdeioslave/thumbnail/exrcreator.cpp index 9ec2dd706..5cc3fe277 100644 --- a/tdeioslave/thumbnail/exrcreator.cpp +++ b/tdeioslave/thumbnail/exrcreator.cpp @@ -33,7 +33,7 @@ extern "C" { - KDE_EXPORT ThumbCreator *new_creator() + TDE_EXPORT ThumbCreator *new_creator() { return new EXRCreator; } diff --git a/tdeioslave/thumbnail/htmlcreator.cpp b/tdeioslave/thumbnail/htmlcreator.cpp index 34742a0e9..0a0bac58e 100644 --- a/tdeioslave/thumbnail/htmlcreator.cpp +++ b/tdeioslave/thumbnail/htmlcreator.cpp @@ -29,7 +29,7 @@ extern "C" { - KDE_EXPORT ThumbCreator *new_creator() + TDE_EXPORT ThumbCreator *new_creator() { return new HTMLCreator; } @@ -50,7 +50,7 @@ bool HTMLCreator::create(const TQString &path, int width, int height, TQImage &i if (!m_html) { m_html = new TDEHTMLPart; - connect(m_html, TQT_SIGNAL(completed()), TQT_SLOT(slotCompleted())); + connect(m_html, TQ_SIGNAL(completed()), TQ_SLOT(slotCompleted())); m_html->setJScriptEnabled(false); m_html->setJavaEnabled(false); m_html->setPluginsEnabled(false); diff --git a/tdeioslave/thumbnail/imagecreator.cpp b/tdeioslave/thumbnail/imagecreator.cpp index 259a8928f..80c34a577 100644 --- a/tdeioslave/thumbnail/imagecreator.cpp +++ b/tdeioslave/thumbnail/imagecreator.cpp @@ -28,7 +28,7 @@ extern "C" { - KDE_EXPORT ThumbCreator *new_creator() + TDE_EXPORT ThumbCreator *new_creator() { KImageIO::registerFormats(); return new ImageCreator; diff --git a/tdeioslave/thumbnail/imagethumbnail.desktop b/tdeioslave/thumbnail/imagethumbnail.desktop index d9b43e91b..a7ebf4a0b 100644 --- a/tdeioslave/thumbnail/imagethumbnail.desktop +++ b/tdeioslave/thumbnail/imagethumbnail.desktop @@ -4,6 +4,6 @@ Type=Service Name=Images X-TDE-ServiceTypes=ThumbCreator -MimeTypes=image/cgm,image/fax-g3,image/gif,image/jp2,image/jpeg,image/pjpeg,image/png,image/tiff,image/x-bmp,image/x-dds,image/x-ico,image/x-jng,image/x-pcx,image/x-photo-cd,image/x-portable-bitmap,image/x-portable-greymap,image/x-portable-pixmap,image/x-rgb,image/x-targa,image/x-wmf,image/x-xbm,image/x-xcf-gimp,image/x-xfig,image/x-xpm +MimeTypes=image/cgm,image/fax-g3,image/gif,image/jp2,image/jpeg,image/pjpeg,image/png,image/tiff,image/webp,image/x-bmp,image/x-dds,image/x-ico,image/x-jng,image/x-pcx,image/x-photo-cd,image/x-portable-bitmap,image/x-portable-greymap,image/x-portable-pixmap,image/x-rgb,image/x-targa,image/x-wmf,image/x-xbm,image/x-xcf-gimp,image/x-xfig,image/x-xpm X-TDE-Library=imagethumbnail CacheThumbnail=true diff --git a/tdeioslave/thumbnail/textcreator.cpp b/tdeioslave/thumbnail/textcreator.cpp index 13f3ba83f..8d8e378e3 100644 --- a/tdeioslave/thumbnail/textcreator.cpp +++ b/tdeioslave/thumbnail/textcreator.cpp @@ -22,7 +22,7 @@ #include <tqpixmap.h> #include <tqimage.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <kpixmapsplitter.h> #include <kmimetype.h> @@ -30,7 +30,7 @@ extern "C" { - KDE_EXPORT ThumbCreator *new_creator() + TDE_EXPORT ThumbCreator *new_creator() { return new TextCreator; } diff --git a/tdeioslave/thumbnail/thumbnail.cpp b/tdeioslave/thumbnail/thumbnail.cpp index 98b01138c..9d3e16498 100644 --- a/tdeioslave/thumbnail/thumbnail.cpp +++ b/tdeioslave/thumbnail/thumbnail.cpp @@ -85,7 +85,7 @@ using namespace TDEIO; extern "C" { - KDE_EXPORT int kdemain(int argc, char **argv); + TDE_EXPORT int kdemain(int argc, char **argv); } diff --git a/tdeioslave/trash/discspaceutil.cpp b/tdeioslave/trash/discspaceutil.cpp index 186cb0e7f..bca944e39 100644 --- a/tdeioslave/trash/discspaceutil.cpp +++ b/tdeioslave/trash/discspaceutil.cpp @@ -52,10 +52,17 @@ unsigned long DiscSpaceUtil::sizeOfPath( const TQString &path ) TQFileInfoListIterator it( *infos ); unsigned long sum = 0; - TQFileInfo *info = 0; - while ( (info = it.current()) != 0 ) { - if ( info->fileName() != "." && info->fileName() != ".." ) - sum += sizeOfPath( info->absFilePath() ); + const TQFileInfo *info = nullptr; + while ((info = it.current())) + { + if (info->isFile()) + { + sum += info->size(); + } + else if (info->fileName() != "." && info->fileName() != "..") + { + sum += sizeOfPath(info->absFilePath()); + } ++it; } @@ -102,9 +109,9 @@ void DiscSpaceUtil::done() void DiscSpaceUtil::calculateFullSize() { KDiskFreeSp *sp = KDiskFreeSp::findUsageInfo( mDirectory ); - connect( sp, TQT_SIGNAL( foundMountPoint( const TQString&, unsigned long, unsigned long, unsigned long ) ), - this, TQT_SLOT( foundMountPoint( const TQString&, unsigned long, unsigned long, unsigned long ) ) ); - connect( sp, TQT_SIGNAL( done() ), this, TQT_SLOT( done() ) ); + connect( sp, TQ_SIGNAL( foundMountPoint( const TQString&, unsigned long, unsigned long, unsigned long ) ), + this, TQ_SLOT( foundMountPoint( const TQString&, unsigned long, unsigned long, unsigned long ) ) ); + connect( sp, TQ_SIGNAL( done() ), this, TQ_SLOT( done() ) ); tqApp->eventLoop()->enterLoop(); } diff --git a/tdeioslave/trash/kcmtrash.cpp b/tdeioslave/trash/kcmtrash.cpp index 4747e092a..06c458593 100644 --- a/tdeioslave/trash/kcmtrash.cpp +++ b/tdeioslave/trash/kcmtrash.cpp @@ -29,7 +29,7 @@ extern "C" { - KDE_EXPORT TDECModule *create_trash(TQWidget *parent, const char *) + TDE_EXPORT TDECModule *create_trash(TQWidget *parent, const char *) { return new TrashModule(parent, "kcmtrash"); } @@ -51,7 +51,7 @@ TrashModule::TrashModule(TQWidget *parent, const char *name) policyWidget = new KTrashPropsWidget(this); tab->addTab(policyWidget, i18n("&Trash Policy")); - connect(policyWidget, TQT_SIGNAL(changed(bool)), TQT_SIGNAL(changed(bool))); + connect(policyWidget, TQ_SIGNAL(changed(bool)), TQ_SIGNAL(changed(bool))); TQVBoxLayout *top = new TQVBoxLayout(this); top->addWidget(tab); diff --git a/tdeioslave/trash/ktrashpropsdlgplugin.cpp b/tdeioslave/trash/ktrashpropsdlgplugin.cpp index 067c10b6e..76882f956 100644 --- a/tdeioslave/trash/ktrashpropsdlgplugin.cpp +++ b/tdeioslave/trash/ktrashpropsdlgplugin.cpp @@ -35,7 +35,7 @@ #include <tqradiobutton.h> #include <tqspinbox.h> -#include <kdesktopfile.h> +#include <tdedesktopfile.h> #include <kgenericfactory.h> #include <tdeglobal.h> #include <kiconloader.h> @@ -63,7 +63,7 @@ KTrashPropsDlgPlugin::KTrashPropsDlgPlugin( KPropertiesDialog *dialog, const cha if (!KPropsDlgPlugin::isDesktopFile(item)) return; - KDesktopFile deskFile( itemUrl.path(), true /* readonly */ ); + TDEDesktopFile deskFile( itemUrl.path(), true /* readonly */ ); if ( deskFile.readURL() != "trash:/" ) return; } @@ -74,7 +74,7 @@ KTrashPropsDlgPlugin::KTrashPropsDlgPlugin( KPropertiesDialog *dialog, const cha policyWidget = new KTrashPropsWidget(frame); TQVBoxLayout *vLayout = new TQVBoxLayout(frame, 0, 0); vLayout->addWidget(policyWidget); - connect(policyWidget, TQT_SIGNAL(changed(bool)), TQT_SLOT(setDirty())); + connect(policyWidget, TQ_SIGNAL(changed(bool)), TQ_SLOT(setDirty())); } KTrashPropsDlgPlugin::~KTrashPropsDlgPlugin() diff --git a/tdeioslave/trash/ktrashpropswidget.cpp b/tdeioslave/trash/ktrashpropswidget.cpp index 40e12cb4f..2040e9a76 100644 --- a/tdeioslave/trash/ktrashpropswidget.cpp +++ b/tdeioslave/trash/ktrashpropswidget.cpp @@ -50,15 +50,15 @@ KTrashPropsWidget::KTrashPropsWidget(TQWidget *parent, const char *name) mTrashImpl->init(); setupGui(); - connect(mUseTimeLimit, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(useTypeChanged())); - connect(mDays, TQT_SIGNAL(valueChanged(int)),this, TQT_SLOT(setDirty())); - connect(mUseSizeLimit, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(useTypeChanged())); - connect(mPercentSize, TQT_SIGNAL(valueChanged(double)), this, TQT_SLOT(percentSizeChanged(double))); - connect(mFixedSize, TQT_SIGNAL(valueChanged(double)), this, TQT_SLOT(fixedSizeChanged(double))); - connect(mFixedSizeUnit, TQT_SIGNAL(activated(int)), this, TQT_SLOT(fixedSizeUnitActivated(int))); - connect(mRbPercentSize, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(rbPercentSizeToggled(bool))); - connect(mRbFixedSize, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(rbFixedSizeToggled(bool))); - connect(mLimitReachedAction, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setDirty())); + connect(mUseTimeLimit, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(useTypeChanged())); + connect(mDays, TQ_SIGNAL(valueChanged(int)),this, TQ_SLOT(setDirty())); + connect(mUseSizeLimit, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(useTypeChanged())); + connect(mPercentSize, TQ_SIGNAL(valueChanged(double)), this, TQ_SLOT(percentSizeChanged(double))); + connect(mFixedSize, TQ_SIGNAL(valueChanged(double)), this, TQ_SLOT(fixedSizeChanged(double))); + connect(mFixedSizeUnit, TQ_SIGNAL(activated(int)), this, TQ_SLOT(fixedSizeUnitActivated(int))); + connect(mRbPercentSize, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(rbPercentSizeToggled(bool))); + connect(mRbFixedSize, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(rbFixedSizeToggled(bool))); + connect(mLimitReachedAction, TQ_SIGNAL(activated(int)), this, TQ_SLOT(setDirty())); inhibitChangedSignal = true; load(); @@ -87,7 +87,7 @@ void KTrashPropsWidget::setupGui() mountPoints->insertItem(folderPixmap, util.mountPoint(), it.key()); } mountPoints->setCurrentItem(0); - connect(mountPoints, TQT_SIGNAL(highlighted(int)), TQT_SLOT(trashChanged(int))); + connect(mountPoints, TQ_SIGNAL(highlighted(int)), TQ_SLOT(trashChanged(int))); } mCurrentTrash = map[0]; diff --git a/tdeioslave/trash/tdeio_trash.cpp b/tdeioslave/trash/tdeio_trash.cpp index eeb0f600b..5fc21a350 100644 --- a/tdeioslave/trash/tdeio_trash.cpp +++ b/tdeioslave/trash/tdeio_trash.cpp @@ -26,7 +26,7 @@ #include <klargefile.h> #include <tdecmdlineargs.h> #include <kmimetype.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <dcopclient.h> #include <tqdatastream.h> @@ -50,7 +50,7 @@ static const TDECmdLineOptions options[] = }; extern "C" { - int KDE_EXPORT kdemain( int argc, char **argv ) + int TDE_EXPORT kdemain( int argc, char **argv ) { //TDEInstance instance( "tdeio_trash" ); // TDEApplication is necessary to use tdeio_file @@ -533,12 +533,12 @@ void TrashProtocol::get( const KURL& url ) KURL fileURL; fileURL.setPath( physicalPath ); TDEIO::Job* job = TDEIO::get( fileURL ); - connect( job, TQT_SIGNAL( data( TDEIO::Job*, const TQByteArray& ) ), - this, TQT_SLOT( slotData( TDEIO::Job*, const TQByteArray& ) ) ); - connect( job, TQT_SIGNAL( mimetype( TDEIO::Job*, const TQString& ) ), - this, TQT_SLOT( slotMimetype( TDEIO::Job*, const TQString& ) ) ); - connect( job, TQT_SIGNAL( result(TDEIO::Job *) ), - this, TQT_SLOT( jobFinished(TDEIO::Job *) ) ); + connect( job, TQ_SIGNAL( data( TDEIO::Job*, const TQByteArray& ) ), + this, TQ_SLOT( slotData( TDEIO::Job*, const TQByteArray& ) ) ); + connect( job, TQ_SIGNAL( mimetype( TDEIO::Job*, const TQString& ) ), + this, TQ_SLOT( slotMimetype( TDEIO::Job*, const TQString& ) ) ); + connect( job, TQ_SIGNAL( result(TDEIO::Job *) ), + this, TQ_SLOT( jobFinished(TDEIO::Job *) ) ); tqApp->eventLoop()->enterLoop(); } diff --git a/tdeioslave/trash/testtrash.cpp b/tdeioslave/trash/testtrash.cpp index 60fe2d1a6..84c0106d8 100644 --- a/tdeioslave/trash/testtrash.cpp +++ b/tdeioslave/trash/testtrash.cpp @@ -41,7 +41,7 @@ #include <unistd.h> #include <assert.h> #include <tdefileitem.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> static bool check(const TQString& txt, TQString a, TQString b) { @@ -372,7 +372,7 @@ static void checkInfoFile( const TQString& infoPath, const TQString& origFilePat TQFileInfo info( infoPath ); assert( info.exists() ); assert( info.isFile() ); - KSimpleConfig infoFile( info.absFilePath(), true ); + TDESimpleConfig infoFile( info.absFilePath(), true ); if ( !infoFile.hasGroup( "Trash Info" ) ) kdFatal() << "no Trash Info group in " << info.absFilePath() << endl; infoFile.setGroup( "Trash Info" ); @@ -476,7 +476,7 @@ void TestTrash::trashUmlautFileFromHome() void TestTrash::testTrashNotEmpty() { - KSimpleConfig cfg( "trashrc", true ); + TDESimpleConfig cfg( "trashrc", true ); assert( cfg.hasGroup( "Status" ) ); cfg.setGroup( "Status" ); assert( cfg.readBoolEntry( "Empty", true ) == false ); @@ -1094,8 +1094,8 @@ void TestTrash::listRootDir() m_entryCount = 0; m_listResult.clear(); TDEIO::ListJob* job = TDEIO::listDir( "trash:/" ); - connect( job, TQT_SIGNAL( entries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ), - TQT_SLOT( slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ) ); + connect( job, TQ_SIGNAL( entries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ), + TQ_SLOT( slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ) ); bool ok = TDEIO::NetAccess::synchronousRun( job, 0 ); assert( ok ); kdDebug() << "listDir done - m_entryCount=" << m_entryCount << endl; @@ -1111,8 +1111,8 @@ void TestTrash::listRecursiveRootDir() m_entryCount = 0; m_listResult.clear(); TDEIO::ListJob* job = TDEIO::listRecursive( "trash:/" ); - connect( job, TQT_SIGNAL( entries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ), - TQT_SLOT( slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ) ); + connect( job, TQ_SIGNAL( entries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ), + TQ_SLOT( slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ) ); bool ok = TDEIO::NetAccess::synchronousRun( job, 0 ); assert( ok ); kdDebug() << "listDir done - m_entryCount=" << m_entryCount << endl; @@ -1128,8 +1128,8 @@ void TestTrash::listSubDir() m_entryCount = 0; m_listResult.clear(); TDEIO::ListJob* job = TDEIO::listDir( "trash:/0-trashDirFromHome" ); - connect( job, TQT_SIGNAL( entries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ), - TQT_SLOT( slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ) ); + connect( job, TQ_SIGNAL( entries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ), + TQ_SLOT( slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ) ); bool ok = TDEIO::NetAccess::synchronousRun( job, 0 ); assert( ok ); kdDebug() << "listDir done - m_entryCount=" << m_entryCount << endl; @@ -1179,7 +1179,7 @@ void TestTrash::emptyTrash() bool ok = TDEIO::NetAccess::synchronousRun( job, 0 ); assert( ok ); - KSimpleConfig cfg( "trashrc", true ); + TDESimpleConfig cfg( "trashrc", true ); assert( cfg.hasGroup( "Status" ) ); cfg.setGroup( "Status" ); assert( cfg.readBoolEntry( "Empty", false ) == true ); diff --git a/tdeioslave/trash/trashimpl.cpp b/tdeioslave/trash/trashimpl.cpp index 8bfbbca8d..19078539c 100644 --- a/tdeioslave/trash/trashimpl.cpp +++ b/tdeioslave/trash/trashimpl.cpp @@ -29,7 +29,7 @@ #include <kurl.h> #include <kdirnotify_stub.h> #include <tdeglobal.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdeglobalsettings.h> #include <kmountpoint.h> #include <tdemessagebox.h> @@ -251,7 +251,7 @@ bool TrashImpl::createInfo( const TQString& origPath, int& trashId, TQString& fi return false; } - // Contents of the info file. We could use KSimpleConfig, but that would + // Contents of the info file. We could use TDESimpleConfig, but that would // mean closing and reopening fd, i.e. opening a race condition... TQCString info = "[Trash Info]\n"; info += "Path="; @@ -374,8 +374,8 @@ bool TrashImpl::move( const TQString& src, const TQString& dest ) #ifdef TDEIO_COPYJOB_HAS_SETINTERACTIVE job->setInteractive( false ); #endif - connect( job, TQT_SIGNAL( result(TDEIO::Job *) ), - this, TQT_SLOT( jobFinished(TDEIO::Job *) ) ); + connect( job, TQ_SIGNAL( result(TDEIO::Job *) ), + this, TQ_SLOT( jobFinished(TDEIO::Job *) ) ); tqApp->eventLoop()->enterLoop(); return m_lastErrorCode == 0; @@ -424,8 +424,8 @@ bool TrashImpl::copy( const TQString& src, const TQString& dest ) #ifdef TDEIO_COPYJOB_HAS_SETINTERACTIVE job->setInteractive( false ); #endif - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), - this, TQT_SLOT( jobFinished( TDEIO::Job* ) ) ); + connect( job, TQ_SIGNAL( result( TDEIO::Job* ) ), + this, TQ_SLOT( jobFinished( TDEIO::Job* ) ) ); tqApp->eventLoop()->enterLoop(); return m_lastErrorCode == 0; @@ -513,15 +513,15 @@ bool TrashImpl::synchronousDel( const TQString& path, bool setLastErrorCode, boo KFileItemList fileItemList; fileItemList.append( &fileItem ); TDEIO::ChmodJob* chmodJob = TDEIO::chmod( fileItemList, 0200, 0200, TQString::null, TQString::null, true /*recursive*/, false /*showProgressInfo*/ ); - connect( chmodJob, TQT_SIGNAL( result(TDEIO::Job *) ), - this, TQT_SLOT( jobFinished(TDEIO::Job *) ) ); + connect( chmodJob, TQ_SIGNAL( result(TDEIO::Job *) ), + this, TQ_SLOT( jobFinished(TDEIO::Job *) ) ); tqApp->eventLoop()->enterLoop(); } kdDebug() << k_funcinfo << "deleting " << url << endl; TDEIO::DeleteJob *job = TDEIO::del( url, false, false ); - connect( job, TQT_SIGNAL( result(TDEIO::Job *) ), - this, TQT_SLOT( jobFinished(TDEIO::Job *) ) ); + connect( job, TQ_SIGNAL( result(TDEIO::Job *) ), + this, TQ_SLOT( jobFinished(TDEIO::Job *) ) ); tqApp->eventLoop()->enterLoop(); bool ok = m_lastErrorCode == 0; if ( !setLastErrorCode ) { @@ -620,7 +620,7 @@ bool TrashImpl::infoForFile( int trashId, const TQString& fileId, TrashedFileInf bool TrashImpl::readInfoFile( const TQString& infoPath, TrashedFileInfo& info, int trashId ) { - KSimpleConfig cfg( infoPath, true ); + TDESimpleConfig cfg( infoPath, true ); if ( !cfg.hasGroup( "Trash Info" ) ) { error( TDEIO::ERR_CANNOT_OPEN_FOR_READING, infoPath ); return false; diff --git a/tdeioslave/trash/trashimpl.h b/tdeioslave/trash/trashimpl.h index 90032762d..6d96859f7 100644 --- a/tdeioslave/trash/trashimpl.h +++ b/tdeioslave/trash/trashimpl.h @@ -21,7 +21,7 @@ #define TRASHIMPL_H #include <tdeio/jobclasses.h> -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #include <tqstring.h> #include <tqdatetime.h> @@ -172,7 +172,7 @@ private: mutable bool m_trashDirectoriesScanned; int m_mibEnum; - KSimpleConfig m_config; + TDESimpleConfig m_config; // We don't cache any data related to the trashed files. // Another tdeioslave could change that behind our feet. |
