summaryrefslogtreecommitdiff
authorleseb <leseb>2002-05-02 10:46:37 (UTC)
committer leseb <leseb>2002-05-02 10:46:37 (UTC)
commit9b22572f07ec954e9dda33e99f7fc681e3c50827 (patch) (unidiff)
tree7c1371e99fffb4bde17e35288c8584c74a34a151
parent9a3f2b67dab939993a56db83c1d473fc7ae6d57a (diff)
downloadopie-9b22572f07ec954e9dda33e99f7fc681e3c50827.zip
opie-9b22572f07ec954e9dda33e99f7fc681e3c50827.tar.gz
opie-9b22572f07ec954e9dda33e99f7fc681e3c50827.tar.bz2
Fix translation in message boxes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp
index 65b3dea..9f1e50b 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.cpp
+++ b/noncore/graphics/drawpad/drawpadcanvas.cpp
@@ -253,258 +253,267 @@ void DrawPadCanvas::save(QIODevice* ioDevice)
253 textStream << " </images>" << endl; 253 textStream << " </images>" << endl;
254 textStream << "</drawpad>"; 254 textStream << "</drawpad>";
255} 255}
256 256
257void DrawPadCanvas::importPage(const QString& fileName) 257void DrawPadCanvas::importPage(const QString& fileName)
258{ 258{
259 QPixmap* importedPixmap = new QPixmap(); 259 QPixmap* importedPixmap = new QPixmap();
260 260
261 importedPixmap->load(fileName); 261 importedPixmap->load(fileName);
262 m_pages.insert(m_pages.at() + 1, importedPixmap); 262 m_pages.insert(m_pages.at() + 1, importedPixmap);
263 263
264 m_pageBackups.clear(); 264 m_pageBackups.clear();
265 m_pageBackups.append(new QPixmap(*(m_pages.current()))); 265 m_pageBackups.append(new QPixmap(*(m_pages.current())));
266 266
267 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 267 resizeContents(m_pages.current()->width(), m_pages.current()->height());
268 viewport()->update(); 268 viewport()->update();
269 269
270 emit pagesChanged(); 270 emit pagesChanged();
271 emit pageBackupsChanged(); 271 emit pageBackupsChanged();
272} 272}
273 273
274void DrawPadCanvas::exportPage(uint fromPage, uint toPage, const QString& name,const QString& format) 274void DrawPadCanvas::exportPage(uint fromPage, uint toPage, const QString& name,const QString& format)
275{ 275{
276 if (fromPage == toPage) { 276 if (fromPage == toPage) {
277 DocLnk docLnk; 277 DocLnk docLnk;
278 MimeType mimeType(format); 278 MimeType mimeType(format);
279 279
280 docLnk.setName(name); 280 docLnk.setName(name);
281 docLnk.setType(mimeType.id()); 281 docLnk.setType(mimeType.id());
282 282
283 FileManager fileManager; 283 FileManager fileManager;
284 QIODevice* ioDevice = fileManager.saveFile(docLnk); 284 QIODevice* ioDevice = fileManager.saveFile(docLnk);
285 QImageIO imageIO(ioDevice, format); 285 QImageIO imageIO(ioDevice, format);
286 286
287 QImage image = m_pages.current()->convertToImage(); 287 QImage image = m_pages.current()->convertToImage();
288 imageIO.setImage(image); 288 imageIO.setImage(image);
289 imageIO.write(); 289 imageIO.write();
290 delete ioDevice; 290 delete ioDevice;
291 } else { 291 } else {
292 for (uint i = fromPage; i <= toPage; i++) { 292 for (uint i = fromPage; i <= toPage; i++) {
293 DocLnk docLnk; 293 DocLnk docLnk;
294 MimeType mimeType(format); 294 MimeType mimeType(format);
295 295
296 docLnk.setName(name + QString::number(i)); 296 docLnk.setName(name + QString::number(i));
297 docLnk.setType(mimeType.id()); 297 docLnk.setType(mimeType.id());
298 298
299 FileManager fileManager; 299 FileManager fileManager;
300 QIODevice* ioDevice = fileManager.saveFile(docLnk); 300 QIODevice* ioDevice = fileManager.saveFile(docLnk);
301 QImageIO imageIO(ioDevice, format); 301 QImageIO imageIO(ioDevice, format);
302 302
303 QImage image = m_pages.at(i - 1)->convertToImage(); 303 QImage image = m_pages.at(i - 1)->convertToImage();
304 imageIO.setImage(image); 304 imageIO.setImage(image);
305 imageIO.write(); 305 imageIO.write();
306 delete ioDevice; 306 delete ioDevice;
307 } 307 }
308 } 308 }
309} 309}
310 310
311QPixmap* DrawPadCanvas::currentPage() 311QPixmap* DrawPadCanvas::currentPage()
312{ 312{
313 return m_pages.current(); 313 return m_pages.current();
314} 314}
315 315
316QList<QPixmap> DrawPadCanvas::pages() 316QList<QPixmap> DrawPadCanvas::pages()
317{ 317{
318 return m_pages; 318 return m_pages;
319} 319}
320 320
321uint DrawPadCanvas::pagePosition() 321uint DrawPadCanvas::pagePosition()
322{ 322{
323 return (m_pages.at() + 1); 323 return (m_pages.at() + 1);
324} 324}
325 325
326uint DrawPadCanvas::pageCount() 326uint DrawPadCanvas::pageCount()
327{ 327{
328 return m_pages.count(); 328 return m_pages.count();
329} 329}
330 330
331void DrawPadCanvas::backupPage() 331void DrawPadCanvas::backupPage()
332{ 332{
333 QPixmap* currentBackup = m_pageBackups.current(); 333 QPixmap* currentBackup = m_pageBackups.current();
334 while (m_pageBackups.last() != currentBackup) { 334 while (m_pageBackups.last() != currentBackup) {
335 m_pageBackups.removeLast(); 335 m_pageBackups.removeLast();
336 } 336 }
337 337
338 while (m_pageBackups.count() >= (5 + 1)) { 338 while (m_pageBackups.count() >= (5 + 1)) {
339 m_pageBackups.removeFirst(); 339 m_pageBackups.removeFirst();
340 } 340 }
341 341
342 m_pageBackups.append(new QPixmap(*(m_pages.current()))); 342 m_pageBackups.append(new QPixmap(*(m_pages.current())));
343 343
344 emit pageBackupsChanged(); 344 emit pageBackupsChanged();
345} 345}
346 346
347void DrawPadCanvas::deleteAll() 347void DrawPadCanvas::deleteAll()
348{ 348{
349 QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"), 349 QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"),
350 QMessageBox::Information, QMessageBox::Yes, 350 QMessageBox::Information, QMessageBox::Yes,
351 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, 351 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default,
352 QMessageBox::NoButton, this); 352 QMessageBox::NoButton, this);
353 353
354 messageBox.setButtonText(QMessageBox::Yes, tr("Yes"));
355 messageBox.setButtonText(QMessageBox::No, tr("No"));
356
354 if (messageBox.exec() == QMessageBox::Yes) { 357 if (messageBox.exec() == QMessageBox::Yes) {
355 m_pages.clear(); 358 m_pages.clear();
356 359
357 m_pages.append(new QPixmap(contentsRect().size())); 360 m_pages.append(new QPixmap(contentsRect().size()));
358 m_pages.current()->fill(Qt::white); 361 m_pages.current()->fill(Qt::white);
359 362
360 m_pageBackups.clear(); 363 m_pageBackups.clear();
361 m_pageBackups.append(new QPixmap(*(m_pages.current()))); 364 m_pageBackups.append(new QPixmap(*(m_pages.current())));
362 365
363 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 366 resizeContents(m_pages.current()->width(), m_pages.current()->height());
364 viewport()->update(); 367 viewport()->update();
365 368
366 emit pagesChanged(); 369 emit pagesChanged();
367 emit pageBackupsChanged(); 370 emit pageBackupsChanged();
368 } 371 }
369} 372}
370 373
371void DrawPadCanvas::newPage() 374void DrawPadCanvas::newPage()
372{ 375{
373 QRect rect = contentsRect(); 376 QRect rect = contentsRect();
374 377
375 NewPageDialog newPageDialog(rect.width(), rect.height(), m_pDrawPad->pen().color(), 378 NewPageDialog newPageDialog(rect.width(), rect.height(), m_pDrawPad->pen().color(),
376 m_pDrawPad->brush().color(), this); 379 m_pDrawPad->brush().color(), this);
377 380
378 if (newPageDialog.exec() == QDialog::Accepted) { 381 if (newPageDialog.exec() == QDialog::Accepted) {
379 m_pages.insert(m_pages.at() + 1, new QPixmap(newPageDialog.selectedWidth(), 382 m_pages.insert(m_pages.at() + 1, new QPixmap(newPageDialog.selectedWidth(),
380 newPageDialog.selectedHeight())); 383 newPageDialog.selectedHeight()));
381 m_pages.current()->fill(newPageDialog.selectedColor()); 384 m_pages.current()->fill(newPageDialog.selectedColor());
382 385
383 m_pageBackups.clear(); 386 m_pageBackups.clear();
384 m_pageBackups.append(new QPixmap(*(m_pages.current()))); 387 m_pageBackups.append(new QPixmap(*(m_pages.current())));
385 388
386 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 389 resizeContents(m_pages.current()->width(), m_pages.current()->height());
387 viewport()->update(); 390 viewport()->update();
388 391
389 emit pagesChanged(); 392 emit pagesChanged();
390 emit pageBackupsChanged(); 393 emit pageBackupsChanged();
391 } 394 }
392} 395}
393 396
394void DrawPadCanvas::clearPage() 397void DrawPadCanvas::clearPage()
395{ 398{
396 QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"), 399 QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"),
397 QMessageBox::Information, QMessageBox::Yes, 400 QMessageBox::Information, QMessageBox::Yes,
398 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, 401 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default,
399 QMessageBox::NoButton, this); 402 QMessageBox::NoButton, this);
400 403
404 messageBox.setButtonText(QMessageBox::Yes, tr("Yes"));
405 messageBox.setButtonText(QMessageBox::No, tr("No"));
406
401 if (messageBox.exec() == QMessageBox::Yes) { 407 if (messageBox.exec() == QMessageBox::Yes) {
402 m_pages.current()->fill(Qt::white); 408 m_pages.current()->fill(Qt::white);
403 409
404 viewport()->update(); 410 viewport()->update();
405 } 411 }
406} 412}
407 413
408void DrawPadCanvas::deletePage() 414void DrawPadCanvas::deletePage()
409{ 415{
410 QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe current page?"), 416 QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe current page?"),
411 QMessageBox::Information, QMessageBox::Yes, 417 QMessageBox::Information, QMessageBox::Yes,
412 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, 418 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default,
413 QMessageBox::NoButton, this); 419 QMessageBox::NoButton, this);
414 420
421 messageBox.setButtonText(QMessageBox::Yes, tr("Yes"));
422 messageBox.setButtonText(QMessageBox::No, tr("No"));
423
415 if (messageBox.exec() == QMessageBox::Yes) { 424 if (messageBox.exec() == QMessageBox::Yes) {
416 m_pages.remove(m_pages.current()); 425 m_pages.remove(m_pages.current());
417 426
418 if (m_pages.isEmpty()) { 427 if (m_pages.isEmpty()) {
419 m_pages.append(new QPixmap(contentsRect().size())); 428 m_pages.append(new QPixmap(contentsRect().size()));
420 m_pages.current()->fill(Qt::white); 429 m_pages.current()->fill(Qt::white);
421 } 430 }
422 431
423 m_pageBackups.clear(); 432 m_pageBackups.clear();
424 m_pageBackups.append(new QPixmap(*(m_pages.current()))); 433 m_pageBackups.append(new QPixmap(*(m_pages.current())));
425 434
426 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 435 resizeContents(m_pages.current()->width(), m_pages.current()->height());
427 viewport()->update(); 436 viewport()->update();
428 437
429 emit pagesChanged(); 438 emit pagesChanged();
430 emit pageBackupsChanged(); 439 emit pageBackupsChanged();
431 } 440 }
432} 441}
433 442
434bool DrawPadCanvas::undoEnabled() 443bool DrawPadCanvas::undoEnabled()
435{ 444{
436 return (m_pageBackups.current() != m_pageBackups.getFirst()); 445 return (m_pageBackups.current() != m_pageBackups.getFirst());
437} 446}
438 447
439bool DrawPadCanvas::redoEnabled() 448bool DrawPadCanvas::redoEnabled()
440{ 449{
441 return (m_pageBackups.current() != m_pageBackups.getLast()); 450 return (m_pageBackups.current() != m_pageBackups.getLast());
442} 451}
443 452
444bool DrawPadCanvas::goPreviousPageEnabled() 453bool DrawPadCanvas::goPreviousPageEnabled()
445{ 454{
446 return (m_pages.current() != m_pages.getFirst()); 455 return (m_pages.current() != m_pages.getFirst());
447} 456}
448 457
449bool DrawPadCanvas::goNextPageEnabled() 458bool DrawPadCanvas::goNextPageEnabled()
450{ 459{
451 return (m_pages.current() != m_pages.getLast()); 460 return (m_pages.current() != m_pages.getLast());
452} 461}
453 462
454void DrawPadCanvas::undo() 463void DrawPadCanvas::undo()
455{ 464{
456 *(m_pages.current()) = *(m_pageBackups.prev()); 465 *(m_pages.current()) = *(m_pageBackups.prev());
457 466
458 viewport()->update(); 467 viewport()->update();
459 468
460 emit pageBackupsChanged(); 469 emit pageBackupsChanged();
461} 470}
462 471
463void DrawPadCanvas::redo() 472void DrawPadCanvas::redo()
464{ 473{
465 *(m_pages.current()) = *(m_pageBackups.next()); 474 *(m_pages.current()) = *(m_pageBackups.next());
466 475
467 viewport()->update(); 476 viewport()->update();
468 477
469 emit pageBackupsChanged(); 478 emit pageBackupsChanged();
470} 479}
471 480
472void DrawPadCanvas::goFirstPage() 481void DrawPadCanvas::goFirstPage()
473{ 482{
474 m_pages.first(); 483 m_pages.first();
475 m_pageBackups.clear(); 484 m_pageBackups.clear();
476 m_pageBackups.append(new QPixmap(*(m_pages.current()))); 485 m_pageBackups.append(new QPixmap(*(m_pages.current())));
477 486
478 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 487 resizeContents(m_pages.current()->width(), m_pages.current()->height());
479 viewport()->update(); 488 viewport()->update();
480 489
481 emit pagesChanged(); 490 emit pagesChanged();
482 emit pageBackupsChanged(); 491 emit pageBackupsChanged();
483} 492}
484 493
485void DrawPadCanvas::goPreviousPage() 494void DrawPadCanvas::goPreviousPage()
486{ 495{
487 m_pages.prev(); 496 m_pages.prev();
488 m_pageBackups.clear(); 497 m_pageBackups.clear();
489 m_pageBackups.append(new QPixmap(*(m_pages.current()))); 498 m_pageBackups.append(new QPixmap(*(m_pages.current())));
490 499
491 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 500 resizeContents(m_pages.current()->width(), m_pages.current()->height());
492 viewport()->update(); 501 viewport()->update();
493 502
494 emit pagesChanged(); 503 emit pagesChanged();
495 emit pageBackupsChanged(); 504 emit pageBackupsChanged();
496} 505}
497 506
498void DrawPadCanvas::goNextPage() 507void DrawPadCanvas::goNextPage()
499{ 508{
500 m_pages.next(); 509 m_pages.next();
501 m_pageBackups.clear(); 510 m_pageBackups.clear();
502 m_pageBackups.append(new QPixmap(*(m_pages.current()))); 511 m_pageBackups.append(new QPixmap(*(m_pages.current())));
503 512
504 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 513 resizeContents(m_pages.current()->width(), m_pages.current()->height());
505 viewport()->update(); 514 viewport()->update();
506 515
507 emit pagesChanged(); 516 emit pagesChanged();
508 emit pageBackupsChanged(); 517 emit pageBackupsChanged();
509} 518}
510 519