summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-09-17 10:24:36 (UTC)
committer zautrix <zautrix>2004-09-17 10:24:36 (UTC)
commite8dac946bcd8c080b9abb74b45221ca0c5f268c7 (patch) (unidiff)
treebbe396a67d21dbc8a4b97ecd9c34496509fa0d36 /korganizer
parent9421138854b85a9baced09649f617118502610c1 (diff)
downloadkdepimpi-e8dac946bcd8c080b9abb74b45221ca0c5f268c7.zip
kdepimpi-e8dac946bcd8c080b9abb74b45221ca0c5f268c7.tar.gz
kdepimpi-e8dac946bcd8c080b9abb74b45221ca0c5f268c7.tar.bz2
Bugfix in password asking in kopi syncing
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index b1c7709..b597a6a 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1934,97 +1934,103 @@ void MainWindow::syncRemote( KSyncProfile* prof, bool ask)
1934{ 1934{
1935 QString question; 1935 QString question;
1936 if ( ask ) { 1936 if ( ask ) {
1937 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; 1937 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n";
1938 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 1938 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
1939 question, 1939 question,
1940 i18n("Yes"), i18n("No"), 1940 i18n("Yes"), i18n("No"),
1941 0, 0 ) != 0 ) 1941 0, 0 ) != 0 )
1942 return; 1942 return;
1943 } 1943 }
1944 QString command = prof->getPreSyncCommand(); 1944 QString command = prof->getPreSyncCommand();
1945 int fi; 1945 int fi;
1946 if ( (fi = command.find("$PWD$")) > 0 ) { 1946 if ( (fi = command.find("$PWD$")) > 0 ) {
1947 QString pwd = getPassword(); 1947 QString pwd = getPassword();
1948 command = command.left( fi )+ pwd + command.mid( fi+5 ); 1948 command = command.left( fi )+ pwd + command.mid( fi+5 );
1949 1949
1950 } 1950 }
1951 int maxlen = 30; 1951 int maxlen = 30;
1952 if ( QApplication::desktop()->width() > 320 ) 1952 if ( QApplication::desktop()->width() > 320 )
1953 maxlen += 25; 1953 maxlen += 25;
1954 setCaption ( i18n( "Copy remote file to local machine..." ) ); 1954 setCaption ( i18n( "Copy remote file to local machine..." ) );
1955 int fileSize = 0; 1955 int fileSize = 0;
1956 int result = system ( command ); 1956 int result = system ( command );
1957 // 0 : okay 1957 // 0 : okay
1958 // 256: no such file or dir 1958 // 256: no such file or dir
1959 // 1959 //
1960 qDebug("KO: Remote copy result(0 = okay): %d ",result ); 1960 qDebug("KO: Remote copy result(0 = okay): %d ",result );
1961 if ( result != 0 ) { 1961 if ( result != 0 ) {
1962 int len = maxlen; 1962 int len = maxlen;
1963 while ( len < command.length() ) { 1963 while ( len < command.length() ) {
1964 command.insert( len , "\n" ); 1964 command.insert( len , "\n" );
1965 len += maxlen +2; 1965 len += maxlen +2;
1966 } 1966 }
1967 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; 1967 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ;
1968 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 1968 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
1969 question, 1969 question,
1970 i18n("Okay!")) ; 1970 i18n("Okay!")) ;
1971 setCaption ("KO/Pi"); 1971 setCaption ("KO/Pi");
1972 return; 1972 return;
1973 } 1973 }
1974 setCaption ( i18n( "Copying succeed." ) ); 1974 setCaption ( i18n( "Copying succeed." ) );
1975 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); 1975 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
1976 if ( syncWithFile( prof->getLocalTempFile(), true ) ) { 1976 if ( syncWithFile( prof->getLocalTempFile(), true ) ) {
1977// Event* e = mView->getLastSyncEvent(); 1977// Event* e = mView->getLastSyncEvent();
1978// e->setReadOnly( false ); 1978// e->setReadOnly( false );
1979// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 1979// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
1980// e->setReadOnly( true ); 1980// e->setReadOnly( true );
1981 if ( KOPrefs::instance()->mWriteBackFile ) { 1981 if ( KOPrefs::instance()->mWriteBackFile ) {
1982 command = prof->getPostSyncCommand(); 1982 command = prof->getPostSyncCommand();
1983 int fi;
1984 if ( (fi = command.find("$PWD$")) > 0 ) {
1985 QString pwd = getPassword();
1986 command = command.left( fi )+ pwd + command.mid( fi+5 );
1987
1988 }
1983 setCaption ( i18n( "Writing back file ..." ) ); 1989 setCaption ( i18n( "Writing back file ..." ) );
1984 result = system ( command ); 1990 result = system ( command );
1985 qDebug("KO: Writing back file result: %d ", result); 1991 qDebug("KO: Writing back file result: %d ", result);
1986 if ( result != 0 ) { 1992 if ( result != 0 ) {
1987 setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); 1993 setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
1988 return; 1994 return;
1989 } else { 1995 } else {
1990 setCaption ( i18n( "Syncronization sucessfully completed" ) ); 1996 setCaption ( i18n( "Syncronization sucessfully completed" ) );
1991 } 1997 }
1992 } 1998 }
1993 } 1999 }
1994 return; 2000 return;
1995} 2001}
1996void MainWindow::syncSSH() 2002void MainWindow::syncSSH()
1997{ 2003{
1998 // not used anymore 2004 // not used anymore
1999 QTime timer; 2005 QTime timer;
2000 timer.start(); 2006 timer.start();
2001 //qDebug("MainWindow::syncssh() "); 2007 //qDebug("MainWindow::syncssh() ");
2002 KOPrefs *p = KOPrefs::instance(); 2008 KOPrefs *p = KOPrefs::instance();
2003 QString localFile = p->mLocalTempFile; 2009 QString localFile = p->mLocalTempFile;
2004 QString remoteIP = p->mRemoteIP; 2010 QString remoteIP = p->mRemoteIP;
2005 QString remoteUser = p->mRemoteUser; 2011 QString remoteUser = p->mRemoteUser;
2006 QString remoteFile = p->mRemoteFile; 2012 QString remoteFile = p->mRemoteFile;
2007 if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) 2013 if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 )
2008 remoteUser += ":" + p->mRemotePassWd; 2014 remoteUser += ":" + p->mRemotePassWd;
2009 2015
2010 QString question = i18n("Do you really want\nto remote sync?\n \n") + 2016 QString question = i18n("Do you really want\nto remote sync?\n \n") +
2011 i18n("IP: " ) +remoteIP +"\n" + 2017 i18n("IP: " ) +remoteIP +"\n" +
2012 i18n("User: " ) + remoteUser +"\n" ; 2018 i18n("User: " ) + remoteUser +"\n" ;
2013 int maxlen = 30; 2019 int maxlen = 30;
2014 if ( QApplication::desktop()->width() > 320 ) 2020 if ( QApplication::desktop()->width() > 320 )
2015 maxlen += 25; 2021 maxlen += 25;
2016 if ( remoteFile.length() > maxlen ) 2022 if ( remoteFile.length() > maxlen )
2017 question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; 2023 question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n";
2018 else 2024 else
2019 question += i18n("Remote file:\n " ) + remoteFile +"\n"; 2025 question += i18n("Remote file:\n " ) + remoteFile +"\n";
2020 if ( localFile.length() > maxlen ) 2026 if ( localFile.length() > maxlen )
2021 question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; 2027 question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n";
2022 else 2028 else
2023 question += i18n("Local temp file:\n " ) + localFile +"\n"; 2029 question += i18n("Local temp file:\n " ) + localFile +"\n";
2024 2030
2025 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 2031 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
2026 question, 2032 question,
2027 i18n("Yes"), i18n("No"), 2033 i18n("Yes"), i18n("No"),
2028 0, 0 ) != 0 ) 2034 0, 0 ) != 0 )
2029 return; 2035 return;
2030 // if ( !p->mUsePassWd ) { 2036 // if ( !p->mUsePassWd ) {