summaryrefslogtreecommitdiff
path: root/core
authorar <ar>2004-05-02 21:32:48 (UTC)
committer ar <ar>2004-05-02 21:32:48 (UTC)
commit0a4cac124105a5732e55cb34c6b37be75083a395 (patch) (side-by-side diff)
tree33b4d2cab08c9b58893540b4ddee089b69fc9c61 /core
parent109ed5f2a1cdfeb3680c9ec057a1083fcf8fab95 (diff)
downloadopie-0a4cac124105a5732e55cb34c6b37be75083a395.zip
opie-0a4cac124105a5732e55cb34c6b37be75083a395.tar.gz
opie-0a4cac124105a5732e55cb34c6b37be75083a395.tar.bz2
- convert qWarning to owarn
Diffstat (limited to 'core') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/launcher.cpp4
-rw-r--r--core/launcher/packageslave.cpp3
-rw-r--r--core/launcher/transferserver.cpp3
-rw-r--r--core/obex/obex.cc47
-rw-r--r--core/opie-login/loginapplication.cpp15
-rw-r--r--core/pim/addressbook/namelineedit.cpp6
-rw-r--r--core/qws/transferserver.cpp6
7 files changed, 49 insertions, 35 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 6afbcd8..779fe54 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -624,98 +624,98 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
tb->startWait();
} else if ( msg == "notBusy(QString)" ) {
QString app;
stream >> app;
tabs->setBusy(FALSE);
tb->stopWait(app);
} else if (msg == "applyStyle()") {
tabs->currentView()->relayout();
}
}
// These are the update functions from the server
void Launcher::typeAdded( const QString& type, const QString& name,
const QPixmap& pixmap, const QPixmap& )
{
tabs->newView( type, pixmap, name );
ids.append( type );
/* this will be called in applicationScanningProgress with value 100! */
// tb->refreshStartMenu();
static bool first = TRUE;
if ( first ) {
first = FALSE;
tabs->categoryBar->showTab(type);
}
tabs->view( type )->setUpdatesEnabled( FALSE );
tabs->view( type )->setSortEnabled( FALSE );
}
void Launcher::typeRemoved( const QString& type )
{
tabs->view( type )->removeAllItems();
tabs->deleteView( type );
ids.remove( type );
/* this will be called in applicationScanningProgress with value 100! */
// tb->refreshStartMenu();
}
void Launcher::applicationAdded( const QString& type, const AppLnk& app )
{
if ( app.type() == "Separator" ) // No tr
return;
LauncherView *view = tabs->view( type );
if ( view )
view->addItem( new AppLnk( app ), FALSE );
else
- qWarning("addAppLnk: No view for type %s. Can't add app %s!",
- type.latin1(),app.name().latin1() );
+ owarn << "addAppLnk: No view for type " << type.latin1() << ". Can't add app "
+ << app.name().latin1() << "!",
MimeType::registerApp( app );
}
void Launcher::applicationRemoved( const QString& type, const AppLnk& app )
{
LauncherView *view = tabs->view( type );
if ( view )
view->removeLink( app.linkFile() );
else
owarn << "removeAppLnk: No view for " << type << "!" << oendl;
}
void Launcher::allApplicationsRemoved()
{
MimeType::clear();
for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it)
tabs->view( (*it) )->removeAllItems();
}
void Launcher::documentAdded( const DocLnk& doc )
{
tabs->docView()->addItem( new DocLnk( doc ), FALSE );
}
void Launcher::aboutToAddBegin()
{
tabs->docView()->setUpdatesEnabled( false );
}
void Launcher::aboutToAddEnd()
{
tabs->docView()->setUpdatesEnabled( true );
}
void Launcher::showLoadingDocs()
{
tabs->docView()->hide();
}
void Launcher::showDocTab()
{
if ( tabs->categoryBar->currentView() == tabs->docView() )
tabs->docView()->show();
}
void Launcher::documentRemoved( const DocLnk& doc )
{
diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp
index a11ac86..0461432 100644
--- a/core/launcher/packageslave.cpp
+++ b/core/launcher/packageslave.cpp
@@ -130,98 +130,97 @@ void PackageHandler::sendReply( const QCString& msg, const QString& arg )
{
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", msg );
e << arg;
#endif
}
void PackageHandler::addPackageFiles( const QString &location,
const QString &listfile )
{
QFile f(listfile);
#ifndef Q_OS_WIN32
//make a copy so we can remove the symlinks later
mkdir( ("/usr/lib/ipkg/info/"+location).ascii(), 0777 );
system(("cp " + f.name() + " /usr/lib/ipkg/info/"+location).ascii());
#else
QDir d;
//#### revise
odebug << "Copy file at " << __FILE__ << ": " << __LINE__ << "" << oendl;
d.mkdir(("/usr/lib/ipkg/info/" + location).ascii());
system(("copy " + f.name() + " /usr/lib/ipkg/info/"+location).ascii());
#endif
if ( f.open(IO_ReadOnly) ) {
QTextStream ts(&f);
QString s;
while ( !ts.eof() ) { // until end of file...
s = ts.readLine(); // line of text excluding '\n'
// for s, do link/mkdir.
if ( s.right(1) == "/" ) {
odebug << "do mkdir for " << s.ascii() << "" << oendl;
#ifndef Q_OS_WIN32
mkdir( s.ascii(), 0777 );
//possible optimization: symlink directories
//that don't exist already. -- Risky.
#else
d.mkdir( s.ascii());
#endif
} else {
#ifndef Q_OS_WIN32
odebug << "do symlink for " << s.ascii() << "" << oendl;
symlink( (location + s).ascii(), s.ascii() );
#else
odebug << "Copy file instead of a symlink for WIN32" << oendl;
if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE))
- qWarning("Unable to create symlinkfor %s",
- (location + s).ascii());
+ owarn << "Unable to create symlinkfor " << (location + s).ascii() << oendl;
#endif
}
}
f.close();
}
}
void PackageHandler::addPackages( const QString &location )
{
// get list of *.list in location/usr/lib/ipkg/info/*.list
QDir dir(location + "/usr/lib/ipkg/info", "*.list", // No tr
QDir::Name, QDir::Files);
if ( !dir.exists() )
return;
QStringList packages = dir.entryList();
for ( QStringList::Iterator it = packages.begin();
it != packages.end(); ++it ) {
addPackageFiles( location, *it );
}
}
void PackageHandler::cleanupPackageFiles( const QString &listfile )
{
QFile f(listfile);
if ( f.open(IO_ReadOnly) ) {
QTextStream ts(&f);
QString s;
while ( !ts.eof() ) { // until end of file...
s = ts.readLine(); // line of text excluding '\n'
// for s, do link/mkdir.
if ( s.right(1) == "/" ) {
//should rmdir if empty, after all files have been removed
} else {
#ifndef Q_OS_WIN32
odebug << "remove symlink for " << s.ascii() << "" << oendl;
//check if it is a symlink first (don't remove /etc/passwd...)
char buf[10]; //we don't care about the contents
if ( ::readlink( s.ascii(),buf, 10 >= 0 ) )
::unlink( s.ascii() );
#else
// ### revise
owarn << "Unable to remove symlink " << __FILE__ << ":" << __LINE__ << "" << oendl;
#endif
}
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp
index c3f936e..1d4ca40 100644
--- a/core/launcher/transferserver.cpp
+++ b/core/launcher/transferserver.cpp
@@ -1111,98 +1111,97 @@ ServerDTP::~ServerDTP()
void ServerDTP::extractTarDone()
{
odebug << "extract done" << oendl;
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/System", "restoreDone(QString)" );
e << file.name();
#endif
}
void ServerDTP::connected()
{
// send file mode
switch ( mode ) {
case SendFile :
if ( !file.exists() || !file.open( IO_ReadOnly) ) {
emit failed();
mode = Idle;
return;
}
//odebug << "Debug: Sending file '" << file.name() << "'" << oendl;
bytes_written = 0;
if ( file.size() == 0 ) {
//make sure it doesn't hang on empty files
file.close();
emit completed();
mode = Idle;
} else {
// Don't write more if there is plenty buffered already.
if ( bytesToWrite() <= block_size && !file.atEnd() ) {
QCString s;
s.resize( block_size );
int bytes = file.readBlock( s.data(), block_size );
writeBlock( s.data(), bytes );
}
}
break;
case SendGzipFile:
if ( createTargzProc->isRunning() ) {
// SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY
owarn << "Previous tar --gzip process is still running; killing it..." << oendl;
createTargzProc->kill();
}
bytes_written = 0;
odebug << "==>start send tar process" << oendl;
if ( !createTargzProc->start() )
- qWarning("Error starting %s",
- createTargzProc->arguments().join(" ").latin1());
+ owarn << "Error starting " << createTargzProc->arguments().join(" ").latin1() << oendl;
break;
case SendBuffer:
if ( !buf.open( IO_ReadOnly) ) {
emit failed();
mode = Idle;
return;
}
// odebug << "Debug: Sending byte array" << oendl;
bytes_written = 0;
while( !buf.atEnd() )
putch( buf.getch() );
buf.close();
break;
case RetrieveFile:
// retrieve file mode
if ( file.exists() && !file.remove() ) {
emit failed();
mode = Idle;
return;
}
if ( !file.open( IO_WriteOnly) ) {
emit failed();
mode = Idle;
return;
}
// odebug << "Debug: Retrieving file " << file.name() << "" << oendl;
break;
case RetrieveGzipFile:
odebug << "=-> starting tar process to receive .tgz file" << oendl;
break;
case RetrieveBuffer:
// retrieve buffer mode
if ( !buf.open( IO_WriteOnly) ) {
emit failed();
mode = Idle;
return;
}
// odebug << "Debug: Retrieving byte array" << oendl;
break;
case Idle:
odebug << "connection established but mode set to Idle; BUG!" << oendl;
break;
}
}
void ServerDTP::connectionClosed()
diff --git a/core/obex/obex.cc b/core/obex/obex.cc
index 3c99af6..7c40b90 100644
--- a/core/obex/obex.cc
+++ b/core/obex/obex.cc
@@ -1,200 +1,205 @@
+#include "obex.h"
+
+/* OPIE */
+#include <opie2/oprocess.h>
+#include <opie2/odebug.h>
+
+/* QT */
#include <qfileinfo.h>
-#include <opie2/oprocess.h>
-#include "obex.h"
using namespace OpieObex;
using namespace Opie::Core;
/* TRANSLATOR OpieObex::Obex */
Obex::Obex( QObject *parent, const char* name )
: QObject(parent, name )
{
m_rec = 0;
m_send=0;
m_count = 0;
m_receive = false;
connect( this, SIGNAL(error(int) ), // for recovering to receive
SLOT(slotError() ) );
connect( this, SIGNAL(sent(bool) ),
SLOT(slotError() ) );
};
Obex::~Obex() {
delete m_rec;
delete m_send;
}
void Obex::receive() {
m_receive = true;
m_outp = QString::null;
- qWarning("Receive" );
+ owarn << "Receive" << oendl;
m_rec = new OProcess();
*m_rec << "irobex_palm3";
// connect to the necessary slots
connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ),
this, SLOT(slotExited(Opie::Core::OProcess*) ) );
connect(m_rec, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ),
this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) );
if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
- qWarning("could not start :(");
+ owarn << "could not start :(" oendl;
emit done( false );
delete m_rec;
m_rec = 0;
}
// emit currentTry(m_count );
}
void Obex::send( const QString& fileName) { // if currently receiving stop it send receive
m_count = 0;
m_file = fileName;
- qWarning("send %s", fileName.latin1() );
+ owarn << "send " << fileName.latin1() << oendl;
if (m_rec != 0 ) {
- qWarning("running");
+ owarn << "running" oendl;
if (m_rec->isRunning() ) {
emit error(-1 );
- qWarning("is running");
+ owarn << "is running" << oendl;
delete m_rec;
m_rec = 0;
}else{
- qWarning("is not running");
+ owarn << "is not running" << oendl;
emit error( -1 ); // we did not delete yet but it's not running slotExited is pending
return;
}
}
sendNow();
}
void Obex::sendNow(){
- qWarning("sendNow");
+ owarn << "sendNow" << oendl;
if ( m_count >= 25 ) { // could not send
emit error(-1 );
emit sent(false);
return;
}
// OProcess inititialisation
m_send = new OProcess();
*m_send << "irobex_palm3";
*m_send << QFile::encodeName(m_file);
// connect to slots Exited and and StdOut
connect(m_send, SIGNAL(processExited(Opie::Core::OProcess*) ),
this, SLOT(slotExited(Opie::Core::OProcess*)) );
connect(m_send, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int )),
this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) );
// now start it
if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) {
- qWarning("could not send" );
+ owarn << "could not send" << oendl;
m_count = 25;
emit error(-1 );
delete m_send;
m_send=0;
}
// end
m_count++;
emit currentTry( m_count );
}
void Obex::slotExited(OProcess* proc ){
if (proc == m_rec ) { // receive process
received();
}else if ( proc == m_send ) {
sendEnd();
}
}
void Obex::slotStdOut(OProcess* proc, char* buf, int len){
if ( proc == m_rec ) { // only receive
QByteArray ar( len );
memcpy( ar.data(), buf, len );
- qWarning("parsed: %s", ar.data() );
+ owarn << "parsed: " << ar.data() << oendl;
m_outp.append( ar );
}
}
void Obex::received() {
if (m_rec->normalExit() ) {
if ( m_rec->exitStatus() == 0 ) { // we got one
QString filename = parseOut();
- qWarning("ACHTUNG %s", filename.latin1() );
+ owarn << "ACHTUNG " << filename.latin1() << oendl;
emit receivedFile( filename );
}
}else{
emit done(false);
};
delete m_rec;
m_rec = 0;
receive();
}
void Obex::sendEnd() {
if (m_send->normalExit() ) {
if ( m_send->exitStatus() == 0 ) {
delete m_send;
m_send=0;
- qWarning("done" );
+ owarn << "done" << oendl;
emit sent(true);
}else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready
// let's try it again
delete m_send;
m_send = 0;
- qWarning("try sending again" );
+ owarn << "try sending again" << oendl;
sendNow();
}
}else {
emit error( -1 );
delete m_send;
m_send = 0;
}
}
QString Obex::parseOut( ){
QString path;
QStringList list = QStringList::split("\n", m_outp);
QStringList::Iterator it;
for (it = list.begin(); it != list.end(); ++it ) {
if ( (*it).startsWith("Wrote" ) ) {
int pos = (*it).findRev('(' );
if ( pos > 0 ) {
- qWarning( "%d %s", pos, (*it).mid(6 ).latin1() ) ;
- qWarning("%d %d", (*it).length(), (*it).length()-pos );
+ owarn << pos << " " << (*it).mid(6 ).latin1() << oendl;
+ owarn << (*it).length() << " " << (*it).length()-pos << oendl;
path = (*it).remove( pos, (*it).length() - pos );
- qWarning("%s", path.latin1() );
+ owarn << path.latin1() << oendl;
path = path.mid(6 );
path = path.stripWhiteSpace();
- qWarning("path %s", path.latin1() );
+ owarn << "path " << path.latin1() << oendl;
}
}
}
return path;
}
/**
* when sent is done slotError is called we will start receive again
*/
void Obex::slotError() {
- qWarning("slotError");
+ owarn << "slotError" << oendl;
if ( m_receive )
receive();
};
void Obex::setReceiveEnabled( bool receive ) {
if ( !receive ) { //
m_receive = false;
shutDownReceive();
}
}
void Obex::shutDownReceive() {
if (m_rec != 0 ) {
- qWarning("running");
+ owarn << "running" << oendl;
if (m_rec->isRunning() ) {
emit error(-1 );
- qWarning("is running");
+ owarn << "is running" << oendl;
delete m_rec;
m_rec = 0;
}
}
}
diff --git a/core/opie-login/loginapplication.cpp b/core/opie-login/loginapplication.cpp
index 1facf2d..764b24b 100644
--- a/core/opie-login/loginapplication.cpp
+++ b/core/opie-login/loginapplication.cpp
@@ -1,93 +1,100 @@
/*
               =. This file is part of the OPIE Project
             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
           .>+-=
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
+#include "loginapplication.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+
+/* QT */
+
+/* STD */
#include <pwd.h>
#include <grp.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/wait.h>
#ifdef USEPAM
extern "C" {
#include <security/pam_appl.h>
}
#else
#include <crypt.h>
#include <shadow.h>
#endif
-#include "loginapplication.h"
LoginApplication *lApp;
LoginApplication::LoginApplication ( int &argc, char **argv, pid_t parentpid )
: QPEApplication ( argc, argv, GuiServer )
{
lApp = this;
m_parentpid = parentpid;
}
const char *LoginApplication::s_username = 0;
#ifdef USEPAM
const char *LoginApplication::s_pam_password = 0;
int LoginApplication::pam_helper ( int num_msg, const struct pam_message **msg, struct pam_response **resp, void * )
{
int replies = 0;
struct pam_response *reply = 0;
int size = sizeof( struct pam_response );
for ( int i = 0; i < num_msg; i++ ) {
switch ( msg [i]-> msg_style ) {
case PAM_PROMPT_ECHO_ON: // user name given to PAM already
return PAM_CONV_ERR;
case PAM_PROMPT_ECHO_OFF: // wants password
reply = (struct pam_response *) ::realloc ( reply, size );
if ( !reply )
return PAM_CONV_ERR;
size += sizeof( struct pam_response );
reply [replies]. resp_retcode = PAM_SUCCESS;
reply [replies]. resp = ::strdup ( s_pam_password );
replies++; // PAM frees resp
break;
case PAM_TEXT_INFO:
break;
default:
/* unknown or PAM_ERROR_MSG */
if ( reply )
::free ( reply );
return PAM_CONV_ERR;
}
}
@@ -117,130 +124,130 @@ bool LoginApplication::checkPassword ( const char *user, const char *pass )
#else
bool LoginApplication::checkPassword ( const char *user, const char *pass )
{
char *encrypted, *correct;
struct passwd *pw;
if ( !user || !pass )
return false;
pw = ::getpwnam ( user );
if ( !pw )
return false;
if (( ::strcmp ( pw-> pw_passwd, "x" ) == 0 ) || ( ::strcmp ( pw-> pw_passwd, "*" ) == 0 )) {
struct spwd *sp = ::getspnam ( pw-> pw_name );
if ( !sp )
return false;
correct = sp-> sp_pwdp;
}
else
correct = pw-> pw_passwd;
if ( correct == 0 || correct[0] == '\0' )
return true;
encrypted = ::crypt ( pass, correct );
return ( ::strcmp ( encrypted, correct ) == 0 );
}
#endif
bool LoginApplication::changeIdentity ( )
{
const char *DEFAULT_LOGIN_PATH = "/bin:/usr/bin";
const char *DEFAULT_ROOT_LOGIN_PATH = "/usr/sbin:/bin:/usr/bin:/sbin";
if ( !s_username )
return false;
struct passwd *pw = ::getpwnam ( s_username );
if ( !pw )
return false;
// we are still root at this point - try to run the pre-session script
if ( !runRootScript ( "OPIEDIR", "share/opie-login/pre-session", s_username ))
- qWarning ( "failed to run $OPIEDIR/share/opie-login/pre-session" );
+ owarn << "failed to run $OPIEDIR/share/opie-login/pre-session" << oendl;
bool fail = false;
fail |= ( ::initgroups ( pw-> pw_name, pw-> pw_gid ));
::endgrent ( );
fail |= ( ::setgid ( pw-> pw_gid ));
fail |= ( ::setuid ( pw-> pw_uid ));
fail |= ( ::chdir ( pw-> pw_dir ) && ::chdir ( "/" ));
fail |= ( ::setenv ( "HOME", pw-> pw_dir, 1 ));
fail |= ( ::setenv ( "SHELL", pw-> pw_shell, 1 ));
fail |= ( ::setenv ( "USER", pw-> pw_name, 1 ));
fail |= ( ::setenv ( "LOGNAME", pw-> pw_name, 1 ));
fail |= ( ::setenv ( "PATH", ( pw-> pw_uid ? DEFAULT_LOGIN_PATH : DEFAULT_ROOT_LOGIN_PATH ), 1 ));
return !fail;
}
bool LoginApplication::login ( )
{
execUserScript ( "HOME", ".opie-session" );
execUserScript ( "OPIEDIR", "share/opie-login/opie-session" );
execUserScript ( "OPIEDIR", "bin/qpe" );
- qWarning ( "failed to start an Opie session" );
+ owarn << "failed to start an Opie session" << oendl;
return false;
}
void LoginApplication::logout ( )
{
// we are now root again - try to run the post-session script
if ( !runRootScript ( "OPIEDIR", "share/opie-login/post-session" ))
- qWarning ( "failed to run $OPIEDIR/scripts/post-session" );
+ owarn << "failed to run $OPIEDIR/scripts/post-session" << oendl;
}
static char *buildarg ( const char *base, const char *script )
{
const char *dir = base ? ::getenv ( base ) : "/";
char *arg = new char [::strlen ( dir ) + ::strlen ( script ) + 2];
::strcpy ( arg, dir );
::strcat ( arg, "/" );
::strcat ( arg, script );
return arg;
}
bool LoginApplication::runRootScript ( const char *base, const char *script, const char *param )
{
bool res = false;
char *arg = buildarg ( base, script );
struct stat st;
if (( ::stat ( arg, &st ) == 0 ) && ( st. st_uid == 0 )) {
pid_t child = ::fork ( );
if ( child == 0 ) {
::execl ( "/bin/sh", "-sh", arg, param, 0 );
::_exit ( -1 );
}
else if ( child > 0 ) {
int status = 0;
while ( ::waitpid ( child, &status, 0 ) < 0 ) { }
res = ( WIFEXITED( status )) && ( WEXITSTATUS( status ) == 0 );
}
}
delete [] arg;
return res;
}
void LoginApplication::execUserScript ( const char *base, const char *script )
{
char *arg = buildarg ( base, script );
struct stat st;
if ( ::stat ( arg, &st ) == 0 ) {
if ( st. st_mode & S_IXUSR )
::execl ( "/bin/sh", "-sh", "-c", arg, 0 );
diff --git a/core/pim/addressbook/namelineedit.cpp b/core/pim/addressbook/namelineedit.cpp
index ba16e2c..81b959b 100644
--- a/core/pim/addressbook/namelineedit.cpp
+++ b/core/pim/addressbook/namelineedit.cpp
@@ -1,55 +1,59 @@
#include "namelineedit.h"
+/* OPIE */
+#include <opie2/odebug.h>
+
+
namespace ABOOK {
NameLineEdit::NameLineEdit( QWidget* parent, const char* name )
: QLineEdit( parent, name ), m_prevSpace( true ) {
}
NameLineEdit::NameLineEdit( const QString& str, QWidget* par,
const char* name )
: QLineEdit( str, par, name ),m_prevSpace( true ) {
}
NameLineEdit::~NameLineEdit() {
}
void NameLineEdit::keyPressEvent( QKeyEvent* ev ) {
QString t = ev->text();
int key = ev->key();
int ascii = ev->ascii();
// ### FIXME with composed events
if ( !t.isEmpty() && ( !ev->ascii() || ev->ascii()>=32 ) &&
key != Key_Delete && key != Key_Backspace &&
key != Key_Return && key != Key_Enter ) {
- qWarning( "str " + ev->text() + " %d", m_prevSpace );
+ owarn << "str " << ev->text() << " " << m_prevSpace << oendl;
if ( m_prevSpace ) {
t = t.upper();
m_prevSpace = false;
}
if ( key == Key_Space )
m_prevSpace = true;
QKeyEvent nEv(ev->type(), key, ascii, ev->state(),
t, ev->isAutoRepeat(), ev->count() );
QLineEdit::keyPressEvent( &nEv );
if ( !nEv.isAccepted() )
ev->ignore();
}else {
QLineEdit::keyPressEvent( ev );
/* if key was a backspace lets see if we should
* capitalize the next letter
*/
if ( key == Key_Backspace ) {
QString te = text();
/* if string is empty capitalize the first letter */
/* else see if we're at the end of the string */
if ( te.isEmpty() || cursorPosition() == te.length() )
m_prevSpace = true;
}
}
}
}
diff --git a/core/qws/transferserver.cpp b/core/qws/transferserver.cpp
index 777c384..7bf6719 100644
--- a/core/qws/transferserver.cpp
+++ b/core/qws/transferserver.cpp
@@ -1,71 +1,72 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
/* OPIE */
#include <opie2/odebug.h>
+/* STD */
#define _XOPEN_SOURCE
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#ifndef Q_OS_MACX
#include <shadow.h>
#endif /* Q_OS_MACX */
/* we need the _OS_LINUX stuff first ! */
#ifndef _OS_LINUX_
// Is anybody able to review this ? The include "uuid/uuid.h" couldn't be found
// anywhere ? Therfore I removed it completely..
// I think it should be made permanentyl !? (eilers)
#warning "Where should uuid/uuid.h be found ? Removed this part .. (eilers)"
#if 0
extern "C"
{
#include <uuid/uuid.h>
#define UUID_H_INCLUDED
}
#endif
#endif // not defined linux
#if defined(_OS_LINUX_)
#include <shadow.h>
#elif defined(Q_OS_MACX)
#include <stdlib.h>
#endif
#include <qtextstream.h>
#include <qmessagebox.h>
//#include <qpe/qcopchannel_qws.h>
#include <qpe/process.h>
#include <qpe/global.h>
#include <qpe/config.h>
#include <qpe/contact.h>
#include <qpe/version.h>
#include <qpe/qcopenvelope_qws.h>
#include "transferserver.h"
#include <opie2/oprocess.h>
@@ -1082,99 +1083,98 @@ void ServerDTP::extractTarDone()
odebug << "extract done" << oendl;
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "restoreDone(QString)" );
e << file.name();
#endif
}
void ServerDTP::connected()
{
// send file mode
switch ( mode ) {
case SendFile :
if ( !file.exists() || !file.open( IO_ReadOnly) ) {
emit failed();
mode = Idle;
return ;
}
//odebug << "Debug: Sending file '" << file.name() << "'" << oendl;
bytes_written = 0;
if ( file.size() == 0 ) {
//make sure it doesn't hang on empty files
file.close();
emit completed();
mode = Idle;
}
else {
if ( !file.atEnd() ) {
QCString s;
s.resize( block_size );
int bytes = file.readBlock( s.data(), block_size );
writeBlock( s.data(), bytes );
}
}
break;
case SendGzipFile:
if ( createTargzProc->isRunning() ) {
// SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY
owarn << "Previous tar --gzip process is still running; killing it..." << oendl;
createTargzProc->kill();
}
bytes_written = 0;
odebug << "==>start send tar process" << oendl;
if ( !createTargzProc->start(Opie::Core::OProcess::NotifyOnExit, Opie::Core::OProcess::Stdout) )
- qWarning("Error starting %s or %s",
- createTargzProc->args()[0].data(),
- gzipProc->args()[0].data());
+ owarn << "Error starting " << createTargzProc->args()[0].data()
+ << " or " << gzipProc->args()[0].data() << oendl;
break;
case SendBuffer:
if ( !buf.open( IO_ReadOnly) ) {
emit failed();
mode = Idle;
return ;
}
// odebug << "Debug: Sending byte array" << oendl;
bytes_written = 0;
while ( !buf.atEnd() )
putch( buf.getch() );
buf.close();
break;
case RetrieveFile:
// retrieve file mode
if ( file.exists() && !file.remove() ) {
emit failed();
mode = Idle;
return ;
}
if ( !file.open( IO_WriteOnly) ) {
emit failed();
mode = Idle;
return ;
}
// odebug << "Debug: Retrieving file " << file.name() << "" << oendl;
break;
case RetrieveGzipFile:
odebug << "=-> starting tar process to receive .tgz file" << oendl;
break;
case RetrieveBuffer:
// retrieve buffer mode
if ( !buf.open( IO_WriteOnly) ) {
emit failed();
mode = Idle;
return ;
}
// odebug << "Debug: Retrieving byte array" << oendl;
break;
case Idle:
odebug << "connection established but mode set to Idle; BUG!" << oendl;
break;
}
}
void ServerDTP::connectionClosed()