-rw-r--r-- | core/launcher/launcher.cpp | 4 | ||||
-rw-r--r-- | core/launcher/packageslave.cpp | 3 | ||||
-rw-r--r-- | core/launcher/transferserver.cpp | 3 | ||||
-rw-r--r-- | core/obex/obex.cc | 47 | ||||
-rw-r--r-- | core/opie-login/loginapplication.cpp | 15 | ||||
-rw-r--r-- | core/pim/addressbook/namelineedit.cpp | 6 | ||||
-rw-r--r-- | core/qws/transferserver.cpp | 6 |
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 | |||
@@ -648,50 +648,50 @@ void Launcher::typeAdded( const QString& type, const QString& name, | |||
648 | } | 648 | } |
649 | 649 | ||
650 | tabs->view( type )->setUpdatesEnabled( FALSE ); | 650 | tabs->view( type )->setUpdatesEnabled( FALSE ); |
651 | tabs->view( type )->setSortEnabled( FALSE ); | 651 | tabs->view( type )->setSortEnabled( FALSE ); |
652 | } | 652 | } |
653 | 653 | ||
654 | void Launcher::typeRemoved( const QString& type ) | 654 | void Launcher::typeRemoved( const QString& type ) |
655 | { | 655 | { |
656 | tabs->view( type )->removeAllItems(); | 656 | tabs->view( type )->removeAllItems(); |
657 | tabs->deleteView( type ); | 657 | tabs->deleteView( type ); |
658 | ids.remove( type ); | 658 | ids.remove( type ); |
659 | /* this will be called in applicationScanningProgress with value 100! */ | 659 | /* this will be called in applicationScanningProgress with value 100! */ |
660 | // tb->refreshStartMenu(); | 660 | // tb->refreshStartMenu(); |
661 | } | 661 | } |
662 | 662 | ||
663 | void Launcher::applicationAdded( const QString& type, const AppLnk& app ) | 663 | void Launcher::applicationAdded( const QString& type, const AppLnk& app ) |
664 | { | 664 | { |
665 | if ( app.type() == "Separator" ) // No tr | 665 | if ( app.type() == "Separator" ) // No tr |
666 | return; | 666 | return; |
667 | 667 | ||
668 | LauncherView *view = tabs->view( type ); | 668 | LauncherView *view = tabs->view( type ); |
669 | if ( view ) | 669 | if ( view ) |
670 | view->addItem( new AppLnk( app ), FALSE ); | 670 | view->addItem( new AppLnk( app ), FALSE ); |
671 | else | 671 | else |
672 | qWarning("addAppLnk: No view for type %s. Can't add app %s!", | 672 | owarn << "addAppLnk: No view for type " << type.latin1() << ". Can't add app " |
673 | type.latin1(),app.name().latin1() ); | 673 | << app.name().latin1() << "!", |
674 | 674 | ||
675 | MimeType::registerApp( app ); | 675 | MimeType::registerApp( app ); |
676 | } | 676 | } |
677 | 677 | ||
678 | void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) | 678 | void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) |
679 | { | 679 | { |
680 | LauncherView *view = tabs->view( type ); | 680 | LauncherView *view = tabs->view( type ); |
681 | if ( view ) | 681 | if ( view ) |
682 | view->removeLink( app.linkFile() ); | 682 | view->removeLink( app.linkFile() ); |
683 | else | 683 | else |
684 | owarn << "removeAppLnk: No view for " << type << "!" << oendl; | 684 | owarn << "removeAppLnk: No view for " << type << "!" << oendl; |
685 | } | 685 | } |
686 | 686 | ||
687 | void Launcher::allApplicationsRemoved() | 687 | void Launcher::allApplicationsRemoved() |
688 | { | 688 | { |
689 | MimeType::clear(); | 689 | MimeType::clear(); |
690 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) | 690 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) |
691 | tabs->view( (*it) )->removeAllItems(); | 691 | tabs->view( (*it) )->removeAllItems(); |
692 | } | 692 | } |
693 | 693 | ||
694 | void Launcher::documentAdded( const DocLnk& doc ) | 694 | void Launcher::documentAdded( const DocLnk& doc ) |
695 | { | 695 | { |
696 | tabs->docView()->addItem( new DocLnk( doc ), FALSE ); | 696 | tabs->docView()->addItem( new DocLnk( doc ), FALSE ); |
697 | } | 697 | } |
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 | |||
@@ -154,50 +154,49 @@ void PackageHandler::addPackageFiles( const QString &location, | |||
154 | if ( f.open(IO_ReadOnly) ) { | 154 | if ( f.open(IO_ReadOnly) ) { |
155 | QTextStream ts(&f); | 155 | QTextStream ts(&f); |
156 | 156 | ||
157 | QString s; | 157 | QString s; |
158 | while ( !ts.eof() ) { // until end of file... | 158 | while ( !ts.eof() ) { // until end of file... |
159 | s = ts.readLine(); // line of text excluding '\n' | 159 | s = ts.readLine(); // line of text excluding '\n' |
160 | // for s, do link/mkdir. | 160 | // for s, do link/mkdir. |
161 | if ( s.right(1) == "/" ) { | 161 | if ( s.right(1) == "/" ) { |
162 | odebug << "do mkdir for " << s.ascii() << "" << oendl; | 162 | odebug << "do mkdir for " << s.ascii() << "" << oendl; |
163 | #ifndef Q_OS_WIN32 | 163 | #ifndef Q_OS_WIN32 |
164 | mkdir( s.ascii(), 0777 ); | 164 | mkdir( s.ascii(), 0777 ); |
165 | //possible optimization: symlink directories | 165 | //possible optimization: symlink directories |
166 | //that don't exist already. -- Risky. | 166 | //that don't exist already. -- Risky. |
167 | #else | 167 | #else |
168 | d.mkdir( s.ascii()); | 168 | d.mkdir( s.ascii()); |
169 | #endif | 169 | #endif |
170 | 170 | ||
171 | } else { | 171 | } else { |
172 | #ifndef Q_OS_WIN32 | 172 | #ifndef Q_OS_WIN32 |
173 | odebug << "do symlink for " << s.ascii() << "" << oendl; | 173 | odebug << "do symlink for " << s.ascii() << "" << oendl; |
174 | symlink( (location + s).ascii(), s.ascii() ); | 174 | symlink( (location + s).ascii(), s.ascii() ); |
175 | #else | 175 | #else |
176 | odebug << "Copy file instead of a symlink for WIN32" << oendl; | 176 | odebug << "Copy file instead of a symlink for WIN32" << oendl; |
177 | if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE)) | 177 | if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE)) |
178 | qWarning("Unable to create symlinkfor %s", | 178 | owarn << "Unable to create symlinkfor " << (location + s).ascii() << oendl; |
179 | (location + s).ascii()); | ||
180 | #endif | 179 | #endif |
181 | } | 180 | } |
182 | } | 181 | } |
183 | f.close(); | 182 | f.close(); |
184 | } | 183 | } |
185 | } | 184 | } |
186 | 185 | ||
187 | void PackageHandler::addPackages( const QString &location ) | 186 | void PackageHandler::addPackages( const QString &location ) |
188 | { | 187 | { |
189 | // get list of *.list in location/usr/lib/ipkg/info/*.list | 188 | // get list of *.list in location/usr/lib/ipkg/info/*.list |
190 | QDir dir(location + "/usr/lib/ipkg/info", "*.list", // No tr | 189 | QDir dir(location + "/usr/lib/ipkg/info", "*.list", // No tr |
191 | QDir::Name, QDir::Files); | 190 | QDir::Name, QDir::Files); |
192 | if ( !dir.exists() ) | 191 | if ( !dir.exists() ) |
193 | return; | 192 | return; |
194 | 193 | ||
195 | QStringList packages = dir.entryList(); | 194 | QStringList packages = dir.entryList(); |
196 | for ( QStringList::Iterator it = packages.begin(); | 195 | for ( QStringList::Iterator it = packages.begin(); |
197 | it != packages.end(); ++it ) { | 196 | it != packages.end(); ++it ) { |
198 | addPackageFiles( location, *it ); | 197 | addPackageFiles( location, *it ); |
199 | } | 198 | } |
200 | } | 199 | } |
201 | 200 | ||
202 | 201 | ||
203 | void PackageHandler::cleanupPackageFiles( const QString &listfile ) | 202 | void PackageHandler::cleanupPackageFiles( const QString &listfile ) |
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 | |||
@@ -1135,50 +1135,49 @@ void ServerDTP::connected() | |||
1135 | //make sure it doesn't hang on empty files | 1135 | //make sure it doesn't hang on empty files |
1136 | file.close(); | 1136 | file.close(); |
1137 | emit completed(); | 1137 | emit completed(); |
1138 | mode = Idle; | 1138 | mode = Idle; |
1139 | } else { | 1139 | } else { |
1140 | // Don't write more if there is plenty buffered already. | 1140 | // Don't write more if there is plenty buffered already. |
1141 | if ( bytesToWrite() <= block_size && !file.atEnd() ) { | 1141 | if ( bytesToWrite() <= block_size && !file.atEnd() ) { |
1142 | QCString s; | 1142 | QCString s; |
1143 | s.resize( block_size ); | 1143 | s.resize( block_size ); |
1144 | int bytes = file.readBlock( s.data(), block_size ); | 1144 | int bytes = file.readBlock( s.data(), block_size ); |
1145 | writeBlock( s.data(), bytes ); | 1145 | writeBlock( s.data(), bytes ); |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | break; | 1148 | break; |
1149 | case SendGzipFile: | 1149 | case SendGzipFile: |
1150 | if ( createTargzProc->isRunning() ) { | 1150 | if ( createTargzProc->isRunning() ) { |
1151 | // SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY | 1151 | // SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY |
1152 | owarn << "Previous tar --gzip process is still running; killing it..." << oendl; | 1152 | owarn << "Previous tar --gzip process is still running; killing it..." << oendl; |
1153 | createTargzProc->kill(); | 1153 | createTargzProc->kill(); |
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | bytes_written = 0; | 1156 | bytes_written = 0; |
1157 | odebug << "==>start send tar process" << oendl; | 1157 | odebug << "==>start send tar process" << oendl; |
1158 | if ( !createTargzProc->start() ) | 1158 | if ( !createTargzProc->start() ) |
1159 | qWarning("Error starting %s", | 1159 | owarn << "Error starting " << createTargzProc->arguments().join(" ").latin1() << oendl; |
1160 | createTargzProc->arguments().join(" ").latin1()); | ||
1161 | break; | 1160 | break; |
1162 | case SendBuffer: | 1161 | case SendBuffer: |
1163 | if ( !buf.open( IO_ReadOnly) ) { | 1162 | if ( !buf.open( IO_ReadOnly) ) { |
1164 | emit failed(); | 1163 | emit failed(); |
1165 | mode = Idle; | 1164 | mode = Idle; |
1166 | return; | 1165 | return; |
1167 | } | 1166 | } |
1168 | 1167 | ||
1169 | // odebug << "Debug: Sending byte array" << oendl; | 1168 | // odebug << "Debug: Sending byte array" << oendl; |
1170 | bytes_written = 0; | 1169 | bytes_written = 0; |
1171 | while( !buf.atEnd() ) | 1170 | while( !buf.atEnd() ) |
1172 | putch( buf.getch() ); | 1171 | putch( buf.getch() ); |
1173 | buf.close(); | 1172 | buf.close(); |
1174 | break; | 1173 | break; |
1175 | case RetrieveFile: | 1174 | case RetrieveFile: |
1176 | // retrieve file mode | 1175 | // retrieve file mode |
1177 | if ( file.exists() && !file.remove() ) { | 1176 | if ( file.exists() && !file.remove() ) { |
1178 | emit failed(); | 1177 | emit failed(); |
1179 | mode = Idle; | 1178 | mode = Idle; |
1180 | return; | 1179 | return; |
1181 | } | 1180 | } |
1182 | 1181 | ||
1183 | if ( !file.open( IO_WriteOnly) ) { | 1182 | if ( !file.open( IO_WriteOnly) ) { |
1184 | emit failed(); | 1183 | emit failed(); |
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 @@ | |||
1 | 1 | ||
2 | #include "obex.h" | ||
3 | |||
4 | /* OPIE */ | ||
5 | #include <opie2/oprocess.h> | ||
6 | #include <opie2/odebug.h> | ||
7 | |||
8 | /* QT */ | ||
2 | #include <qfileinfo.h> | 9 | #include <qfileinfo.h> |
3 | 10 | ||
4 | 11 | ||
5 | #include <opie2/oprocess.h> | ||
6 | #include "obex.h" | ||
7 | 12 | ||
8 | using namespace OpieObex; | 13 | using namespace OpieObex; |
9 | 14 | ||
10 | using namespace Opie::Core; | 15 | using namespace Opie::Core; |
11 | /* TRANSLATOR OpieObex::Obex */ | 16 | /* TRANSLATOR OpieObex::Obex */ |
12 | 17 | ||
13 | Obex::Obex( QObject *parent, const char* name ) | 18 | Obex::Obex( QObject *parent, const char* name ) |
14 | : QObject(parent, name ) | 19 | : QObject(parent, name ) |
15 | { | 20 | { |
16 | m_rec = 0; | 21 | m_rec = 0; |
17 | m_send=0; | 22 | m_send=0; |
18 | m_count = 0; | 23 | m_count = 0; |
19 | m_receive = false; | 24 | m_receive = false; |
20 | connect( this, SIGNAL(error(int) ), // for recovering to receive | 25 | connect( this, SIGNAL(error(int) ), // for recovering to receive |
21 | SLOT(slotError() ) ); | 26 | SLOT(slotError() ) ); |
22 | connect( this, SIGNAL(sent(bool) ), | 27 | connect( this, SIGNAL(sent(bool) ), |
23 | SLOT(slotError() ) ); | 28 | SLOT(slotError() ) ); |
24 | }; | 29 | }; |
25 | Obex::~Obex() { | 30 | Obex::~Obex() { |
26 | delete m_rec; | 31 | delete m_rec; |
27 | delete m_send; | 32 | delete m_send; |
28 | } | 33 | } |
29 | void Obex::receive() { | 34 | void Obex::receive() { |
30 | m_receive = true; | 35 | m_receive = true; |
31 | m_outp = QString::null; | 36 | m_outp = QString::null; |
32 | qWarning("Receive" ); | 37 | owarn << "Receive" << oendl; |
33 | m_rec = new OProcess(); | 38 | m_rec = new OProcess(); |
34 | *m_rec << "irobex_palm3"; | 39 | *m_rec << "irobex_palm3"; |
35 | // connect to the necessary slots | 40 | // connect to the necessary slots |
36 | connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ), | 41 | connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ), |
37 | this, SLOT(slotExited(Opie::Core::OProcess*) ) ); | 42 | this, SLOT(slotExited(Opie::Core::OProcess*) ) ); |
38 | 43 | ||
39 | connect(m_rec, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), | 44 | connect(m_rec, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), |
40 | this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) ); | 45 | this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) ); |
41 | 46 | ||
42 | if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 47 | if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
43 | qWarning("could not start :("); | 48 | owarn << "could not start :(" oendl; |
44 | emit done( false ); | 49 | emit done( false ); |
45 | delete m_rec; | 50 | delete m_rec; |
46 | m_rec = 0; | 51 | m_rec = 0; |
47 | } | 52 | } |
48 | // emit currentTry(m_count ); | 53 | // emit currentTry(m_count ); |
49 | 54 | ||
50 | } | 55 | } |
51 | void Obex::send( const QString& fileName) { // if currently receiving stop it send receive | 56 | void Obex::send( const QString& fileName) { // if currently receiving stop it send receive |
52 | m_count = 0; | 57 | m_count = 0; |
53 | m_file = fileName; | 58 | m_file = fileName; |
54 | qWarning("send %s", fileName.latin1() ); | 59 | owarn << "send " << fileName.latin1() << oendl; |
55 | if (m_rec != 0 ) { | 60 | if (m_rec != 0 ) { |
56 | qWarning("running"); | 61 | owarn << "running" oendl; |
57 | if (m_rec->isRunning() ) { | 62 | if (m_rec->isRunning() ) { |
58 | emit error(-1 ); | 63 | emit error(-1 ); |
59 | qWarning("is running"); | 64 | owarn << "is running" << oendl; |
60 | delete m_rec; | 65 | delete m_rec; |
61 | m_rec = 0; | 66 | m_rec = 0; |
62 | 67 | ||
63 | }else{ | 68 | }else{ |
64 | qWarning("is not running"); | 69 | owarn << "is not running" << oendl; |
65 | emit error( -1 ); // we did not delete yet but it's not running slotExited is pending | 70 | emit error( -1 ); // we did not delete yet but it's not running slotExited is pending |
66 | return; | 71 | return; |
67 | } | 72 | } |
68 | } | 73 | } |
69 | sendNow(); | 74 | sendNow(); |
70 | } | 75 | } |
71 | void Obex::sendNow(){ | 76 | void Obex::sendNow(){ |
72 | qWarning("sendNow"); | 77 | owarn << "sendNow" << oendl; |
73 | if ( m_count >= 25 ) { // could not send | 78 | if ( m_count >= 25 ) { // could not send |
74 | emit error(-1 ); | 79 | emit error(-1 ); |
75 | emit sent(false); | 80 | emit sent(false); |
76 | return; | 81 | return; |
77 | } | 82 | } |
78 | // OProcess inititialisation | 83 | // OProcess inititialisation |
79 | m_send = new OProcess(); | 84 | m_send = new OProcess(); |
80 | *m_send << "irobex_palm3"; | 85 | *m_send << "irobex_palm3"; |
81 | *m_send << QFile::encodeName(m_file); | 86 | *m_send << QFile::encodeName(m_file); |
82 | 87 | ||
83 | // connect to slots Exited and and StdOut | 88 | // connect to slots Exited and and StdOut |
84 | connect(m_send, SIGNAL(processExited(Opie::Core::OProcess*) ), | 89 | connect(m_send, SIGNAL(processExited(Opie::Core::OProcess*) ), |
85 | this, SLOT(slotExited(Opie::Core::OProcess*)) ); | 90 | this, SLOT(slotExited(Opie::Core::OProcess*)) ); |
86 | connect(m_send, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int )), | 91 | connect(m_send, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int )), |
87 | this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) ); | 92 | this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) ); |
88 | 93 | ||
89 | // now start it | 94 | // now start it |
90 | if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) { | 95 | if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) { |
91 | qWarning("could not send" ); | 96 | owarn << "could not send" << oendl; |
92 | m_count = 25; | 97 | m_count = 25; |
93 | emit error(-1 ); | 98 | emit error(-1 ); |
94 | delete m_send; | 99 | delete m_send; |
95 | m_send=0; | 100 | m_send=0; |
96 | } | 101 | } |
97 | // end | 102 | // end |
98 | m_count++; | 103 | m_count++; |
99 | emit currentTry( m_count ); | 104 | emit currentTry( m_count ); |
100 | } | 105 | } |
101 | 106 | ||
102 | void Obex::slotExited(OProcess* proc ){ | 107 | void Obex::slotExited(OProcess* proc ){ |
103 | if (proc == m_rec ) { // receive process | 108 | if (proc == m_rec ) { // receive process |
104 | received(); | 109 | received(); |
105 | }else if ( proc == m_send ) { | 110 | }else if ( proc == m_send ) { |
106 | sendEnd(); | 111 | sendEnd(); |
107 | } | 112 | } |
108 | } | 113 | } |
109 | void Obex::slotStdOut(OProcess* proc, char* buf, int len){ | 114 | void Obex::slotStdOut(OProcess* proc, char* buf, int len){ |
110 | if ( proc == m_rec ) { // only receive | 115 | if ( proc == m_rec ) { // only receive |
111 | QByteArray ar( len ); | 116 | QByteArray ar( len ); |
112 | memcpy( ar.data(), buf, len ); | 117 | memcpy( ar.data(), buf, len ); |
113 | qWarning("parsed: %s", ar.data() ); | 118 | owarn << "parsed: " << ar.data() << oendl; |
114 | m_outp.append( ar ); | 119 | m_outp.append( ar ); |
115 | } | 120 | } |
116 | } | 121 | } |
117 | 122 | ||
118 | void Obex::received() { | 123 | void Obex::received() { |
119 | if (m_rec->normalExit() ) { | 124 | if (m_rec->normalExit() ) { |
120 | if ( m_rec->exitStatus() == 0 ) { // we got one | 125 | if ( m_rec->exitStatus() == 0 ) { // we got one |
121 | QString filename = parseOut(); | 126 | QString filename = parseOut(); |
122 | qWarning("ACHTUNG %s", filename.latin1() ); | 127 | owarn << "ACHTUNG " << filename.latin1() << oendl; |
123 | emit receivedFile( filename ); | 128 | emit receivedFile( filename ); |
124 | } | 129 | } |
125 | }else{ | 130 | }else{ |
126 | emit done(false); | 131 | emit done(false); |
127 | }; | 132 | }; |
128 | delete m_rec; | 133 | delete m_rec; |
129 | m_rec = 0; | 134 | m_rec = 0; |
130 | receive(); | 135 | receive(); |
131 | } | 136 | } |
132 | 137 | ||
133 | void Obex::sendEnd() { | 138 | void Obex::sendEnd() { |
134 | if (m_send->normalExit() ) { | 139 | if (m_send->normalExit() ) { |
135 | if ( m_send->exitStatus() == 0 ) { | 140 | if ( m_send->exitStatus() == 0 ) { |
136 | delete m_send; | 141 | delete m_send; |
137 | m_send=0; | 142 | m_send=0; |
138 | qWarning("done" ); | 143 | owarn << "done" << oendl; |
139 | emit sent(true); | 144 | emit sent(true); |
140 | }else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready | 145 | }else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready |
141 | // let's try it again | 146 | // let's try it again |
142 | delete m_send; | 147 | delete m_send; |
143 | m_send = 0; | 148 | m_send = 0; |
144 | qWarning("try sending again" ); | 149 | owarn << "try sending again" << oendl; |
145 | sendNow(); | 150 | sendNow(); |
146 | } | 151 | } |
147 | }else { | 152 | }else { |
148 | emit error( -1 ); | 153 | emit error( -1 ); |
149 | delete m_send; | 154 | delete m_send; |
150 | m_send = 0; | 155 | m_send = 0; |
151 | } | 156 | } |
152 | } | 157 | } |
153 | QString Obex::parseOut( ){ | 158 | QString Obex::parseOut( ){ |
154 | QString path; | 159 | QString path; |
155 | QStringList list = QStringList::split("\n", m_outp); | 160 | QStringList list = QStringList::split("\n", m_outp); |
156 | QStringList::Iterator it; | 161 | QStringList::Iterator it; |
157 | for (it = list.begin(); it != list.end(); ++it ) { | 162 | for (it = list.begin(); it != list.end(); ++it ) { |
158 | if ( (*it).startsWith("Wrote" ) ) { | 163 | if ( (*it).startsWith("Wrote" ) ) { |
159 | int pos = (*it).findRev('(' ); | 164 | int pos = (*it).findRev('(' ); |
160 | if ( pos > 0 ) { | 165 | if ( pos > 0 ) { |
161 | qWarning( "%d %s", pos, (*it).mid(6 ).latin1() ) ; | 166 | owarn << pos << " " << (*it).mid(6 ).latin1() << oendl; |
162 | qWarning("%d %d", (*it).length(), (*it).length()-pos ); | 167 | owarn << (*it).length() << " " << (*it).length()-pos << oendl; |
163 | 168 | ||
164 | path = (*it).remove( pos, (*it).length() - pos ); | 169 | path = (*it).remove( pos, (*it).length() - pos ); |
165 | qWarning("%s", path.latin1() ); | 170 | owarn << path.latin1() << oendl; |
166 | path = path.mid(6 ); | 171 | path = path.mid(6 ); |
167 | path = path.stripWhiteSpace(); | 172 | path = path.stripWhiteSpace(); |
168 | qWarning("path %s", path.latin1() ); | 173 | owarn << "path " << path.latin1() << oendl; |
169 | } | 174 | } |
170 | } | 175 | } |
171 | } | 176 | } |
172 | return path; | 177 | return path; |
173 | } | 178 | } |
174 | /** | 179 | /** |
175 | * when sent is done slotError is called we will start receive again | 180 | * when sent is done slotError is called we will start receive again |
176 | */ | 181 | */ |
177 | void Obex::slotError() { | 182 | void Obex::slotError() { |
178 | qWarning("slotError"); | 183 | owarn << "slotError" << oendl; |
179 | if ( m_receive ) | 184 | if ( m_receive ) |
180 | receive(); | 185 | receive(); |
181 | }; | 186 | }; |
182 | void Obex::setReceiveEnabled( bool receive ) { | 187 | void Obex::setReceiveEnabled( bool receive ) { |
183 | if ( !receive ) { // | 188 | if ( !receive ) { // |
184 | m_receive = false; | 189 | m_receive = false; |
185 | shutDownReceive(); | 190 | shutDownReceive(); |
186 | } | 191 | } |
187 | } | 192 | } |
188 | 193 | ||
189 | void Obex::shutDownReceive() { | 194 | void Obex::shutDownReceive() { |
190 | if (m_rec != 0 ) { | 195 | if (m_rec != 0 ) { |
191 | qWarning("running"); | 196 | owarn << "running" << oendl; |
192 | if (m_rec->isRunning() ) { | 197 | if (m_rec->isRunning() ) { |
193 | emit error(-1 ); | 198 | emit error(-1 ); |
194 | qWarning("is running"); | 199 | owarn << "is running" << oendl; |
195 | delete m_rec; | 200 | delete m_rec; |
196 | m_rec = 0; | 201 | m_rec = 0; |
197 | } | 202 | } |
198 | } | 203 | } |
199 | 204 | ||
200 | } | 205 | } |
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 | |||
@@ -4,66 +4,73 @@ | |||
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "loginapplication.h" | ||
29 | |||
30 | /* OPIE */ | ||
31 | #include <opie2/odebug.h> | ||
32 | |||
33 | /* QT */ | ||
34 | |||
35 | /* STD */ | ||
28 | #include <pwd.h> | 36 | #include <pwd.h> |
29 | #include <grp.h> | 37 | #include <grp.h> |
30 | #include <unistd.h> | 38 | #include <unistd.h> |
31 | #include <stdlib.h> | 39 | #include <stdlib.h> |
32 | #include <signal.h> | 40 | #include <signal.h> |
33 | #include <sys/stat.h> | 41 | #include <sys/stat.h> |
34 | #include <sys/wait.h> | 42 | #include <sys/wait.h> |
35 | 43 | ||
36 | #ifdef USEPAM | 44 | #ifdef USEPAM |
37 | extern "C" { | 45 | extern "C" { |
38 | #include <security/pam_appl.h> | 46 | #include <security/pam_appl.h> |
39 | } | 47 | } |
40 | #else | 48 | #else |
41 | #include <crypt.h> | 49 | #include <crypt.h> |
42 | #include <shadow.h> | 50 | #include <shadow.h> |
43 | #endif | 51 | #endif |
44 | 52 | ||
45 | #include "loginapplication.h" | ||
46 | 53 | ||
47 | LoginApplication *lApp; | 54 | LoginApplication *lApp; |
48 | 55 | ||
49 | LoginApplication::LoginApplication ( int &argc, char **argv, pid_t parentpid ) | 56 | LoginApplication::LoginApplication ( int &argc, char **argv, pid_t parentpid ) |
50 | : QPEApplication ( argc, argv, GuiServer ) | 57 | : QPEApplication ( argc, argv, GuiServer ) |
51 | { | 58 | { |
52 | lApp = this; | 59 | lApp = this; |
53 | m_parentpid = parentpid; | 60 | m_parentpid = parentpid; |
54 | } | 61 | } |
55 | 62 | ||
56 | const char *LoginApplication::s_username = 0; | 63 | const char *LoginApplication::s_username = 0; |
57 | 64 | ||
58 | #ifdef USEPAM | 65 | #ifdef USEPAM |
59 | 66 | ||
60 | const char *LoginApplication::s_pam_password = 0; | 67 | const char *LoginApplication::s_pam_password = 0; |
61 | 68 | ||
62 | int LoginApplication::pam_helper ( int num_msg, const struct pam_message **msg, struct pam_response **resp, void * ) | 69 | int LoginApplication::pam_helper ( int num_msg, const struct pam_message **msg, struct pam_response **resp, void * ) |
63 | { | 70 | { |
64 | int replies = 0; | 71 | int replies = 0; |
65 | struct pam_response *reply = 0; | 72 | struct pam_response *reply = 0; |
66 | int size = sizeof( struct pam_response ); | 73 | int size = sizeof( struct pam_response ); |
67 | 74 | ||
68 | for ( int i = 0; i < num_msg; i++ ) { | 75 | for ( int i = 0; i < num_msg; i++ ) { |
69 | switch ( msg [i]-> msg_style ) { | 76 | switch ( msg [i]-> msg_style ) { |
@@ -141,82 +148,82 @@ bool LoginApplication::checkPassword ( const char *user, const char *pass ) | |||
141 | correct = pw-> pw_passwd; | 148 | correct = pw-> pw_passwd; |
142 | 149 | ||
143 | if ( correct == 0 || correct[0] == '\0' ) | 150 | if ( correct == 0 || correct[0] == '\0' ) |
144 | return true; | 151 | return true; |
145 | 152 | ||
146 | encrypted = ::crypt ( pass, correct ); | 153 | encrypted = ::crypt ( pass, correct ); |
147 | return ( ::strcmp ( encrypted, correct ) == 0 ); | 154 | return ( ::strcmp ( encrypted, correct ) == 0 ); |
148 | } | 155 | } |
149 | 156 | ||
150 | #endif | 157 | #endif |
151 | 158 | ||
152 | bool LoginApplication::changeIdentity ( ) | 159 | bool LoginApplication::changeIdentity ( ) |
153 | { | 160 | { |
154 | const char *DEFAULT_LOGIN_PATH = "/bin:/usr/bin"; | 161 | const char *DEFAULT_LOGIN_PATH = "/bin:/usr/bin"; |
155 | const char *DEFAULT_ROOT_LOGIN_PATH = "/usr/sbin:/bin:/usr/bin:/sbin"; | 162 | const char *DEFAULT_ROOT_LOGIN_PATH = "/usr/sbin:/bin:/usr/bin:/sbin"; |
156 | 163 | ||
157 | if ( !s_username ) | 164 | if ( !s_username ) |
158 | return false; | 165 | return false; |
159 | struct passwd *pw = ::getpwnam ( s_username ); | 166 | struct passwd *pw = ::getpwnam ( s_username ); |
160 | if ( !pw ) | 167 | if ( !pw ) |
161 | return false; | 168 | return false; |
162 | 169 | ||
163 | // we are still root at this point - try to run the pre-session script | 170 | // we are still root at this point - try to run the pre-session script |
164 | if ( !runRootScript ( "OPIEDIR", "share/opie-login/pre-session", s_username )) | 171 | if ( !runRootScript ( "OPIEDIR", "share/opie-login/pre-session", s_username )) |
165 | qWarning ( "failed to run $OPIEDIR/share/opie-login/pre-session" ); | 172 | owarn << "failed to run $OPIEDIR/share/opie-login/pre-session" << oendl; |
166 | 173 | ||
167 | bool fail = false; | 174 | bool fail = false; |
168 | fail |= ( ::initgroups ( pw-> pw_name, pw-> pw_gid )); | 175 | fail |= ( ::initgroups ( pw-> pw_name, pw-> pw_gid )); |
169 | ::endgrent ( ); | 176 | ::endgrent ( ); |
170 | fail |= ( ::setgid ( pw-> pw_gid )); | 177 | fail |= ( ::setgid ( pw-> pw_gid )); |
171 | fail |= ( ::setuid ( pw-> pw_uid )); | 178 | fail |= ( ::setuid ( pw-> pw_uid )); |
172 | 179 | ||
173 | fail |= ( ::chdir ( pw-> pw_dir ) && ::chdir ( "/" )); | 180 | fail |= ( ::chdir ( pw-> pw_dir ) && ::chdir ( "/" )); |
174 | 181 | ||
175 | fail |= ( ::setenv ( "HOME", pw-> pw_dir, 1 )); | 182 | fail |= ( ::setenv ( "HOME", pw-> pw_dir, 1 )); |
176 | fail |= ( ::setenv ( "SHELL", pw-> pw_shell, 1 )); | 183 | fail |= ( ::setenv ( "SHELL", pw-> pw_shell, 1 )); |
177 | fail |= ( ::setenv ( "USER", pw-> pw_name, 1 )); | 184 | fail |= ( ::setenv ( "USER", pw-> pw_name, 1 )); |
178 | fail |= ( ::setenv ( "LOGNAME", pw-> pw_name, 1 )); | 185 | fail |= ( ::setenv ( "LOGNAME", pw-> pw_name, 1 )); |
179 | fail |= ( ::setenv ( "PATH", ( pw-> pw_uid ? DEFAULT_LOGIN_PATH : DEFAULT_ROOT_LOGIN_PATH ), 1 )); | 186 | fail |= ( ::setenv ( "PATH", ( pw-> pw_uid ? DEFAULT_LOGIN_PATH : DEFAULT_ROOT_LOGIN_PATH ), 1 )); |
180 | 187 | ||
181 | return !fail; | 188 | return !fail; |
182 | } | 189 | } |
183 | 190 | ||
184 | bool LoginApplication::login ( ) | 191 | bool LoginApplication::login ( ) |
185 | { | 192 | { |
186 | execUserScript ( "HOME", ".opie-session" ); | 193 | execUserScript ( "HOME", ".opie-session" ); |
187 | execUserScript ( "OPIEDIR", "share/opie-login/opie-session" ); | 194 | execUserScript ( "OPIEDIR", "share/opie-login/opie-session" ); |
188 | execUserScript ( "OPIEDIR", "bin/qpe" ); | 195 | execUserScript ( "OPIEDIR", "bin/qpe" ); |
189 | 196 | ||
190 | qWarning ( "failed to start an Opie session" ); | 197 | owarn << "failed to start an Opie session" << oendl; |
191 | return false; | 198 | return false; |
192 | } | 199 | } |
193 | 200 | ||
194 | void LoginApplication::logout ( ) | 201 | void LoginApplication::logout ( ) |
195 | { | 202 | { |
196 | // we are now root again - try to run the post-session script | 203 | // we are now root again - try to run the post-session script |
197 | if ( !runRootScript ( "OPIEDIR", "share/opie-login/post-session" )) | 204 | if ( !runRootScript ( "OPIEDIR", "share/opie-login/post-session" )) |
198 | qWarning ( "failed to run $OPIEDIR/scripts/post-session" ); | 205 | owarn << "failed to run $OPIEDIR/scripts/post-session" << oendl; |
199 | } | 206 | } |
200 | 207 | ||
201 | 208 | ||
202 | static char *buildarg ( const char *base, const char *script ) | 209 | static char *buildarg ( const char *base, const char *script ) |
203 | { | 210 | { |
204 | const char *dir = base ? ::getenv ( base ) : "/"; | 211 | const char *dir = base ? ::getenv ( base ) : "/"; |
205 | char *arg = new char [::strlen ( dir ) + ::strlen ( script ) + 2]; | 212 | char *arg = new char [::strlen ( dir ) + ::strlen ( script ) + 2]; |
206 | 213 | ||
207 | ::strcpy ( arg, dir ); | 214 | ::strcpy ( arg, dir ); |
208 | ::strcat ( arg, "/" ); | 215 | ::strcat ( arg, "/" ); |
209 | ::strcat ( arg, script ); | 216 | ::strcat ( arg, script ); |
210 | 217 | ||
211 | return arg; | 218 | return arg; |
212 | } | 219 | } |
213 | 220 | ||
214 | bool LoginApplication::runRootScript ( const char *base, const char *script, const char *param ) | 221 | bool LoginApplication::runRootScript ( const char *base, const char *script, const char *param ) |
215 | { | 222 | { |
216 | bool res = false; | 223 | bool res = false; |
217 | char *arg = buildarg ( base, script ); | 224 | char *arg = buildarg ( base, script ); |
218 | 225 | ||
219 | struct stat st; | 226 | struct stat st; |
220 | if (( ::stat ( arg, &st ) == 0 ) && ( st. st_uid == 0 )) { | 227 | if (( ::stat ( arg, &st ) == 0 ) && ( st. st_uid == 0 )) { |
221 | pid_t child = ::fork ( ); | 228 | pid_t child = ::fork ( ); |
222 | 229 | ||
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,49 +1,53 @@ | |||
1 | #include "namelineedit.h" | 1 | #include "namelineedit.h" |
2 | 2 | ||
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
5 | |||
6 | |||
3 | namespace ABOOK { | 7 | namespace ABOOK { |
4 | NameLineEdit::NameLineEdit( QWidget* parent, const char* name ) | 8 | NameLineEdit::NameLineEdit( QWidget* parent, const char* name ) |
5 | : QLineEdit( parent, name ), m_prevSpace( true ) { | 9 | : QLineEdit( parent, name ), m_prevSpace( true ) { |
6 | } | 10 | } |
7 | 11 | ||
8 | NameLineEdit::NameLineEdit( const QString& str, QWidget* par, | 12 | NameLineEdit::NameLineEdit( const QString& str, QWidget* par, |
9 | const char* name ) | 13 | const char* name ) |
10 | : QLineEdit( str, par, name ),m_prevSpace( true ) { | 14 | : QLineEdit( str, par, name ),m_prevSpace( true ) { |
11 | } | 15 | } |
12 | 16 | ||
13 | NameLineEdit::~NameLineEdit() { | 17 | NameLineEdit::~NameLineEdit() { |
14 | } | 18 | } |
15 | 19 | ||
16 | void NameLineEdit::keyPressEvent( QKeyEvent* ev ) { | 20 | void NameLineEdit::keyPressEvent( QKeyEvent* ev ) { |
17 | QString t = ev->text(); | 21 | QString t = ev->text(); |
18 | int key = ev->key(); | 22 | int key = ev->key(); |
19 | int ascii = ev->ascii(); | 23 | int ascii = ev->ascii(); |
20 | 24 | ||
21 | // ### FIXME with composed events | 25 | // ### FIXME with composed events |
22 | if ( !t.isEmpty() && ( !ev->ascii() || ev->ascii()>=32 ) && | 26 | if ( !t.isEmpty() && ( !ev->ascii() || ev->ascii()>=32 ) && |
23 | key != Key_Delete && key != Key_Backspace && | 27 | key != Key_Delete && key != Key_Backspace && |
24 | key != Key_Return && key != Key_Enter ) { | 28 | key != Key_Return && key != Key_Enter ) { |
25 | qWarning( "str " + ev->text() + " %d", m_prevSpace ); | 29 | owarn << "str " << ev->text() << " " << m_prevSpace << oendl; |
26 | 30 | ||
27 | if ( m_prevSpace ) { | 31 | if ( m_prevSpace ) { |
28 | t = t.upper(); | 32 | t = t.upper(); |
29 | m_prevSpace = false; | 33 | m_prevSpace = false; |
30 | } | 34 | } |
31 | if ( key == Key_Space ) | 35 | if ( key == Key_Space ) |
32 | m_prevSpace = true; | 36 | m_prevSpace = true; |
33 | 37 | ||
34 | 38 | ||
35 | QKeyEvent nEv(ev->type(), key, ascii, ev->state(), | 39 | QKeyEvent nEv(ev->type(), key, ascii, ev->state(), |
36 | t, ev->isAutoRepeat(), ev->count() ); | 40 | t, ev->isAutoRepeat(), ev->count() ); |
37 | QLineEdit::keyPressEvent( &nEv ); | 41 | QLineEdit::keyPressEvent( &nEv ); |
38 | if ( !nEv.isAccepted() ) | 42 | if ( !nEv.isAccepted() ) |
39 | ev->ignore(); | 43 | ev->ignore(); |
40 | }else { | 44 | }else { |
41 | QLineEdit::keyPressEvent( ev ); | 45 | QLineEdit::keyPressEvent( ev ); |
42 | /* if key was a backspace lets see if we should | 46 | /* if key was a backspace lets see if we should |
43 | * capitalize the next letter | 47 | * capitalize the next letter |
44 | */ | 48 | */ |
45 | if ( key == Key_Backspace ) { | 49 | if ( key == Key_Backspace ) { |
46 | QString te = text(); | 50 | QString te = text(); |
47 | /* if string is empty capitalize the first letter */ | 51 | /* if string is empty capitalize the first letter */ |
48 | /* else see if we're at the end of the string */ | 52 | /* else see if we're at the end of the string */ |
49 | if ( te.isEmpty() || cursorPosition() == te.length() ) | 53 | if ( te.isEmpty() || cursorPosition() == te.length() ) |
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,47 +1,48 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | /* OPIE */ | 21 | /* OPIE */ |
22 | #include <opie2/odebug.h> | 22 | #include <opie2/odebug.h> |
23 | 23 | ||
24 | /* STD */ | ||
24 | #define _XOPEN_SOURCE | 25 | #define _XOPEN_SOURCE |
25 | #include <pwd.h> | 26 | #include <pwd.h> |
26 | #include <sys/types.h> | 27 | #include <sys/types.h> |
27 | #include <unistd.h> | 28 | #include <unistd.h> |
28 | #include <stdlib.h> | 29 | #include <stdlib.h> |
29 | #include <time.h> | 30 | #include <time.h> |
30 | 31 | ||
31 | #ifndef Q_OS_MACX | 32 | #ifndef Q_OS_MACX |
32 | #include <shadow.h> | 33 | #include <shadow.h> |
33 | #endif /* Q_OS_MACX */ | 34 | #endif /* Q_OS_MACX */ |
34 | 35 | ||
35 | /* we need the _OS_LINUX stuff first ! */ | 36 | /* we need the _OS_LINUX stuff first ! */ |
36 | 37 | ||
37 | #ifndef _OS_LINUX_ | 38 | #ifndef _OS_LINUX_ |
38 | // Is anybody able to review this ? The include "uuid/uuid.h" couldn't be found | 39 | // Is anybody able to review this ? The include "uuid/uuid.h" couldn't be found |
39 | // anywhere ? Therfore I removed it completely.. | 40 | // anywhere ? Therfore I removed it completely.. |
40 | // I think it should be made permanentyl !? (eilers) | 41 | // I think it should be made permanentyl !? (eilers) |
41 | #warning "Where should uuid/uuid.h be found ? Removed this part .. (eilers)" | 42 | #warning "Where should uuid/uuid.h be found ? Removed this part .. (eilers)" |
42 | #if 0 | 43 | #if 0 |
43 | 44 | ||
44 | extern "C" | 45 | extern "C" |
45 | { | 46 | { |
46 | #include <uuid/uuid.h> | 47 | #include <uuid/uuid.h> |
47 | #define UUID_H_INCLUDED | 48 | #define UUID_H_INCLUDED |
@@ -1106,51 +1107,50 @@ void ServerDTP::connected() | |||
1106 | file.close(); | 1107 | file.close(); |
1107 | emit completed(); | 1108 | emit completed(); |
1108 | mode = Idle; | 1109 | mode = Idle; |
1109 | } | 1110 | } |
1110 | else { | 1111 | else { |
1111 | 1112 | ||
1112 | if ( !file.atEnd() ) { | 1113 | if ( !file.atEnd() ) { |
1113 | QCString s; | 1114 | QCString s; |
1114 | s.resize( block_size ); | 1115 | s.resize( block_size ); |
1115 | int bytes = file.readBlock( s.data(), block_size ); | 1116 | int bytes = file.readBlock( s.data(), block_size ); |
1116 | writeBlock( s.data(), bytes ); | 1117 | writeBlock( s.data(), bytes ); |
1117 | } | 1118 | } |
1118 | } | 1119 | } |
1119 | break; | 1120 | break; |
1120 | case SendGzipFile: | 1121 | case SendGzipFile: |
1121 | if ( createTargzProc->isRunning() ) { | 1122 | if ( createTargzProc->isRunning() ) { |
1122 | // SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY | 1123 | // SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY |
1123 | owarn << "Previous tar --gzip process is still running; killing it..." << oendl; | 1124 | owarn << "Previous tar --gzip process is still running; killing it..." << oendl; |
1124 | createTargzProc->kill(); | 1125 | createTargzProc->kill(); |
1125 | } | 1126 | } |
1126 | 1127 | ||
1127 | bytes_written = 0; | 1128 | bytes_written = 0; |
1128 | odebug << "==>start send tar process" << oendl; | 1129 | odebug << "==>start send tar process" << oendl; |
1129 | if ( !createTargzProc->start(Opie::Core::OProcess::NotifyOnExit, Opie::Core::OProcess::Stdout) ) | 1130 | if ( !createTargzProc->start(Opie::Core::OProcess::NotifyOnExit, Opie::Core::OProcess::Stdout) ) |
1130 | qWarning("Error starting %s or %s", | 1131 | owarn << "Error starting " << createTargzProc->args()[0].data() |
1131 | createTargzProc->args()[0].data(), | 1132 | << " or " << gzipProc->args()[0].data() << oendl; |
1132 | gzipProc->args()[0].data()); | ||
1133 | break; | 1133 | break; |
1134 | case SendBuffer: | 1134 | case SendBuffer: |
1135 | if ( !buf.open( IO_ReadOnly) ) { | 1135 | if ( !buf.open( IO_ReadOnly) ) { |
1136 | emit failed(); | 1136 | emit failed(); |
1137 | mode = Idle; | 1137 | mode = Idle; |
1138 | return ; | 1138 | return ; |
1139 | } | 1139 | } |
1140 | 1140 | ||
1141 | // odebug << "Debug: Sending byte array" << oendl; | 1141 | // odebug << "Debug: Sending byte array" << oendl; |
1142 | bytes_written = 0; | 1142 | bytes_written = 0; |
1143 | while ( !buf.atEnd() ) | 1143 | while ( !buf.atEnd() ) |
1144 | putch( buf.getch() ); | 1144 | putch( buf.getch() ); |
1145 | buf.close(); | 1145 | buf.close(); |
1146 | break; | 1146 | break; |
1147 | case RetrieveFile: | 1147 | case RetrieveFile: |
1148 | // retrieve file mode | 1148 | // retrieve file mode |
1149 | if ( file.exists() && !file.remove() ) { | 1149 | if ( file.exists() && !file.remove() ) { |
1150 | emit failed(); | 1150 | emit failed(); |
1151 | mode = Idle; | 1151 | mode = Idle; |
1152 | return ; | 1152 | return ; |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | if ( !file.open( IO_WriteOnly) ) { | 1155 | if ( !file.open( IO_WriteOnly) ) { |
1156 | emit failed(); | 1156 | emit failed(); |