author | zautrix <zautrix> | 2004-10-09 15:58:52 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-09 15:58:52 (UTC) |
commit | b80a099d9432bdc3d4eea778b1813b82b2680ecf (patch) (unidiff) | |
tree | 6327321f86070a13969b07e25b9cf84d4ad10d13 | |
parent | ed1eac5e36e675b030cb5a5aa90fb2d44eb40c73 (diff) | |
download | kdepimpi-b80a099d9432bdc3d4eea778b1813b82b2680ecf.zip kdepimpi-b80a099d9432bdc3d4eea778b1813b82b2680ecf.tar.gz kdepimpi-b80a099d9432bdc3d4eea778b1813b82b2680ecf.tar.bz2 |
removed some debug output
-rw-r--r-- | kabc/vcardformatplugin.cpp | 2 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 24 | ||||
-rw-r--r-- | microkde/kconfig.cpp | 4 | ||||
-rw-r--r-- | microkde/kdecore/kstandarddirs.cpp | 2 | ||||
-rw-r--r-- | microkde/kdeui/kactioncollection.cpp | 5 | ||||
-rw-r--r-- | microkde/kdeui/klistview.cpp | 2 |
6 files changed, 18 insertions, 21 deletions
diff --git a/kabc/vcardformatplugin.cpp b/kabc/vcardformatplugin.cpp index bc18690..8db8c11 100644 --- a/kabc/vcardformatplugin.cpp +++ b/kabc/vcardformatplugin.cpp | |||
@@ -1,70 +1,70 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "vcardformatplugin.h" | 21 | #include "vcardformatplugin.h" |
22 | #include "vcardformatimpl.h" | 22 | #include "vcardformatimpl.h" |
23 | 23 | ||
24 | using namespace KABC; | 24 | using namespace KABC; |
25 | 25 | ||
26 | VCardFormatPlugin::VCardFormatPlugin() | 26 | VCardFormatPlugin::VCardFormatPlugin() |
27 | { | 27 | { |
28 | mImpl = new VCardFormatImpl; | 28 | mImpl = new VCardFormatImpl; |
29 | } | 29 | } |
30 | 30 | ||
31 | VCardFormatPlugin::~VCardFormatPlugin() | 31 | VCardFormatPlugin::~VCardFormatPlugin() |
32 | { | 32 | { |
33 | delete mImpl; | 33 | delete mImpl; |
34 | } | 34 | } |
35 | 35 | ||
36 | bool VCardFormatPlugin::load( Addressee &addressee, QFile *file ) | 36 | bool VCardFormatPlugin::load( Addressee &addressee, QFile *file ) |
37 | { | 37 | { |
38 | qDebug("VCardFormatPlugin::load"); | 38 | qDebug("VCardFormatPlugin::load"); |
39 | return mImpl->load( addressee, file ); | 39 | return mImpl->load( addressee, file ); |
40 | } | 40 | } |
41 | 41 | ||
42 | bool VCardFormatPlugin::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) | 42 | bool VCardFormatPlugin::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) |
43 | { | 43 | { |
44 | qDebug("VCardFormatPlugin::loadAll"); | 44 | // qDebug("VCardFormatPlugin::loadAll"); |
45 | return mImpl->loadAll( addressBook, resource, file ); | 45 | return mImpl->loadAll( addressBook, resource, file ); |
46 | } | 46 | } |
47 | 47 | ||
48 | void VCardFormatPlugin::save( const Addressee &addressee, QFile *file ) | 48 | void VCardFormatPlugin::save( const Addressee &addressee, QFile *file ) |
49 | { | 49 | { |
50 | qDebug("VCardFormatPlugin::save"); | 50 | qDebug("VCardFormatPlugin::save"); |
51 | mImpl->save( addressee, file ); | 51 | mImpl->save( addressee, file ); |
52 | } | 52 | } |
53 | 53 | ||
54 | void VCardFormatPlugin::saveAll( AddressBook *addressBook, Resource *resource, QFile *file ) | 54 | void VCardFormatPlugin::saveAll( AddressBook *addressBook, Resource *resource, QFile *file ) |
55 | { | 55 | { |
56 | qDebug("VCardFormatPlugin::saveAll"); | 56 | qDebug("VCardFormatPlugin::saveAll"); |
57 | mImpl->saveAll( addressBook, resource, file ); | 57 | mImpl->saveAll( addressBook, resource, file ); |
58 | } | 58 | } |
59 | 59 | ||
60 | bool VCardFormatPlugin::checkFormat( QFile *file ) const | 60 | bool VCardFormatPlugin::checkFormat( QFile *file ) const |
61 | { | 61 | { |
62 | QString line; | 62 | QString line; |
63 | 63 | ||
64 | file->readLine( line, 1024 ); | 64 | file->readLine( line, 1024 ); |
65 | line = line.stripWhiteSpace(); | 65 | line = line.stripWhiteSpace(); |
66 | if ( line == "BEGIN:VCARD" ) | 66 | if ( line == "BEGIN:VCARD" ) |
67 | return true; | 67 | return true; |
68 | else | 68 | else |
69 | return false; | 69 | return false; |
70 | } | 70 | } |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 80fb147..df53235 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -529,125 +529,125 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | |||
529 | question, | 529 | question, |
530 | i18n("Yes"), i18n("No"), | 530 | i18n("Yes"), i18n("No"), |
531 | 0, 0 ) != 0 ) | 531 | 0, 0 ) != 0 ) |
532 | return; | 532 | return; |
533 | } | 533 | } |
534 | 534 | ||
535 | QString preCommand; | 535 | QString preCommand; |
536 | QString localTempFile; | 536 | QString localTempFile; |
537 | QString postCommand; | 537 | QString postCommand; |
538 | 538 | ||
539 | switch(mTargetApp) | 539 | switch(mTargetApp) |
540 | { | 540 | { |
541 | case (KAPI): | 541 | case (KAPI): |
542 | preCommand = prof->getPreSyncCommandAB(); | 542 | preCommand = prof->getPreSyncCommandAB(); |
543 | postCommand = prof->getPostSyncCommandAB(); | 543 | postCommand = prof->getPostSyncCommandAB(); |
544 | localTempFile = prof->getLocalTempFileAB(); | 544 | localTempFile = prof->getLocalTempFileAB(); |
545 | break; | 545 | break; |
546 | case (KOPI): | 546 | case (KOPI): |
547 | preCommand = prof->getPreSyncCommand(); | 547 | preCommand = prof->getPreSyncCommand(); |
548 | postCommand = prof->getPostSyncCommand(); | 548 | postCommand = prof->getPostSyncCommand(); |
549 | localTempFile = prof->getLocalTempFile(); | 549 | localTempFile = prof->getLocalTempFile(); |
550 | break; | 550 | break; |
551 | case (PWMPI): | 551 | case (PWMPI): |
552 | preCommand = prof->getPreSyncCommandPWM(); | 552 | preCommand = prof->getPreSyncCommandPWM(); |
553 | postCommand = prof->getPostSyncCommandPWM(); | 553 | postCommand = prof->getPostSyncCommandPWM(); |
554 | localTempFile = prof->getLocalTempFilePWM(); | 554 | localTempFile = prof->getLocalTempFilePWM(); |
555 | break; | 555 | break; |
556 | default: | 556 | default: |
557 | qDebug("KSyncManager::syncRemote: invalid apptype selected"); | 557 | qDebug("KSyncManager::syncRemote: invalid apptype selected"); |
558 | break; | 558 | break; |
559 | } | 559 | } |
560 | 560 | ||
561 | 561 | ||
562 | int fi; | 562 | int fi; |
563 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { | 563 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { |
564 | QString pwd = getPassword(); | 564 | QString pwd = getPassword(); |
565 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); | 565 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); |
566 | 566 | ||
567 | } | 567 | } |
568 | int maxlen = 30; | 568 | int maxlen = 30; |
569 | if ( QApplication::desktop()->width() > 320 ) | 569 | if ( QApplication::desktop()->width() > 320 ) |
570 | maxlen += 25; | 570 | maxlen += 25; |
571 | mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); | 571 | mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); |
572 | int fileSize = 0; | 572 | int fileSize = 0; |
573 | int result = system ( preCommand ); | 573 | int result = system ( preCommand ); |
574 | // 0 : okay | 574 | // 0 : okay |
575 | // 256: no such file or dir | 575 | // 256: no such file or dir |
576 | // | 576 | // |
577 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | 577 | qDebug("Sync: Remote copy result(0 = okay): %d ",result ); |
578 | if ( result != 0 ) { | 578 | if ( result != 0 ) { |
579 | unsigned int len = maxlen; | 579 | unsigned int len = maxlen; |
580 | while ( len < preCommand.length() ) { | 580 | while ( len < preCommand.length() ) { |
581 | preCommand.insert( len , "\n" ); | 581 | preCommand.insert( len , "\n" ); |
582 | len += maxlen +2; | 582 | len += maxlen +2; |
583 | } | 583 | } |
584 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ; | 584 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ; |
585 | QMessageBox::information( mParent, i18n("Sync - ERROR"), | 585 | QMessageBox::information( mParent, i18n("Sync - ERROR"), |
586 | question, | 586 | question, |
587 | i18n("Okay!")) ; | 587 | i18n("Okay!")) ; |
588 | mParent->topLevelWidget()->setCaption ("KDE-Pim"); | 588 | mParent->topLevelWidget()->setCaption ("KDE-Pim"); |
589 | return; | 589 | return; |
590 | } | 590 | } |
591 | mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); | 591 | mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); |
592 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 592 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
593 | 593 | ||
594 | if ( syncWithFile( localTempFile, true ) ) { | 594 | if ( syncWithFile( localTempFile, true ) ) { |
595 | 595 | ||
596 | if ( mWriteBackFile ) { | 596 | if ( mWriteBackFile ) { |
597 | int fi; | 597 | int fi; |
598 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { | 598 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { |
599 | QString pwd = getPassword(); | 599 | QString pwd = getPassword(); |
600 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); | 600 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); |
601 | 601 | ||
602 | } | 602 | } |
603 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); | 603 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); |
604 | result = system ( postCommand ); | 604 | result = system ( postCommand ); |
605 | qDebug("Writing back file result: %d ", result); | 605 | qDebug("Sync:Writing back file result: %d ", result); |
606 | if ( result != 0 ) { | 606 | if ( result != 0 ) { |
607 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); | 607 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); |
608 | return; | 608 | return; |
609 | } else { | 609 | } else { |
610 | mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 610 | mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
611 | } | 611 | } |
612 | } | 612 | } |
613 | } | 613 | } |
614 | return; | 614 | return; |
615 | } | 615 | } |
616 | void KSyncManager::edit_pisync_options() | 616 | void KSyncManager::edit_pisync_options() |
617 | { | 617 | { |
618 | QDialog dia( mParent, "dia", true ); | 618 | QDialog dia( mParent, "dia", true ); |
619 | dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice ); | 619 | dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice ); |
620 | QVBoxLayout lay ( &dia ); | 620 | QVBoxLayout lay ( &dia ); |
621 | lay.setSpacing( 5 ); | 621 | lay.setSpacing( 5 ); |
622 | lay.setMargin( 3 ); | 622 | lay.setMargin( 3 ); |
623 | QLabel lab1 ( i18n("Password for remote access:"), &dia); | 623 | QLabel lab1 ( i18n("Password for remote access:"), &dia); |
624 | lay.addWidget( &lab1 ); | 624 | lay.addWidget( &lab1 ); |
625 | QLineEdit le1 (&dia ); | 625 | QLineEdit le1 (&dia ); |
626 | lay.addWidget( &le1 ); | 626 | lay.addWidget( &le1 ); |
627 | QLabel lab2 ( i18n("Remote IP address:"), &dia); | 627 | QLabel lab2 ( i18n("Remote IP address:"), &dia); |
628 | lay.addWidget( &lab2 ); | 628 | lay.addWidget( &lab2 ); |
629 | QLineEdit le2 (&dia ); | 629 | QLineEdit le2 (&dia ); |
630 | lay.addWidget( &le2 ); | 630 | lay.addWidget( &le2 ); |
631 | QLabel lab3 ( i18n("Remote port number:"), &dia); | 631 | QLabel lab3 ( i18n("Remote port number:"), &dia); |
632 | lay.addWidget( &lab3 ); | 632 | lay.addWidget( &lab3 ); |
633 | QLineEdit le3 (&dia ); | 633 | QLineEdit le3 (&dia ); |
634 | lay.addWidget( &le3 ); | 634 | lay.addWidget( &le3 ); |
635 | QPushButton pb ( "OK", &dia); | 635 | QPushButton pb ( "OK", &dia); |
636 | lay.addWidget( &pb ); | 636 | lay.addWidget( &pb ); |
637 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 637 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
638 | le1.setText( mPassWordPiSync ); | 638 | le1.setText( mPassWordPiSync ); |
639 | le2.setText( mActiveSyncIP ); | 639 | le2.setText( mActiveSyncIP ); |
640 | le3.setText( mActiveSyncPort ); | 640 | le3.setText( mActiveSyncPort ); |
641 | if ( dia.exec() ) { | 641 | if ( dia.exec() ) { |
642 | mPassWordPiSync = le1.text(); | 642 | mPassWordPiSync = le1.text(); |
643 | mActiveSyncPort = le3.text(); | 643 | mActiveSyncPort = le3.text(); |
644 | mActiveSyncIP = le2.text(); | 644 | mActiveSyncIP = le2.text(); |
645 | } | 645 | } |
646 | 646 | ||
647 | } | 647 | } |
648 | void KSyncManager::edit_sync_options() | 648 | void KSyncManager::edit_sync_options() |
649 | { | 649 | { |
650 | 650 | ||
651 | QDialog dia( mParent, "dia", true ); | 651 | QDialog dia( mParent, "dia", true ); |
652 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); | 652 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); |
653 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); | 653 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); |
@@ -700,388 +700,384 @@ void KSyncManager::edit_sync_options() | |||
700 | QString KSyncManager::getPassword( ) | 700 | QString KSyncManager::getPassword( ) |
701 | { | 701 | { |
702 | QString retfile = ""; | 702 | QString retfile = ""; |
703 | QDialog dia ( mParent, "input-dialog", true ); | 703 | QDialog dia ( mParent, "input-dialog", true ); |
704 | QLineEdit lab ( &dia ); | 704 | QLineEdit lab ( &dia ); |
705 | lab.setEchoMode( QLineEdit::Password ); | 705 | lab.setEchoMode( QLineEdit::Password ); |
706 | QVBoxLayout lay( &dia ); | 706 | QVBoxLayout lay( &dia ); |
707 | lay.setMargin(7); | 707 | lay.setMargin(7); |
708 | lay.setSpacing(7); | 708 | lay.setSpacing(7); |
709 | lay.addWidget( &lab); | 709 | lay.addWidget( &lab); |
710 | dia.setFixedSize( 230,50 ); | 710 | dia.setFixedSize( 230,50 ); |
711 | dia.setCaption( i18n("Enter password") ); | 711 | dia.setCaption( i18n("Enter password") ); |
712 | QPushButton pb ( "OK", &dia); | 712 | QPushButton pb ( "OK", &dia); |
713 | lay.addWidget( &pb ); | 713 | lay.addWidget( &pb ); |
714 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 714 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
715 | dia.show(); | 715 | dia.show(); |
716 | int res = dia.exec(); | 716 | int res = dia.exec(); |
717 | if ( res ) | 717 | if ( res ) |
718 | retfile = lab.text(); | 718 | retfile = lab.text(); |
719 | dia.hide(); | 719 | dia.hide(); |
720 | qApp->processEvents(); | 720 | qApp->processEvents(); |
721 | return retfile; | 721 | return retfile; |
722 | 722 | ||
723 | } | 723 | } |
724 | 724 | ||
725 | 725 | ||
726 | void KSyncManager::confSync() | 726 | void KSyncManager::confSync() |
727 | { | 727 | { |
728 | static KSyncPrefsDialog* sp = 0; | 728 | static KSyncPrefsDialog* sp = 0; |
729 | if ( ! sp ) { | 729 | if ( ! sp ) { |
730 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); | 730 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); |
731 | } | 731 | } |
732 | sp->usrReadConfig(); | 732 | sp->usrReadConfig(); |
733 | #ifndef DESKTOP_VERSION | 733 | #ifndef DESKTOP_VERSION |
734 | sp->showMaximized(); | 734 | sp->showMaximized(); |
735 | #else | 735 | #else |
736 | sp->show(); | 736 | sp->show(); |
737 | #endif | 737 | #endif |
738 | sp->exec(); | 738 | sp->exec(); |
739 | mSyncProfileNames = sp->getSyncProfileNames(); | 739 | mSyncProfileNames = sp->getSyncProfileNames(); |
740 | mLocalMachineName = sp->getLocalMachineName (); | 740 | mLocalMachineName = sp->getLocalMachineName (); |
741 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 741 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
742 | } | 742 | } |
743 | 743 | ||
744 | void KSyncManager::syncSharp() | 744 | void KSyncManager::syncSharp() |
745 | { | 745 | { |
746 | 746 | ||
747 | if ( ! syncExternalApplication("sharp") ) | 747 | if ( ! syncExternalApplication("sharp") ) |
748 | qDebug("ERROR sync sharp ");; | 748 | qDebug("ERROR sync sharp "); |
749 | } | 749 | } |
750 | 750 | ||
751 | bool KSyncManager::syncExternalApplication(QString resource) | 751 | bool KSyncManager::syncExternalApplication(QString resource) |
752 | { | 752 | { |
753 | 753 | ||
754 | emit save(); | 754 | emit save(); |
755 | 755 | ||
756 | if ( mAskForPreferences ) | 756 | if ( mAskForPreferences ) |
757 | edit_sync_options(); | 757 | edit_sync_options(); |
758 | 758 | ||
759 | qDebug("sync %s", resource.latin1()); | 759 | qDebug("Sync extern %s", resource.latin1()); |
760 | 760 | ||
761 | bool syncOK = mImplementation->syncExternal(this, resource); | 761 | bool syncOK = mImplementation->syncExternal(this, resource); |
762 | 762 | ||
763 | return syncOK; | 763 | return syncOK; |
764 | 764 | ||
765 | } | 765 | } |
766 | 766 | ||
767 | void KSyncManager::syncPhone() | 767 | void KSyncManager::syncPhone() |
768 | { | 768 | { |
769 | 769 | ||
770 | syncExternalApplication("phone"); | 770 | syncExternalApplication("phone"); |
771 | 771 | ||
772 | } | 772 | } |
773 | 773 | ||
774 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) | 774 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) |
775 | { | 775 | { |
776 | if (!bar->isVisible()) | 776 | if (!bar->isVisible()) |
777 | { | 777 | { |
778 | bar->setCaption (caption); | 778 | bar->setCaption (caption); |
779 | bar->setTotalSteps ( total ) ; | 779 | bar->setTotalSteps ( total ) ; |
780 | 780 | ||
781 | bar->show(); | 781 | bar->show(); |
782 | } | 782 | } |
783 | 783 | ||
784 | bar->setProgress( percentage ); | 784 | bar->setProgress( percentage ); |
785 | } | 785 | } |
786 | 786 | ||
787 | void KSyncManager::hideProgressBar() | 787 | void KSyncManager::hideProgressBar() |
788 | { | 788 | { |
789 | bar->hide(); | 789 | bar->hide(); |
790 | } | 790 | } |
791 | 791 | ||
792 | bool KSyncManager::isProgressBarCanceled() | 792 | bool KSyncManager::isProgressBarCanceled() |
793 | { | 793 | { |
794 | return !bar->isVisible(); | 794 | return !bar->isVisible(); |
795 | } | 795 | } |
796 | 796 | ||
797 | QString KSyncManager::syncFileName() | 797 | QString KSyncManager::syncFileName() |
798 | { | 798 | { |
799 | 799 | ||
800 | QString fn = "tempfile"; | 800 | QString fn = "tempfile"; |
801 | switch(mTargetApp) | 801 | switch(mTargetApp) |
802 | { | 802 | { |
803 | case (KAPI): | 803 | case (KAPI): |
804 | fn = "tempsyncab.vcf"; | 804 | fn = "tempsyncab.vcf"; |
805 | break; | 805 | break; |
806 | case (KOPI): | 806 | case (KOPI): |
807 | fn = "tempsynccal.ics"; | 807 | fn = "tempsynccal.ics"; |
808 | break; | 808 | break; |
809 | case (PWMPI): | 809 | case (PWMPI): |
810 | fn = "tempsyncpw.pwm"; | 810 | fn = "tempsyncpw.pwm"; |
811 | break; | 811 | break; |
812 | default: | 812 | default: |
813 | break; | 813 | break; |
814 | } | 814 | } |
815 | #ifdef _WIN32_ | 815 | #ifdef _WIN32_ |
816 | return locateLocal( "tmp", fn ); | 816 | return locateLocal( "tmp", fn ); |
817 | #else | 817 | #else |
818 | return (QString( "/tmp/" )+ fn ); | 818 | return (QString( "/tmp/" )+ fn ); |
819 | #endif | 819 | #endif |
820 | } | 820 | } |
821 | 821 | ||
822 | void KSyncManager::syncPi() | 822 | void KSyncManager::syncPi() |
823 | { | 823 | { |
824 | qApp->processEvents(); | 824 | qApp->processEvents(); |
825 | if ( mAskForPreferences ) | 825 | if ( mAskForPreferences ) |
826 | edit_pisync_options(); | 826 | edit_pisync_options(); |
827 | bool ok; | 827 | bool ok; |
828 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); | 828 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); |
829 | if ( ! ok ) { | 829 | if ( ! ok ) { |
830 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 830 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
831 | return; | 831 | return; |
832 | } | 832 | } |
833 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); | 833 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); |
834 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 834 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
835 | mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); | 835 | mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); |
836 | commandSocket->readFile( syncFileName() ); | 836 | commandSocket->readFile( syncFileName() ); |
837 | } | 837 | } |
838 | 838 | ||
839 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | 839 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) |
840 | { | 840 | { |
841 | qDebug("MainWindow::deleteCommandSocket %d", state); | ||
842 | |||
843 | //enum { success, errorW, errorR, quiet }; | 841 | //enum { success, errorW, errorR, quiet }; |
844 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { | 842 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { |
845 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); | 843 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); |
846 | delete s; | 844 | delete s; |
847 | if ( state == KCommandSocket::errorR ) { | 845 | if ( state == KCommandSocket::errorR ) { |
848 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 846 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); |
849 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 847 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
850 | commandSocket->sendStop(); | 848 | commandSocket->sendStop(); |
851 | } | 849 | } |
852 | return; | 850 | return; |
853 | 851 | ||
854 | } else if ( state == KCommandSocket::errorW ) { | 852 | } else if ( state == KCommandSocket::errorW ) { |
855 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); | 853 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); |
856 | 854 | ||
857 | } else if ( state == KCommandSocket::successR ) { | 855 | } else if ( state == KCommandSocket::successR ) { |
858 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); | 856 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); |
859 | 857 | ||
860 | } else if ( state == KCommandSocket::successW ) { | 858 | } else if ( state == KCommandSocket::successW ) { |
861 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 859 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
862 | } | 860 | } |
863 | 861 | ||
864 | delete s; | 862 | delete s; |
865 | } | 863 | } |
866 | 864 | ||
867 | void KSyncManager::readFileFromSocket() | 865 | void KSyncManager::readFileFromSocket() |
868 | { | 866 | { |
869 | QString fileName = syncFileName(); | 867 | QString fileName = syncFileName(); |
870 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); | 868 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); |
871 | if ( ! syncWithFile( fileName , true ) ) { | 869 | if ( ! syncWithFile( fileName , true ) ) { |
872 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); | 870 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); |
873 | qDebug("Syncing failed "); | ||
874 | return; | 871 | return; |
875 | } | 872 | } |
876 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 873 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); |
877 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 874 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
878 | if ( mWriteBackFile ) | 875 | if ( mWriteBackFile ) |
879 | commandSocket->writeFile( fileName ); | 876 | commandSocket->writeFile( fileName ); |
880 | else { | 877 | else { |
881 | commandSocket->sendStop(); | 878 | commandSocket->sendStop(); |
882 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 879 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
883 | } | 880 | } |
884 | } | 881 | } |
885 | 882 | ||
886 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 883 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) |
887 | { | 884 | { |
888 | mPassWord = pw; | 885 | mPassWord = pw; |
889 | mSocket = 0; | 886 | mSocket = 0; |
890 | mSyncActionDialog = 0; | 887 | mSyncActionDialog = 0; |
891 | blockRC = false; | 888 | blockRC = false; |
892 | }; | 889 | }; |
893 | 890 | ||
894 | void KServerSocket::newConnection ( int socket ) | 891 | void KServerSocket::newConnection ( int socket ) |
895 | { | 892 | { |
896 | // qDebug("KServerSocket:New connection %d ", socket); | 893 | // qDebug("KServerSocket:New connection %d ", socket); |
897 | if ( mSocket ) { | 894 | if ( mSocket ) { |
898 | qDebug("KServerSocket::newConnection Socket deleted! "); | 895 | qDebug("KServerSocket::newConnection Socket deleted! "); |
899 | delete mSocket; | 896 | delete mSocket; |
900 | mSocket = 0; | 897 | mSocket = 0; |
901 | } | 898 | } |
902 | mSocket = new QSocket( this ); | 899 | mSocket = new QSocket( this ); |
903 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 900 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
904 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 901 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
905 | mSocket->setSocket( socket ); | 902 | mSocket->setSocket( socket ); |
906 | } | 903 | } |
907 | 904 | ||
908 | void KServerSocket::discardClient() | 905 | void KServerSocket::discardClient() |
909 | { | 906 | { |
910 | //qDebug(" KServerSocket::discardClient()"); | 907 | //qDebug(" KServerSocket::discardClient()"); |
911 | if ( mSocket ) { | 908 | if ( mSocket ) { |
912 | delete mSocket; | 909 | delete mSocket; |
913 | mSocket = 0; | 910 | mSocket = 0; |
914 | } | 911 | } |
915 | //emit endConnect(); | 912 | //emit endConnect(); |
916 | } | 913 | } |
917 | void KServerSocket::readClient() | 914 | void KServerSocket::readClient() |
918 | { | 915 | { |
919 | if ( blockRC ) | 916 | if ( blockRC ) |
920 | return; | 917 | return; |
921 | if ( mSocket == 0 ) { | 918 | if ( mSocket == 0 ) { |
922 | qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); | 919 | qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); |
923 | return; | 920 | return; |
924 | } | 921 | } |
925 | qDebug("KServerSocket readClient()"); | 922 | //qDebug("KServerSocket::readClient()"); |
926 | if ( mSocket->canReadLine() ) { | 923 | if ( mSocket->canReadLine() ) { |
927 | QString line = mSocket->readLine(); | 924 | QString line = mSocket->readLine(); |
928 | qDebug("KServerSocket readline: %s ", line.latin1()); | 925 | //qDebug("KServerSocket readline: %s ", line.latin1()); |
929 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); | 926 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); |
930 | if ( tokens[0] == "GET" ) { | 927 | if ( tokens[0] == "GET" ) { |
931 | if ( tokens[1] == mPassWord ) | 928 | if ( tokens[1] == mPassWord ) |
932 | //emit sendFile( mSocket ); | 929 | //emit sendFile( mSocket ); |
933 | send_file(); | 930 | send_file(); |
934 | else { | 931 | else { |
935 | KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); | 932 | KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); |
936 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); | 933 | //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); |
937 | } | 934 | } |
938 | } | 935 | } |
939 | if ( tokens[0] == "PUT" ) { | 936 | if ( tokens[0] == "PUT" ) { |
940 | if ( tokens[1] == mPassWord ) { | 937 | if ( tokens[1] == mPassWord ) { |
941 | //emit getFile( mSocket ); | 938 | //emit getFile( mSocket ); |
942 | blockRC = true; | 939 | blockRC = true; |
943 | get_file(); | 940 | get_file(); |
944 | } | 941 | } |
945 | else { | 942 | else { |
946 | KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password")); | 943 | KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password")); |
947 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); | 944 | //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); |
948 | } | 945 | } |
949 | } | 946 | } |
950 | if ( tokens[0] == "STOP" ) { | 947 | if ( tokens[0] == "STOP" ) { |
951 | //emit endConnect(); | 948 | //emit endConnect(); |
952 | end_connect(); | 949 | end_connect(); |
953 | } | 950 | } |
954 | } | 951 | } |
955 | } | 952 | } |
956 | void KServerSocket::end_connect() | 953 | void KServerSocket::end_connect() |
957 | { | 954 | { |
958 | delete mSyncActionDialog; | 955 | delete mSyncActionDialog; |
959 | mSyncActionDialog = 0; | 956 | mSyncActionDialog = 0; |
960 | } | 957 | } |
961 | void KServerSocket::send_file() | 958 | void KServerSocket::send_file() |
962 | { | 959 | { |
963 | //qDebug("MainWindow::sendFile(QSocket* s) "); | 960 | //qDebug("MainWindow::sendFile(QSocket* s) "); |
964 | if ( mSyncActionDialog ) | 961 | if ( mSyncActionDialog ) |
965 | delete mSyncActionDialog; | 962 | delete mSyncActionDialog; |
966 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); | 963 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); |
967 | mSyncActionDialog->setCaption(i18n("Received sync request")); | 964 | mSyncActionDialog->setCaption(i18n("Received sync request")); |
968 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); | 965 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); |
969 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); | 966 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); |
970 | lay->addWidget( label); | 967 | lay->addWidget( label); |
971 | lay->setMargin(7); | 968 | lay->setMargin(7); |
972 | lay->setSpacing(7); | 969 | lay->setSpacing(7); |
973 | mSyncActionDialog->setFixedSize( 230, 120); | 970 | mSyncActionDialog->setFixedSize( 230, 120); |
974 | mSyncActionDialog->show(); | 971 | mSyncActionDialog->show(); |
975 | mSyncActionDialog->raise(); | 972 | mSyncActionDialog->raise(); |
976 | qDebug("KSS::saving ... "); | ||
977 | emit request_file(); | 973 | emit request_file(); |
978 | qApp->processEvents(); | 974 | qApp->processEvents(); |
979 | QString fileName = mFileName; | 975 | QString fileName = mFileName; |
980 | QFile file( fileName ); | 976 | QFile file( fileName ); |
981 | if (!file.open( IO_ReadOnly ) ) { | 977 | if (!file.open( IO_ReadOnly ) ) { |
982 | delete mSyncActionDialog; | 978 | delete mSyncActionDialog; |
983 | mSyncActionDialog = 0; | 979 | mSyncActionDialog = 0; |
984 | qDebug("KSS::error open file "); | 980 | qDebug("KSS::error open file "); |
985 | mSocket->close(); | 981 | mSocket->close(); |
986 | if ( mSocket->state() == QSocket::Idle ) | 982 | if ( mSocket->state() == QSocket::Idle ) |
987 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 983 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
988 | return ; | 984 | return ; |
989 | 985 | ||
990 | } | 986 | } |
991 | mSyncActionDialog->setCaption( i18n("Sending file...") ); | 987 | mSyncActionDialog->setCaption( i18n("Sending file...") ); |
992 | QTextStream ts( &file ); | 988 | QTextStream ts( &file ); |
993 | ts.setEncoding( QTextStream::Latin1 ); | 989 | ts.setEncoding( QTextStream::Latin1 ); |
994 | 990 | ||
995 | QTextStream os( mSocket ); | 991 | QTextStream os( mSocket ); |
996 | os.setEncoding( QTextStream::Latin1 ); | 992 | os.setEncoding( QTextStream::Latin1 ); |
997 | while ( ! ts.atEnd() ) { | 993 | while ( ! ts.atEnd() ) { |
998 | os << ts.readLine() << "\n"; | 994 | os << ts.readLine() << "\n"; |
999 | } | 995 | } |
1000 | //os << ts.read(); | 996 | //os << ts.read(); |
1001 | file.close(); | 997 | file.close(); |
1002 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); | 998 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); |
1003 | mSocket->close(); | 999 | mSocket->close(); |
1004 | if ( mSocket->state() == QSocket::Idle ) | 1000 | if ( mSocket->state() == QSocket::Idle ) |
1005 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 1001 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
1006 | } | 1002 | } |
1007 | void KServerSocket::get_file() | 1003 | void KServerSocket::get_file() |
1008 | { | 1004 | { |
1009 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); | 1005 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); |
1010 | 1006 | ||
1011 | piTime.start(); | 1007 | piTime.start(); |
1012 | piFileString = ""; | 1008 | piFileString = ""; |
1013 | QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); | 1009 | QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); |
1014 | } | 1010 | } |
1015 | 1011 | ||
1016 | 1012 | ||
1017 | void KServerSocket::readBackFileFromSocket() | 1013 | void KServerSocket::readBackFileFromSocket() |
1018 | { | 1014 | { |
1019 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); | 1015 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); |
1020 | while ( mSocket->canReadLine () ) { | 1016 | while ( mSocket->canReadLine () ) { |
1021 | piTime.restart(); | 1017 | piTime.restart(); |
1022 | QString line = mSocket->readLine (); | 1018 | QString line = mSocket->readLine (); |
1023 | piFileString += line; | 1019 | piFileString += line; |
1024 | //qDebug("readline: %s ", line.latin1()); | 1020 | //qDebug("readline: %s ", line.latin1()); |
1025 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); | 1021 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); |
1026 | 1022 | ||
1027 | } | 1023 | } |
1028 | if ( piTime.elapsed () < 3000 ) { | 1024 | if ( piTime.elapsed () < 3000 ) { |
1029 | // wait for more | 1025 | // wait for more |
1030 | //qDebug("waitformore "); | 1026 | //qDebug("waitformore "); |
1031 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); | 1027 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); |
1032 | return; | 1028 | return; |
1033 | } | 1029 | } |
1034 | QString fileName = mFileName; | 1030 | QString fileName = mFileName; |
1035 | QFile file ( fileName ); | 1031 | QFile file ( fileName ); |
1036 | if (!file.open( IO_WriteOnly ) ) { | 1032 | if (!file.open( IO_WriteOnly ) ) { |
1037 | delete mSyncActionDialog; | 1033 | delete mSyncActionDialog; |
1038 | mSyncActionDialog = 0; | 1034 | mSyncActionDialog = 0; |
1039 | qDebug("error open cal file "); | 1035 | qDebug("KSS:Error open read back file "); |
1040 | piFileString = ""; | 1036 | piFileString = ""; |
1041 | emit file_received( false ); | 1037 | emit file_received( false ); |
1042 | blockRC = false; | 1038 | blockRC = false; |
1043 | return ; | 1039 | return ; |
1044 | 1040 | ||
1045 | } | 1041 | } |
1046 | 1042 | ||
1047 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 1043 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
1048 | QTextStream ts ( &file ); | 1044 | QTextStream ts ( &file ); |
1049 | ts.setEncoding( QTextStream::Latin1 ); | 1045 | ts.setEncoding( QTextStream::Latin1 ); |
1050 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); | 1046 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); |
1051 | ts << piFileString; | 1047 | ts << piFileString; |
1052 | mSocket->close(); | 1048 | mSocket->close(); |
1053 | if ( mSocket->state() == QSocket::Idle ) | 1049 | if ( mSocket->state() == QSocket::Idle ) |
1054 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 1050 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
1055 | file.close(); | 1051 | file.close(); |
1056 | delete mSyncActionDialog; | 1052 | delete mSyncActionDialog; |
1057 | mSyncActionDialog = 0; | 1053 | mSyncActionDialog = 0; |
1058 | piFileString = ""; | 1054 | piFileString = ""; |
1059 | blockRC = false; | 1055 | blockRC = false; |
1060 | emit file_received( true ); | 1056 | emit file_received( true ); |
1061 | 1057 | ||
1062 | } | 1058 | } |
1063 | 1059 | ||
1064 | KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name ) | 1060 | KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name ) |
1065 | { | 1061 | { |
1066 | mPassWord = password; | 1062 | mPassWord = password; |
1067 | mSocket = 0; | 1063 | mSocket = 0; |
1068 | mPort = port; | 1064 | mPort = port; |
1069 | mHost = host; | 1065 | mHost = host; |
1070 | 1066 | ||
1071 | mRetVal = quiet; | 1067 | mRetVal = quiet; |
1072 | mTimerSocket = new QTimer ( this ); | 1068 | mTimerSocket = new QTimer ( this ); |
1073 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); | 1069 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); |
1074 | } | 1070 | } |
1075 | void KCommandSocket::readFile( QString fn ) | 1071 | void KCommandSocket::readFile( QString fn ) |
1076 | { | 1072 | { |
1077 | if ( !mSocket ) { | 1073 | if ( !mSocket ) { |
1078 | mSocket = new QSocket( this ); | 1074 | mSocket = new QSocket( this ); |
1079 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); | 1075 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); |
1080 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1076 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1081 | } | 1077 | } |
1082 | mFileString = ""; | 1078 | mFileString = ""; |
1083 | mFileName = fn; | 1079 | mFileName = fn; |
1084 | mFirst = true; | 1080 | mFirst = true; |
1085 | mSocket->connectToHost( mHost, mPort ); | 1081 | mSocket->connectToHost( mHost, mPort ); |
1086 | QTextStream os( mSocket ); | 1082 | QTextStream os( mSocket ); |
1087 | os.setEncoding( QTextStream::Latin1 ); | 1083 | os.setEncoding( QTextStream::Latin1 ); |
@@ -1124,91 +1120,91 @@ void KCommandSocket::writeFileToSocket() | |||
1124 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1120 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1125 | } | 1121 | } |
1126 | void KCommandSocket::sendStop() | 1122 | void KCommandSocket::sendStop() |
1127 | { | 1123 | { |
1128 | if ( !mSocket ) { | 1124 | if ( !mSocket ) { |
1129 | mSocket = new QSocket( this ); | 1125 | mSocket = new QSocket( this ); |
1130 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1126 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1131 | } | 1127 | } |
1132 | mSocket->connectToHost( mHost, mPort ); | 1128 | mSocket->connectToHost( mHost, mPort ); |
1133 | QTextStream os2( mSocket ); | 1129 | QTextStream os2( mSocket ); |
1134 | os2.setEncoding( QTextStream::Latin1 ); | 1130 | os2.setEncoding( QTextStream::Latin1 ); |
1135 | os2 << "STOP\r\n"; | 1131 | os2 << "STOP\r\n"; |
1136 | mSocket->close(); | 1132 | mSocket->close(); |
1137 | if ( mSocket->state() == QSocket::Idle ) | 1133 | if ( mSocket->state() == QSocket::Idle ) |
1138 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1134 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1139 | } | 1135 | } |
1140 | 1136 | ||
1141 | void KCommandSocket::startReadFileFromSocket() | 1137 | void KCommandSocket::startReadFileFromSocket() |
1142 | { | 1138 | { |
1143 | if ( ! mFirst ) | 1139 | if ( ! mFirst ) |
1144 | return; | 1140 | return; |
1145 | mFirst = false; | 1141 | mFirst = false; |
1146 | mTimerSocket->stop(); | 1142 | mTimerSocket->stop(); |
1147 | mFileString = ""; | 1143 | mFileString = ""; |
1148 | mTime.start(); | 1144 | mTime.start(); |
1149 | QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) )); | 1145 | QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) )); |
1150 | 1146 | ||
1151 | } | 1147 | } |
1152 | void KCommandSocket::readFileFromSocket() | 1148 | void KCommandSocket::readFileFromSocket() |
1153 | { | 1149 | { |
1154 | //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); | 1150 | //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); |
1155 | while ( mSocket->canReadLine () ) { | 1151 | while ( mSocket->canReadLine () ) { |
1156 | mTime.restart(); | 1152 | mTime.restart(); |
1157 | QString line = mSocket->readLine (); | 1153 | QString line = mSocket->readLine (); |
1158 | mFileString += line; | 1154 | mFileString += line; |
1159 | //qDebug("readline: %s ", line.latin1()); | 1155 | //qDebug("readline: %s ", line.latin1()); |
1160 | } | 1156 | } |
1161 | if ( mTime.elapsed () < 3000 ) { | 1157 | if ( mTime.elapsed () < 3000 ) { |
1162 | // wait for more | 1158 | // wait for more |
1163 | //qDebug("waitformore "); | 1159 | //qDebug("waitformore "); |
1164 | QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); | 1160 | QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); |
1165 | return; | 1161 | return; |
1166 | } | 1162 | } |
1167 | QString fileName = mFileName; | 1163 | QString fileName = mFileName; |
1168 | QFile file ( fileName ); | 1164 | QFile file ( fileName ); |
1169 | if (!file.open( IO_WriteOnly ) ) { | 1165 | if (!file.open( IO_WriteOnly ) ) { |
1170 | mFileString = ""; | 1166 | mFileString = ""; |
1171 | mRetVal = errorR; | 1167 | mRetVal = errorR; |
1172 | qDebug("Error open temp calender file for writing: %s",fileName.latin1() ); | 1168 | qDebug("KSS:Error open temp sync file for writing: %s",fileName.latin1() ); |
1173 | deleteSocket(); | 1169 | deleteSocket(); |
1174 | return ; | 1170 | return ; |
1175 | 1171 | ||
1176 | } | 1172 | } |
1177 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 1173 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
1178 | QTextStream ts ( &file ); | 1174 | QTextStream ts ( &file ); |
1179 | ts.setEncoding( QTextStream::Latin1 ); | 1175 | ts.setEncoding( QTextStream::Latin1 ); |
1180 | ts << mFileString; | 1176 | ts << mFileString; |
1181 | file.close(); | 1177 | file.close(); |
1182 | mFileString = ""; | 1178 | mFileString = ""; |
1183 | mRetVal = successR; | 1179 | mRetVal = successR; |
1184 | mSocket->close(); | 1180 | mSocket->close(); |
1185 | // if state is not idle, deleteSocket(); is called via | 1181 | // if state is not idle, deleteSocket(); is called via |
1186 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1182 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1187 | if ( mSocket->state() == QSocket::Idle ) | 1183 | if ( mSocket->state() == QSocket::Idle ) |
1188 | deleteSocket(); | 1184 | deleteSocket(); |
1189 | } | 1185 | } |
1190 | 1186 | ||
1191 | void KCommandSocket::deleteSocket() | 1187 | void KCommandSocket::deleteSocket() |
1192 | { | 1188 | { |
1193 | //qDebug("KCommandSocket::deleteSocket() "); | 1189 | //qDebug("KCommandSocket::deleteSocket() "); |
1194 | if ( mTimerSocket->isActive () ) { | 1190 | if ( mTimerSocket->isActive () ) { |
1195 | mTimerSocket->stop(); | 1191 | mTimerSocket->stop(); |
1196 | mRetVal = errorTO; | 1192 | mRetVal = errorTO; |
1197 | qDebug("Connection to remote host timed out"); | 1193 | qDebug("Connection to remote host timed out"); |
1198 | if ( mSocket ) { | 1194 | if ( mSocket ) { |
1199 | mSocket->close(); | 1195 | mSocket->close(); |
1200 | //if ( mSocket->state() == QSocket::Idle ) | 1196 | //if ( mSocket->state() == QSocket::Idle ) |
1201 | // deleteSocket(); | 1197 | // deleteSocket(); |
1202 | delete mSocket; | 1198 | delete mSocket; |
1203 | mSocket = 0; | 1199 | mSocket = 0; |
1204 | } | 1200 | } |
1205 | KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host? ")); | 1201 | KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host? ")); |
1206 | emit commandFinished( this, mRetVal ); | 1202 | emit commandFinished( this, mRetVal ); |
1207 | return; | 1203 | return; |
1208 | } | 1204 | } |
1209 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); | 1205 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); |
1210 | if ( mSocket) | 1206 | if ( mSocket) |
1211 | delete mSocket; | 1207 | delete mSocket; |
1212 | mSocket = 0; | 1208 | mSocket = 0; |
1213 | emit commandFinished( this, mRetVal ); | 1209 | emit commandFinished( this, mRetVal ); |
1214 | } | 1210 | } |
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp index ba41f6c..5b685d3 100644 --- a/microkde/kconfig.cpp +++ b/microkde/kconfig.cpp | |||
@@ -224,98 +224,98 @@ void KConfig::writeEntry( const QString &key, const QStringList &value ) | |||
224 | 224 | ||
225 | mDirty = true; | 225 | mDirty = true; |
226 | } | 226 | } |
227 | 227 | ||
228 | void KConfig::writeEntry( const QString &key, bool value) | 228 | void KConfig::writeEntry( const QString &key, bool value) |
229 | { | 229 | { |
230 | mBoolMap.insert( mGroup + key, value ); | 230 | mBoolMap.insert( mGroup + key, value ); |
231 | 231 | ||
232 | mDirty = true; | 232 | mDirty = true; |
233 | } | 233 | } |
234 | 234 | ||
235 | void KConfig::writeEntry( const QString & e, const QColor & c ) | 235 | void KConfig::writeEntry( const QString & e, const QColor & c ) |
236 | { | 236 | { |
237 | QStringList l; | 237 | QStringList l; |
238 | l.append( QString::number ( c.red() ) ); | 238 | l.append( QString::number ( c.red() ) ); |
239 | l.append( QString::number ( c.green() ) ); | 239 | l.append( QString::number ( c.green() ) ); |
240 | l.append( QString::number ( c.blue() ) ); | 240 | l.append( QString::number ( c.blue() ) ); |
241 | writeEntry( e, l ); | 241 | writeEntry( e, l ); |
242 | } | 242 | } |
243 | 243 | ||
244 | void KConfig::writeEntry( const QString & e, const QSize & s ) | 244 | void KConfig::writeEntry( const QString & e, const QSize & s ) |
245 | { | 245 | { |
246 | QValueList<int> intlist; | 246 | QValueList<int> intlist; |
247 | intlist << s.width() << s.height(); | 247 | intlist << s.width() << s.height(); |
248 | writeEntry( e, intlist ); | 248 | writeEntry( e, intlist ); |
249 | } | 249 | } |
250 | 250 | ||
251 | void KConfig::writeEntry( const QString & e , const QFont & f ) | 251 | void KConfig::writeEntry( const QString & e , const QFont & f ) |
252 | { | 252 | { |
253 | QStringList font; | 253 | QStringList font; |
254 | font.append( f.family()); | 254 | font.append( f.family()); |
255 | font.append( (!f.bold ()?"nonbold":"bold") ); | 255 | font.append( (!f.bold ()?"nonbold":"bold") ); |
256 | font.append( QString::number ( f.pointSize () ) ); | 256 | font.append( QString::number ( f.pointSize () ) ); |
257 | font.append( !f.italic ()?"nonitalic":"italic" ); | 257 | font.append( !f.italic ()?"nonitalic":"italic" ); |
258 | writeEntry( e, font ); | 258 | writeEntry( e, font ); |
259 | } | 259 | } |
260 | 260 | ||
261 | void KConfig::writeEntry( const QString &key, const QDateTime &dt ) | 261 | void KConfig::writeEntry( const QString &key, const QDateTime &dt ) |
262 | { | 262 | { |
263 | mDateTimeMap.insert( mGroup + key, dt ); | 263 | mDateTimeMap.insert( mGroup + key, dt ); |
264 | } | 264 | } |
265 | 265 | ||
266 | void KConfig::load() | 266 | void KConfig::load() |
267 | { | 267 | { |
268 | 268 | ||
269 | 269 | ||
270 | QFile f( mFileName ); | 270 | QFile f( mFileName ); |
271 | if ( !f.open( IO_ReadOnly ) ) { | 271 | if ( !f.open( IO_ReadOnly ) ) { |
272 | qDebug("KConfig: could not open file %s ",mFileName.latin1() ); | 272 | //qDebug("KConfig: could not open file %s ",mFileName.latin1() ); |
273 | return; | 273 | return; |
274 | } | 274 | } |
275 | 275 | ||
276 | mBoolMap.clear(); | 276 | mBoolMap.clear(); |
277 | mStringMap.clear(); | 277 | mStringMap.clear(); |
278 | 278 | ||
279 | QTextStream t( &f ); | 279 | QTextStream t( &f ); |
280 | 280 | ||
281 | QString line = t.readLine(); | 281 | QString line = t.readLine(); |
282 | 282 | ||
283 | while ( !line.isNull() ) { | 283 | while ( !line.isNull() ) { |
284 | QStringList tokens = QStringList::split( ",", line ); | 284 | QStringList tokens = QStringList::split( ",", line ); |
285 | if ( tokens[0] == "bool" ) { | 285 | if ( tokens[0] == "bool" ) { |
286 | bool value = false; | 286 | bool value = false; |
287 | if ( tokens[2] == "1" ) value = true; | 287 | if ( tokens[2] == "1" ) value = true; |
288 | mBoolMap.insert( tokens[1], value ); | 288 | mBoolMap.insert( tokens[1], value ); |
289 | } else if ( tokens[0] == "QString" ) { | 289 | } else if ( tokens[0] == "QString" ) { |
290 | QString value = tokens[2]; | 290 | QString value = tokens[2]; |
291 | mStringMap.insert( tokens[1], value ); | 291 | mStringMap.insert( tokens[1], value ); |
292 | } else if ( tokens[0] == "QDateTime" ) { | 292 | } else if ( tokens[0] == "QDateTime" ) { |
293 | #if 0 | 293 | #if 0 |
294 | int year = tokens[2].toInt(); | 294 | int year = tokens[2].toInt(); |
295 | QDateTime dt( QDate( year, | 295 | QDateTime dt( QDate( year, |
296 | tokens[3].toInt(), | 296 | tokens[3].toInt(), |
297 | tokens[4].toInt() ), | 297 | tokens[4].toInt() ), |
298 | QTime( tokens[5].toInt(), tokens[6].toInt(), | 298 | QTime( tokens[5].toInt(), tokens[6].toInt(), |
299 | tokens[7].toInt() ) ); | 299 | tokens[7].toInt() ) ); |
300 | mDateTimeMap.insert( tokens[1], dt ); | 300 | mDateTimeMap.insert( tokens[1], dt ); |
301 | #endif | 301 | #endif |
302 | } | 302 | } |
303 | 303 | ||
304 | line = t.readLine(); | 304 | line = t.readLine(); |
305 | } | 305 | } |
306 | } | 306 | } |
307 | 307 | ||
308 | void KConfig::sync() | 308 | void KConfig::sync() |
309 | { | 309 | { |
310 | 310 | ||
311 | if ( !mDirty ) return; | 311 | if ( !mDirty ) return; |
312 | //qDebug("KConfig::sync() %s ",mFileName.latin1() ); | 312 | //qDebug("KConfig::sync() %s ",mFileName.latin1() ); |
313 | //kdDebug() << "KConfig::sync(): " << mFileName << endl; | 313 | //kdDebug() << "KConfig::sync(): " << mFileName << endl; |
314 | 314 | ||
315 | //US I took the following code from a newer version of KDE | 315 | //US I took the following code from a newer version of KDE |
316 | // Create the containing dir if needed | 316 | // Create the containing dir if needed |
317 | KURL path; | 317 | KURL path; |
318 | path.setPath(mFileName); | 318 | path.setPath(mFileName); |
319 | QString dir=path.directory(); | 319 | QString dir=path.directory(); |
320 | KStandardDirs::makeDir(dir); | 320 | KStandardDirs::makeDir(dir); |
321 | 321 | ||
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp index 1c3e0ae..4c03c15 100644 --- a/microkde/kdecore/kstandarddirs.cpp +++ b/microkde/kdecore/kstandarddirs.cpp | |||
@@ -1511,97 +1511,97 @@ QString KStandardDirs::localkdedir() const | |||
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | QString KStandardDirs::localxdgdatadir() const | 1513 | QString KStandardDirs::localxdgdatadir() const |
1514 | { | 1514 | { |
1515 | // Return the prefix to use for saving | 1515 | // Return the prefix to use for saving |
1516 | return d->xdgdata_prefixes.first(); | 1516 | return d->xdgdata_prefixes.first(); |
1517 | } | 1517 | } |
1518 | 1518 | ||
1519 | QString KStandardDirs::localxdgconfdir() const | 1519 | QString KStandardDirs::localxdgconfdir() const |
1520 | { | 1520 | { |
1521 | // Return the prefix to use for saving | 1521 | // Return the prefix to use for saving |
1522 | return d->xdgconf_prefixes.first(); | 1522 | return d->xdgconf_prefixes.first(); |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | void KStandardDirs::setAppDir( const QString &appDir ) | 1525 | void KStandardDirs::setAppDir( const QString &appDir ) |
1526 | { | 1526 | { |
1527 | mAppDir = appDir; | 1527 | mAppDir = appDir; |
1528 | 1528 | ||
1529 | if ( mAppDir.right( 1 ) != "/" ) | 1529 | if ( mAppDir.right( 1 ) != "/" ) |
1530 | mAppDir += "/"; | 1530 | mAppDir += "/"; |
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | QString KStandardDirs::appDir() | 1533 | QString KStandardDirs::appDir() |
1534 | { | 1534 | { |
1535 | return mAppDir; | 1535 | return mAppDir; |
1536 | } | 1536 | } |
1537 | 1537 | ||
1538 | // just to make code more readable without macros | 1538 | // just to make code more readable without macros |
1539 | QString locate( const char *type, | 1539 | QString locate( const char *type, |
1540 | const QString& filename/*US , const KInstance* inst*/ ) | 1540 | const QString& filename/*US , const KInstance* inst*/ ) |
1541 | { | 1541 | { |
1542 | //US return inst->dirs()->findResource(type, filename); | 1542 | //US return inst->dirs()->findResource(type, filename); |
1543 | return KGlobal::dirs()->findResource(type, filename); | 1543 | return KGlobal::dirs()->findResource(type, filename); |
1544 | } | 1544 | } |
1545 | 1545 | ||
1546 | QString locateLocal( const char *type, | 1546 | QString locateLocal( const char *type, |
1547 | const QString& filename/*US , const KInstance* inst*/ ) | 1547 | const QString& filename/*US , const KInstance* inst*/ ) |
1548 | { | 1548 | { |
1549 | 1549 | ||
1550 | QString path = locateLocal(type, filename, true /*US, inst*/); | 1550 | QString path = locateLocal(type, filename, true /*US, inst*/); |
1551 | 1551 | ||
1552 | 1552 | ||
1553 | /* | 1553 | /* |
1554 | static int ccc = 0; | 1554 | static int ccc = 0; |
1555 | ++ccc; | 1555 | ++ccc; |
1556 | if ( ccc > 13 ) | 1556 | if ( ccc > 13 ) |
1557 | abort(); | 1557 | abort(); |
1558 | */ | 1558 | */ |
1559 | qDebug("locatelocal: %s" , path.latin1()); | 1559 | //qDebug("locatelocal: %s" , path.latin1()); |
1560 | return path; | 1560 | return path; |
1561 | 1561 | ||
1562 | /*US why do we put all files into one directory. It is quit complicated. | 1562 | /*US why do we put all files into one directory. It is quit complicated. |
1563 | why not staying with the original directorystructure ? | 1563 | why not staying with the original directorystructure ? |
1564 | 1564 | ||
1565 | 1565 | ||
1566 | QString escapedFilename = filename; | 1566 | QString escapedFilename = filename; |
1567 | escapedFilename.replace( QRegExp( "/" ), "_" ); | 1567 | escapedFilename.replace( QRegExp( "/" ), "_" ); |
1568 | 1568 | ||
1569 | QString path = KStandardDirs::appDir() + type + "_" + escapedFilename; | 1569 | QString path = KStandardDirs::appDir() + type + "_" + escapedFilename; |
1570 | 1570 | ||
1571 | kdDebug() << "locate: '" << path << "'" << endl; | 1571 | kdDebug() << "locate: '" << path << "'" << endl; |
1572 | qDebug("locate: %s" , path.latin1()); | 1572 | qDebug("locate: %s" , path.latin1()); |
1573 | return path; | 1573 | return path; |
1574 | */ | 1574 | */ |
1575 | //US so my proposal is this: | 1575 | //US so my proposal is this: |
1576 | 1576 | ||
1577 | // QString escapedFilename = filename; | 1577 | // QString escapedFilename = filename; |
1578 | // escapedFilename.replace( QRegExp( "/" ), "_" ); | 1578 | // escapedFilename.replace( QRegExp( "/" ), "_" ); |
1579 | 1579 | ||
1580 | #if 0 | 1580 | #if 0 |
1581 | #ifdef _WIN32_ | 1581 | #ifdef _WIN32_ |
1582 | QString path = QDir::convertSeparators(KStandardDirs::appDir() + type + "/" + filename); | 1582 | QString path = QDir::convertSeparators(KStandardDirs::appDir() + type + "/" + filename); |
1583 | #else | 1583 | #else |
1584 | QString path = KStandardDirs::appDir() + type + "/" + filename; | 1584 | QString path = KStandardDirs::appDir() + type + "/" + filename; |
1585 | #endif | 1585 | #endif |
1586 | 1586 | ||
1587 | //US Create the containing dir if needed | 1587 | //US Create the containing dir if needed |
1588 | QFileInfo fi ( path ); | 1588 | QFileInfo fi ( path ); |
1589 | 1589 | ||
1590 | // QString dir=pathurl.directory(); | 1590 | // QString dir=pathurl.directory(); |
1591 | //QMessageBox::information( 0,"path", path, 1 ); | 1591 | //QMessageBox::information( 0,"path", path, 1 ); |
1592 | 1592 | ||
1593 | #ifdef _WIN32_ | 1593 | #ifdef _WIN32_ |
1594 | KStandardDirs::makeDir(path); | 1594 | KStandardDirs::makeDir(path); |
1595 | #else | 1595 | #else |
1596 | KStandardDirs::makeDir(fi.dirPath( true )); | 1596 | KStandardDirs::makeDir(fi.dirPath( true )); |
1597 | #endif | 1597 | #endif |
1598 | 1598 | ||
1599 | qDebug("locate22: %s" , path.latin1()); | 1599 | qDebug("locate22: %s" , path.latin1()); |
1600 | return path; | 1600 | return path; |
1601 | 1601 | ||
1602 | #endif | 1602 | #endif |
1603 | 1603 | ||
1604 | } | 1604 | } |
1605 | 1605 | ||
1606 | QString locateLocal( const char *type, | 1606 | QString locateLocal( const char *type, |
1607 | const QString& filename, bool createDir/*US , const KInstance* inst*/ ) | 1607 | const QString& filename, bool createDir/*US , const KInstance* inst*/ ) |
diff --git a/microkde/kdeui/kactioncollection.cpp b/microkde/kdeui/kactioncollection.cpp index b819e76..69e5d02 100644 --- a/microkde/kdeui/kactioncollection.cpp +++ b/microkde/kdeui/kactioncollection.cpp | |||
@@ -108,101 +108,102 @@ KActionCollection::KActionCollection( QWidget *watch, QObject* parent, const cha | |||
108 | KActionCollection::KActionCollection( QObject *parent, const char *name /*US, | 108 | KActionCollection::KActionCollection( QObject *parent, const char *name /*US, |
109 | KInstance *instance */) | 109 | KInstance *instance */) |
110 | : QObject( parent, name ) | 110 | : QObject( parent, name ) |
111 | { | 111 | { |
112 | kdWarning(129) << "KActionCollection::KActionCollection( QObject *parent, const char *name, KInstance *instance )" << endl; //ellis | 112 | kdWarning(129) << "KActionCollection::KActionCollection( QObject *parent, const char *name, KInstance *instance )" << endl; //ellis |
113 | //US kdBacktrace not available | 113 | //US kdBacktrace not available |
114 | //US kdDebug(129) << kdBacktrace() << endl; | 114 | //US kdDebug(129) << kdBacktrace() << endl; |
115 | d = new KActionCollectionPrivate; | 115 | d = new KActionCollectionPrivate; |
116 | //US QWidget* w = dynamic_cast<QWidget*>( parent ); | 116 | //US QWidget* w = dynamic_cast<QWidget*>( parent ); |
117 | QWidget* w = (QWidget*)( parent ); | 117 | QWidget* w = (QWidget*)( parent ); |
118 | if( w ) | 118 | if( w ) |
119 | setWidget( w ); | 119 | setWidget( w ); |
120 | //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); | 120 | //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); |
121 | //US setInstance( instance ); | 121 | //US setInstance( instance ); |
122 | } | 122 | } |
123 | 123 | ||
124 | KActionCollection::KActionCollection( const KActionCollection © ) | 124 | KActionCollection::KActionCollection( const KActionCollection © ) |
125 | : QObject() | 125 | : QObject() |
126 | { | 126 | { |
127 | kdWarning(129) << "KActionCollection::KActionCollection( const KActionCollection & ): function is severely deprecated." << endl; | 127 | kdWarning(129) << "KActionCollection::KActionCollection( const KActionCollection & ): function is severely deprecated." << endl; |
128 | d = new KActionCollectionPrivate; | 128 | d = new KActionCollectionPrivate; |
129 | *this = copy; | 129 | *this = copy; |
130 | } | 130 | } |
131 | // KDE 4: remove end | 131 | // KDE 4: remove end |
132 | 132 | ||
133 | KActionCollection::~KActionCollection() | 133 | KActionCollection::~KActionCollection() |
134 | { | 134 | { |
135 | kdDebug(129) << "KActionCollection::~KActionCollection(): this = " << this << endl; | 135 | kdDebug(129) << "KActionCollection::~KActionCollection(): this = " << this << endl; |
136 | for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { | 136 | for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { |
137 | KAction* pAction = it.current(); | 137 | KAction* pAction = it.current(); |
138 | if ( pAction->m_parentCollection == this ) | 138 | if ( pAction->m_parentCollection == this ) |
139 | pAction->m_parentCollection = 0L; | 139 | pAction->m_parentCollection = 0L; |
140 | } | 140 | } |
141 | 141 | ||
142 | //US delete d->m_kaccel; | 142 | //US delete d->m_kaccel; |
143 | //US delete d->m_builderKAccel; | 143 | //US delete d->m_builderKAccel; |
144 | delete d; d = 0; | 144 | delete d; d = 0; |
145 | } | 145 | } |
146 | 146 | ||
147 | void KActionCollection::setWidget( QWidget* w ) | 147 | void KActionCollection::setWidget( QWidget* w ) |
148 | { | 148 | { |
149 | //if ( d->m_actionDict.count() > 0 ) { | 149 | //if ( d->m_actionDict.count() > 0 ) { |
150 | // kdError(129) << "KActionCollection::setWidget(): must be called before any actions are added to collection!" << endl; | 150 | // kdError(129) << "KActionCollection::setWidget(): must be called before any actions are added to collection!" << endl; |
151 | // kdDebug(129) << kdBacktrace() << endl; | 151 | // kdDebug(129) << kdBacktrace() << endl; |
152 | //} | 152 | //} |
153 | //else | 153 | //else |
154 | if ( !d->m_widget ) { | 154 | if ( !d->m_widget ) { |
155 | d->m_widget = w; | 155 | d->m_widget = w; |
156 | qDebug("KActionCollection::setWidget: warning: KAccel is never used in microkde"); | 156 | //qDebug("KActionCollection::setWidget: warning: KAccel is never used in microkde"); |
157 | //US d->m_kaccel = new KAccel( w, this, "KActionCollection-KAccel" ); | 157 | //US d->m_kaccel = new KAccel( w, this, "KActionCollection-KAccel" ); |
158 | } | 158 | } |
159 | else if ( d->m_widget != w ) | 159 | else if ( d->m_widget != w ) |
160 | kdWarning(129) << "KActionCollection::setWidget(): tried to change widget from " << d->m_widget << " to " << w << endl; | 160 | ; |
161 | |||
161 | } | 162 | } |
162 | 163 | ||
163 | void KActionCollection::setAutoConnectShortcuts( bool b ) | 164 | void KActionCollection::setAutoConnectShortcuts( bool b ) |
164 | { | 165 | { |
165 | d->m_bAutoConnectShortcuts = b; | 166 | d->m_bAutoConnectShortcuts = b; |
166 | } | 167 | } |
167 | 168 | ||
168 | bool KActionCollection::isAutoConnectShortcuts() | 169 | bool KActionCollection::isAutoConnectShortcuts() |
169 | { | 170 | { |
170 | return d->m_bAutoConnectShortcuts; | 171 | return d->m_bAutoConnectShortcuts; |
171 | } | 172 | } |
172 | 173 | ||
173 | bool KActionCollection::addDocCollection( KActionCollection* pDoc ) | 174 | bool KActionCollection::addDocCollection( KActionCollection* pDoc ) |
174 | { | 175 | { |
175 | d->m_docList.append( pDoc ); | 176 | d->m_docList.append( pDoc ); |
176 | return true; | 177 | return true; |
177 | } | 178 | } |
178 | 179 | ||
179 | void KActionCollection::beginXMLPlug( QWidget *widget ) | 180 | void KActionCollection::beginXMLPlug( QWidget *widget ) |
180 | { | 181 | { |
181 | qDebug("KActionCollection::beginXMLPlug has to be fixed"); | 182 | qDebug("KActionCollection::beginXMLPlug has to be fixed"); |
182 | /*US | 183 | /*US |
183 | kdDebug(129) << "KActionCollection::beginXMLPlug( buildWidget = " << widget << " ): this = " << this << " d->m_builderKAccel = " << d->m_builderKAccel << endl; | 184 | kdDebug(129) << "KActionCollection::beginXMLPlug( buildWidget = " << widget << " ): this = " << this << " d->m_builderKAccel = " << d->m_builderKAccel << endl; |
184 | 185 | ||
185 | if( widget && !d->m_builderKAccel ) { | 186 | if( widget && !d->m_builderKAccel ) { |
186 | d->m_builderKAccel = new KAccel( widget, this, "KActionCollection-BuilderKAccel" ); | 187 | d->m_builderKAccel = new KAccel( widget, this, "KActionCollection-BuilderKAccel" ); |
187 | } | 188 | } |
188 | */ | 189 | */ |
189 | } | 190 | } |
190 | 191 | ||
191 | void KActionCollection::endXMLPlug() | 192 | void KActionCollection::endXMLPlug() |
192 | { | 193 | { |
193 | kdDebug(129) << "KActionCollection::endXMLPlug(): this = " << this << endl; | 194 | kdDebug(129) << "KActionCollection::endXMLPlug(): this = " << this << endl; |
194 | //s_kaccelXML = 0; | 195 | //s_kaccelXML = 0; |
195 | } | 196 | } |
196 | 197 | ||
197 | void KActionCollection::prepareXMLUnplug() | 198 | void KActionCollection::prepareXMLUnplug() |
198 | { | 199 | { |
199 | qDebug("KActionCollection::prepareXMLUnplug has to be fixed"); | 200 | qDebug("KActionCollection::prepareXMLUnplug has to be fixed"); |
200 | /*US | 201 | /*US |
201 | kdDebug(129) << "KActionCollection::prepareXMLUnplug(): this = " << this << endl; | 202 | kdDebug(129) << "KActionCollection::prepareXMLUnplug(): this = " << this << endl; |
202 | unplugShortcuts( d->m_kaccel ); | 203 | unplugShortcuts( d->m_kaccel ); |
203 | 204 | ||
204 | if( d->m_builderKAccel ) { | 205 | if( d->m_builderKAccel ) { |
205 | unplugShortcuts( d->m_builderKAccel ); | 206 | unplugShortcuts( d->m_builderKAccel ); |
206 | delete d->m_builderKAccel; | 207 | delete d->m_builderKAccel; |
207 | d->m_builderKAccel = 0; | 208 | d->m_builderKAccel = 0; |
208 | } | 209 | } |
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index b53a88a..2856f2d 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -470,97 +470,97 @@ KListView::~KListView() | |||
470 | delete d; | 470 | delete d; |
471 | } | 471 | } |
472 | 472 | ||
473 | bool KListView::isExecuteArea( const QPoint& point ) | 473 | bool KListView::isExecuteArea( const QPoint& point ) |
474 | { | 474 | { |
475 | if ( itemAt( point ) ) | 475 | if ( itemAt( point ) ) |
476 | return isExecuteArea( point.x() ); | 476 | return isExecuteArea( point.x() ); |
477 | 477 | ||
478 | return false; | 478 | return false; |
479 | } | 479 | } |
480 | 480 | ||
481 | bool KListView::isExecuteArea( int x ) | 481 | bool KListView::isExecuteArea( int x ) |
482 | { | 482 | { |
483 | if( allColumnsShowFocus() ) | 483 | if( allColumnsShowFocus() ) |
484 | return true; | 484 | return true; |
485 | else { | 485 | else { |
486 | int offset = 0; | 486 | int offset = 0; |
487 | int width = columnWidth( 0 ); | 487 | int width = columnWidth( 0 ); |
488 | int pos = header()->mapToIndex( 0 ); | 488 | int pos = header()->mapToIndex( 0 ); |
489 | 489 | ||
490 | for ( int index = 0; index < pos; index++ ) | 490 | for ( int index = 0; index < pos; index++ ) |
491 | offset += columnWidth( header()->mapToSection( index ) ); | 491 | offset += columnWidth( header()->mapToSection( index ) ); |
492 | 492 | ||
493 | x += contentsX(); // in case of a horizontal scrollbar | 493 | x += contentsX(); // in case of a horizontal scrollbar |
494 | return ( x > offset && x < ( offset + width ) ); | 494 | return ( x > offset && x < ( offset + width ) ); |
495 | } | 495 | } |
496 | } | 496 | } |
497 | 497 | ||
498 | void KListView::slotOnItem( QListViewItem *item ) | 498 | void KListView::slotOnItem( QListViewItem *item ) |
499 | { | 499 | { |
500 | QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); | 500 | QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); |
501 | if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { | 501 | if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { |
502 | d->autoSelect.start( d->autoSelectDelay, true ); | 502 | d->autoSelect.start( d->autoSelectDelay, true ); |
503 | d->pCurrentItem = item; | 503 | d->pCurrentItem = item; |
504 | } | 504 | } |
505 | } | 505 | } |
506 | 506 | ||
507 | void KListView::slotOnViewport() | 507 | void KListView::slotOnViewport() |
508 | { | 508 | { |
509 | if ( d->bChangeCursorOverItem ) | 509 | if ( d->bChangeCursorOverItem ) |
510 | viewport()->unsetCursor(); | 510 | viewport()->unsetCursor(); |
511 | 511 | ||
512 | d->autoSelect.stop(); | 512 | d->autoSelect.stop(); |
513 | d->pCurrentItem = 0L; | 513 | d->pCurrentItem = 0L; |
514 | } | 514 | } |
515 | 515 | ||
516 | void KListView::slotSettingsChanged(int category) | 516 | void KListView::slotSettingsChanged(int category) |
517 | { | 517 | { |
518 | qDebug("KListView::slotSettingsChanged has to be verified"); | 518 | //qDebug("KListView::slotSettingsChanged has to be verified"); |
519 | /*US | 519 | /*US |
520 | 520 | ||
521 | switch (category) | 521 | switch (category) |
522 | { | 522 | { |
523 | case KApplication::SETTINGS_MOUSE: | 523 | case KApplication::SETTINGS_MOUSE: |
524 | d->dragDelay = KGlobalSettings::dndEventDelay(); | 524 | d->dragDelay = KGlobalSettings::dndEventDelay(); |
525 | d->bUseSingle = KGlobalSettings::singleClick(); | 525 | d->bUseSingle = KGlobalSettings::singleClick(); |
526 | 526 | ||
527 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 527 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
528 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); | 528 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); |
529 | 529 | ||
530 | if( d->bUseSingle ) | 530 | if( d->bUseSingle ) |
531 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 531 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
532 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); | 532 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); |
533 | 533 | ||
534 | d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); | 534 | d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); |
535 | d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); | 535 | d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); |
536 | 536 | ||
537 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) | 537 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) |
538 | viewport()->unsetCursor(); | 538 | viewport()->unsetCursor(); |
539 | 539 | ||
540 | break; | 540 | break; |
541 | 541 | ||
542 | case KApplication::SETTINGS_POPUPMENU: | 542 | case KApplication::SETTINGS_POPUPMENU: |
543 | d->contextMenuKey = KGlobalSettings::contextMenuKey (); | 543 | d->contextMenuKey = KGlobalSettings::contextMenuKey (); |
544 | d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress (); | 544 | d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress (); |
545 | 545 | ||
546 | if (d->showContextMenusOnPress) | 546 | if (d->showContextMenusOnPress) |
547 | { | 547 | { |
548 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 548 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
549 | 549 | ||
550 | connect(this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), | 550 | connect(this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), |
551 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 551 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
552 | } | 552 | } |
553 | else | 553 | else |
554 | { | 554 | { |
555 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 555 | disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
556 | 556 | ||
557 | connect(this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), | 557 | connect(this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), |
558 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 558 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
559 | } | 559 | } |
560 | break; | 560 | break; |
561 | 561 | ||
562 | default: | 562 | default: |
563 | break; | 563 | break; |
564 | } | 564 | } |
565 | */ | 565 | */ |
566 | 566 | ||