summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/output.cpp5
-rw-r--r--noncore/apps/tinykate/libkate/document/katebuffer.cpp5
-rw-r--r--noncore/settings/usermanager/userdialog.cpp5
3 files changed, 11 insertions, 4 deletions
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp
index 8c585f4..8f654d5 100644
--- a/noncore/apps/advancedfm/output.cpp
+++ b/noncore/apps/advancedfm/output.cpp
@@ -171,50 +171,51 @@ Output::Output( const QStringList commands, QWidget* parent, const char* name,
171 perror("Error: "); 171 perror("Error: ");
172 QString errorMsg=tr("Error\n")+(QString)strerror(errno); 172 QString errorMsg=tr("Error\n")+(QString)strerror(errno);
173 OutputEdit->append( errorMsg); 173 OutputEdit->append( errorMsg);
174 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 174 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
175 } 175 }
176} 176}
177 177
178Output::~Output() { 178Output::~Output() {
179} 179}
180 180
181void Output::saveOutput() { 181void Output::saveOutput() {
182 182
183 InputDialog *fileDlg; 183 InputDialog *fileDlg;
184 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); 184 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0);
185 fileDlg->exec(); 185 fileDlg->exec();
186 if( fileDlg->result() == 1 ) { 186 if( fileDlg->result() == 1 ) {
187 QString filename = QPEApplication::documentDir(); 187 QString filename = QPEApplication::documentDir();
188 if(filename.right(1).find('/') == -1) 188 if(filename.right(1).find('/') == -1)
189 filename+="/"; 189 filename+="/";
190 QString name = fileDlg->LineEdit1->text(); 190 QString name = fileDlg->LineEdit1->text();
191 filename+="text/plain/"+name; 191 filename+="text/plain/"+name;
192 odebug << filename << oendl; 192 odebug << filename << oendl;
193 193
194 QFile f(filename); 194 QFile f(filename);
195 f.open( IO_WriteOnly); 195 if ( !f.open( IO_WriteOnly ) )
196 if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { 196 owarn << "Could no open file" << oendl;
197 else if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) {
197 DocLnk lnk; 198 DocLnk lnk;
198 lnk.setName(name); //sets file name 199 lnk.setName(name); //sets file name
199 lnk.setFile(filename); //sets File property 200 lnk.setFile(filename); //sets File property
200 lnk.setType("text/plain"); 201 lnk.setType("text/plain");
201 if(!lnk.writeLink()) { 202 if(!lnk.writeLink()) {
202 odebug << "Writing doclink did not work" << oendl; 203 odebug << "Writing doclink did not work" << oendl;
203 } 204 }
204 } else 205 } else
205 owarn << "Could not write file" << oendl; 206 owarn << "Could not write file" << oendl;
206 f.close(); 207 f.close();
207 } 208 }
208} 209}
209 210
210void Output::commandStdout(OProcess*, char *buffer, int buflen) { 211void Output::commandStdout(OProcess*, char *buffer, int buflen) {
211 owarn << "received stdout " << buflen << " bytes" << oendl; 212 owarn << "received stdout " << buflen << " bytes" << oendl;
212 213
213// QByteArray data(buflen); 214// QByteArray data(buflen);
214// data.fill(*buffer, buflen); 215// data.fill(*buffer, buflen);
215// for (uint i = 0; i < data.count(); i++ ) { 216// for (uint i = 0; i < data.count(); i++ ) {
216// printf("%c", buffer[i] ); 217// printf("%c", buffer[i] );
217// } 218// }
218// printf("\n"); 219// printf("\n");
219 220
220 QString lineStr = buffer; 221 QString lineStr = buffer;
diff --git a/noncore/apps/tinykate/libkate/document/katebuffer.cpp b/noncore/apps/tinykate/libkate/document/katebuffer.cpp
index 4c15fd0..d89edbd 100644
--- a/noncore/apps/tinykate/libkate/document/katebuffer.cpp
+++ b/noncore/apps/tinykate/libkate/document/katebuffer.cpp
@@ -51,49 +51,52 @@ KWBuffer::KWBuffer()
51} 51}
52 52
53void 53void
54KWBuffer::clear() 54KWBuffer::clear()
55{ 55{
56 m_stringListIt=0; 56 m_stringListIt=0;
57 m_stringListCurrent=0; 57 m_stringListCurrent=0;
58 m_stringList.clear(); 58 m_stringList.clear();
59 m_lineCount=1; 59 m_lineCount=1;
60 m_stringListIt = m_stringList.append(new TextLine()); 60 m_stringListIt = m_stringList.append(new TextLine());
61} 61}
62 62
63/** 63/**
64 * Insert a file at line @p line in the buffer. 64 * Insert a file at line @p line in the buffer.
65 */ 65 */
66void 66void
67KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec) 67KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec)
68{ 68{
69 if (line) { 69 if (line) {
70 odebug << "insert File only supports insertion at line 0 == file opening" << oendl; 70 odebug << "insert File only supports insertion at line 0 == file opening" << oendl;
71 return; 71 return;
72 } 72 }
73 clear(); 73 clear();
74 QFile iofile(file); 74 QFile iofile(file);
75 iofile.open(IO_ReadOnly); 75 if (!iofile.open(IO_ReadOnly)) {
76 owarn << "failed to open file " << iofile.name() << oendl;
77 return;
78 }
76 QTextStream stream(&iofile); 79 QTextStream stream(&iofile);
77 stream.setCodec(codec); 80 stream.setCodec(codec);
78 QString qsl; 81 QString qsl;
79 int count=0; 82 int count=0;
80 for (count=0;((qsl=stream.readLine())!=QString::null); count++) 83 for (count=0;((qsl=stream.readLine())!=QString::null); count++)
81 { 84 {
82 if (count==0) 85 if (count==0)
83 { 86 {
84 (*m_stringListIt)->append(qsl.unicode(),qsl.length()); 87 (*m_stringListIt)->append(qsl.unicode(),qsl.length());
85 } 88 }
86 else 89 else
87 { 90 {
88 TextLine::Ptr tl=new TextLine(); 91 TextLine::Ptr tl=new TextLine();
89 tl ->append(qsl.unicode(),qsl.length()); 92 tl ->append(qsl.unicode(),qsl.length());
90 m_stringListIt=m_stringList.append(tl); 93 m_stringListIt=m_stringList.append(tl);
91 } 94 }
92 } 95 }
93 if (count!=0) 96 if (count!=0)
94 { 97 {
95 m_stringListCurrent=count-1; 98 m_stringListCurrent=count-1;
96 m_lineCount=count; 99 m_lineCount=count;
97 } 100 }
98} 101}
99 102
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index 3654639..75a96a6 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -221,52 +221,55 @@ bool UserDialog::addUser(int uid, int gid)
221 adduserDialog->groupID=gid; // Set next available GID as default gid. 221 adduserDialog->groupID=gid; // Set next available GID as default gid.
222 // Insert default group into groupComboBox 222 // Insert default group into groupComboBox
223 adduserDialog->groupComboBox->insertItem("<create new group>",0); 223 adduserDialog->groupComboBox->insertItem("<create new group>",0);
224 adduserDialog->uidLineEdit->setText(QString::number(uid)); 224 adduserDialog->uidLineEdit->setText(QString::number(uid));
225 // If we're running on OZ, add new users to some default groups. 225 // If we're running on OZ, add new users to some default groups.
226 if(oz) 226 if(oz)
227 { 227 {
228 QListViewItemIterator iter( adduserDialog->groupsListView ); 228 QListViewItemIterator iter( adduserDialog->groupsListView );
229 for ( ; iter.current(); ++iter ) 229 for ( ; iter.current(); ++iter )
230 { 230 {
231 temp=(QCheckListItem*)iter.current(); 231 temp=(QCheckListItem*)iter.current();
232 if (temp->text()=="video") temp->setOn(true); 232 if (temp->text()=="video") temp->setOn(true);
233 if (temp->text()=="audio") temp->setOn(true); 233 if (temp->text()=="audio") temp->setOn(true);
234 if (temp->text()=="time") temp->setOn(true); 234 if (temp->text()=="time") temp->setOn(true);
235 if (temp->text()=="power") temp->setOn(true); 235 if (temp->text()=="power") temp->setOn(true);
236 if (temp->text()=="input") temp->setOn(true); 236 if (temp->text()=="input") temp->setOn(true);
237 if (temp->text()=="sharp") temp->setOn(true); 237 if (temp->text()=="sharp") temp->setOn(true);
238 if (temp->text()=="tty") temp->setOn(true); 238 if (temp->text()=="tty") temp->setOn(true);
239 } 239 }
240 } 240 }
241 // Show the dialog! 241 // Show the dialog!
242 if(!(adduserDialog->exec())) return false; 242 if(!(adduserDialog->exec())) return false;
243 if((adduserDialog->groupComboBox->currentItem()!=0)) 243 if((adduserDialog->groupComboBox->currentItem()!=0))
244 { 244 {
245 accounts->findGroup(adduserDialog->groupComboBox->currentText()); 245 // making the call findGroup() puts the group info in the accounts gr_gid
246 if (accounts->findGroup(adduserDialog->groupComboBox->currentText()))
247 {
246 adduserDialog->groupID=accounts->gr_gid; 248 adduserDialog->groupID=accounts->gr_gid;
247 owarn << QString::number(accounts->gr_gid) << oendl; 249 owarn << QString::number(accounts->gr_gid) << oendl;
248 } 250 }
251 }
249 if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(), 252 if(!(accounts->addUser(adduserDialog->loginLineEdit->text(), adduserDialog->passwordLineEdit->text(),
250 adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(), 253 adduserDialog->uidLineEdit->text().toInt(), adduserDialog->groupID, adduserDialog->gecosLineEdit->text(),
251 QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText()))) 254 QString("/home/")+adduserDialog->loginLineEdit->text() , adduserDialog->shellComboBox->currentText())))
252 { 255 {
253 QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user."); 256 QMessageBox::information(0,"Ooops!","Something went wrong!\nUnable to add user.");
254 return false; 257 return false;
255 } 258 }
256 259
257 // Add User to additional groups. 260 // Add User to additional groups.
258 QListViewItemIterator it( adduserDialog->groupsListView ); 261 QListViewItemIterator it( adduserDialog->groupsListView );
259 for ( ; it.current(); ++it ) 262 for ( ; it.current(); ++it )
260 { 263 {
261 temp=(QCheckListItem*)it.current(); 264 temp=(QCheckListItem*)it.current();
262 if (temp->isOn() ) 265 if (temp->isOn() )
263 accounts->addGroupMember(it.current()->text(0),adduserDialog->loginLineEdit->text()); 266 accounts->addGroupMember(it.current()->text(0),adduserDialog->loginLineEdit->text());
264 } 267 }
265 // Copy image to pics/users/ 268 // Copy image to pics/users/
266 if(!(adduserDialog->userImage.isNull())) 269 if(!(adduserDialog->userImage.isNull()))
267 { 270 {
268 QDir d; 271 QDir d;
269 if(!(d.exists(QPEApplication::qpeDir() + "pics/users"))) 272 if(!(d.exists(QPEApplication::qpeDir() + "pics/users")))
270 { 273 {
271 d.mkdir(QPEApplication::qpeDir() + "pics/users"); 274 d.mkdir(QPEApplication::qpeDir() + "pics/users");
272 } 275 }