-rw-r--r-- | libkdepim/ksyncmanager.cpp | 58 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 1 |
2 files changed, 47 insertions, 12 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index b3e266a..0faa24d 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -548,133 +548,163 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | |||
548 | preCommand = prof->getPreSyncCommandPWM(); | 548 | preCommand = prof->getPreSyncCommandPWM(); |
549 | postCommand = prof->getPostSyncCommandPWM(); | 549 | postCommand = prof->getPostSyncCommandPWM(); |
550 | localTempFile = prof->getLocalTempFilePWM(); | 550 | localTempFile = prof->getLocalTempFilePWM(); |
551 | break; | 551 | break; |
552 | default: | 552 | default: |
553 | qDebug("KSyncManager::syncRemote: invalid apptype selected"); | 553 | qDebug("KSyncManager::syncRemote: invalid apptype selected"); |
554 | break; | 554 | break; |
555 | } | 555 | } |
556 | 556 | ||
557 | 557 | ||
558 | int fi; | 558 | int fi; |
559 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { | 559 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { |
560 | QString pwd = getPassword(); | 560 | QString pwd = getPassword(); |
561 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); | 561 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); |
562 | 562 | ||
563 | } | 563 | } |
564 | int maxlen = 30; | 564 | int maxlen = 30; |
565 | if ( QApplication::desktop()->width() > 320 ) | 565 | if ( QApplication::desktop()->width() > 320 ) |
566 | maxlen += 25; | 566 | maxlen += 25; |
567 | mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); | 567 | mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); |
568 | int fileSize = 0; | 568 | int fileSize = 0; |
569 | int result = system ( preCommand ); | 569 | int result = system ( preCommand ); |
570 | // 0 : okay | 570 | // 0 : okay |
571 | // 256: no such file or dir | 571 | // 256: no such file or dir |
572 | // | 572 | // |
573 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | 573 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); |
574 | if ( result != 0 ) { | 574 | if ( result != 0 ) { |
575 | unsigned int len = maxlen; | 575 | unsigned int len = maxlen; |
576 | while ( len < preCommand.length() ) { | 576 | while ( len < preCommand.length() ) { |
577 | preCommand.insert( len , "\n" ); | 577 | preCommand.insert( len , "\n" ); |
578 | len += maxlen +2; | 578 | len += maxlen +2; |
579 | } | 579 | } |
580 | 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) ; | 580 | 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) ; |
581 | QMessageBox::information( mParent, i18n("Sync - ERROR"), | 581 | QMessageBox::information( mParent, i18n("Sync - ERROR"), |
582 | question, | 582 | question, |
583 | i18n("Okay!")) ; | 583 | i18n("Okay!")) ; |
584 | mParent->topLevelWidget()->setCaption ("KDE-Pim"); | 584 | mParent->topLevelWidget()->setCaption ("KDE-Pim"); |
585 | return; | 585 | return; |
586 | } | 586 | } |
587 | mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); | 587 | mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); |
588 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 588 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
589 | 589 | ||
590 | if ( syncWithFile( localTempFile, true ) ) { | 590 | if ( syncWithFile( localTempFile, true ) ) { |
591 | 591 | ||
592 | if ( mWriteBackFile ) { | 592 | if ( mWriteBackFile ) { |
593 | int fi; | 593 | int fi; |
594 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { | 594 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { |
595 | QString pwd = getPassword(); | 595 | QString pwd = getPassword(); |
596 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); | 596 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); |
597 | 597 | ||
598 | } | 598 | } |
599 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); | 599 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); |
600 | result = system ( postCommand ); | 600 | result = system ( postCommand ); |
601 | qDebug("Writing back file result: %d ", result); | 601 | qDebug("Writing back file result: %d ", result); |
602 | if ( result != 0 ) { | 602 | if ( result != 0 ) { |
603 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); | 603 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); |
604 | return; | 604 | return; |
605 | } else { | 605 | } else { |
606 | mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 606 | mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
607 | } | 607 | } |
608 | } | 608 | } |
609 | } | 609 | } |
610 | return; | 610 | return; |
611 | } | 611 | } |
612 | 612 | void KSyncManager::edit_pisync_options() | |
613 | { | ||
614 | QDialog dia( mParent, "dia", true ); | ||
615 | dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice ); | ||
616 | QVBoxLayout lay ( &dia ); | ||
617 | lay.setSpacing( 5 ); | ||
618 | lay.setMargin( 3 ); | ||
619 | QLabel lab1 ( i18n("Password for remote access:"), &dia); | ||
620 | lay.addWidget( &lab1 ); | ||
621 | QLineEdit le1 (&dia ); | ||
622 | lay.addWidget( &le1 ); | ||
623 | QLabel lab2 ( i18n("Remote IP address:"), &dia); | ||
624 | lay.addWidget( &lab2 ); | ||
625 | QLineEdit le2 (&dia ); | ||
626 | lay.addWidget( &le2 ); | ||
627 | QLabel lab3 ( i18n("Remote port number:"), &dia); | ||
628 | lay.addWidget( &lab3 ); | ||
629 | QLineEdit le3 (&dia ); | ||
630 | lay.addWidget( &le3 ); | ||
631 | QPushButton pb ( "OK", &dia); | ||
632 | lay.addWidget( &pb ); | ||
633 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | ||
634 | le1.setText( mPassWordPiSync ); | ||
635 | le2.setText( mActiveSyncIP ); | ||
636 | le3.setText( mActiveSyncPort ); | ||
637 | if ( dia.exec() ) { | ||
638 | mPassWordPiSync = le1.text(); | ||
639 | mActiveSyncPort = le3.text(); | ||
640 | mActiveSyncIP = le2.text(); | ||
641 | } | ||
642 | |||
643 | } | ||
613 | void KSyncManager::edit_sync_options() | 644 | void KSyncManager::edit_sync_options() |
614 | { | 645 | { |
615 | //mDialogManager->showSyncOptions(); | 646 | |
616 | //mSyncAlgoPrefs | ||
617 | QDialog dia( mParent, "dia", true ); | 647 | QDialog dia( mParent, "dia", true ); |
618 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); | 648 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); |
619 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); | 649 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); |
620 | QVBoxLayout lay ( &dia ); | 650 | QVBoxLayout lay ( &dia ); |
621 | lay.setSpacing( 2 ); | 651 | lay.setSpacing( 2 ); |
622 | lay.setMargin( 3 ); | 652 | lay.setMargin( 3 ); |
623 | lay.addWidget(&gr); | 653 | lay.addWidget(&gr); |
624 | QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); | 654 | QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); |
625 | QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); | 655 | QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); |
626 | QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); | 656 | QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); |
627 | QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); | 657 | QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); |
628 | QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); | 658 | QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); |
629 | QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); | 659 | QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); |
630 | //QRadioButton both( i18n("Take both on conflict"), &gr ); | 660 | //QRadioButton both( i18n("Take both on conflict"), &gr ); |
631 | QPushButton pb ( "OK", &dia); | 661 | QPushButton pb ( "OK", &dia); |
632 | lay.addWidget( &pb ); | 662 | lay.addWidget( &pb ); |
633 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 663 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
634 | switch ( mSyncAlgoPrefs ) { | 664 | switch ( mSyncAlgoPrefs ) { |
635 | case 0: | 665 | case 0: |
636 | loc.setChecked( true); | 666 | loc.setChecked( true); |
637 | break; | 667 | break; |
638 | case 1: | 668 | case 1: |
639 | rem.setChecked( true ); | 669 | rem.setChecked( true ); |
640 | break; | 670 | break; |
641 | case 2: | 671 | case 2: |
642 | newest.setChecked( true); | 672 | newest.setChecked( true); |
643 | break; | 673 | break; |
644 | case 3: | 674 | case 3: |
645 | ask.setChecked( true); | 675 | ask.setChecked( true); |
646 | break; | 676 | break; |
647 | case 4: | 677 | case 4: |
648 | f_loc.setChecked( true); | 678 | f_loc.setChecked( true); |
649 | break; | 679 | break; |
650 | case 5: | 680 | case 5: |
651 | f_rem.setChecked( true); | 681 | f_rem.setChecked( true); |
652 | break; | 682 | break; |
653 | case 6: | 683 | case 6: |
654 | // both.setChecked( true); | 684 | // both.setChecked( true); |
655 | break; | 685 | break; |
656 | default: | 686 | default: |
657 | break; | 687 | break; |
658 | } | 688 | } |
659 | if ( dia.exec() ) { | 689 | if ( dia.exec() ) { |
660 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; | 690 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; |
661 | } | 691 | } |
662 | 692 | ||
663 | 693 | ||
664 | } | 694 | } |
665 | 695 | ||
666 | QString KSyncManager::getPassword( ) | 696 | QString KSyncManager::getPassword( ) |
667 | { | 697 | { |
668 | QString retfile = ""; | 698 | QString retfile = ""; |
669 | QDialog dia ( mParent, "input-dialog", true ); | 699 | QDialog dia ( mParent, "input-dialog", true ); |
670 | QLineEdit lab ( &dia ); | 700 | QLineEdit lab ( &dia ); |
671 | lab.setEchoMode( QLineEdit::Password ); | 701 | lab.setEchoMode( QLineEdit::Password ); |
672 | QVBoxLayout lay( &dia ); | 702 | QVBoxLayout lay( &dia ); |
673 | lay.setMargin(7); | 703 | lay.setMargin(7); |
674 | lay.setSpacing(7); | 704 | lay.setSpacing(7); |
675 | lay.addWidget( &lab); | 705 | lay.addWidget( &lab); |
676 | dia.setFixedSize( 230,50 ); | 706 | dia.setFixedSize( 230,50 ); |
677 | dia.setCaption( i18n("Enter password") ); | 707 | dia.setCaption( i18n("Enter password") ); |
678 | QPushButton pb ( "OK", &dia); | 708 | QPushButton pb ( "OK", &dia); |
679 | lay.addWidget( &pb ); | 709 | lay.addWidget( &pb ); |
680 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 710 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
@@ -724,252 +754,253 @@ bool KSyncManager::syncExternalApplication(QString resource) | |||
724 | 754 | ||
725 | qDebug("sync %s", resource.latin1()); | 755 | qDebug("sync %s", resource.latin1()); |
726 | 756 | ||
727 | bool syncOK = mImplementation->syncExternal(this, resource); | 757 | bool syncOK = mImplementation->syncExternal(this, resource); |
728 | 758 | ||
729 | return syncOK; | 759 | return syncOK; |
730 | 760 | ||
731 | } | 761 | } |
732 | 762 | ||
733 | void KSyncManager::syncPhone() | 763 | void KSyncManager::syncPhone() |
734 | { | 764 | { |
735 | 765 | ||
736 | syncExternalApplication("phone"); | 766 | syncExternalApplication("phone"); |
737 | 767 | ||
738 | } | 768 | } |
739 | 769 | ||
740 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) | 770 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) |
741 | { | 771 | { |
742 | if (!bar->isVisible()) | 772 | if (!bar->isVisible()) |
743 | { | 773 | { |
744 | bar->setCaption (caption); | 774 | bar->setCaption (caption); |
745 | bar->setTotalSteps ( total ) ; | 775 | bar->setTotalSteps ( total ) ; |
746 | 776 | ||
747 | bar->show(); | 777 | bar->show(); |
748 | } | 778 | } |
749 | 779 | ||
750 | bar->setProgress( percentage ); | 780 | bar->setProgress( percentage ); |
751 | } | 781 | } |
752 | 782 | ||
753 | void KSyncManager::hideProgressBar() | 783 | void KSyncManager::hideProgressBar() |
754 | { | 784 | { |
755 | bar->hide(); | 785 | bar->hide(); |
756 | } | 786 | } |
757 | 787 | ||
758 | bool KSyncManager::isProgressBarCanceled() | 788 | bool KSyncManager::isProgressBarCanceled() |
759 | { | 789 | { |
760 | return !bar->isVisible(); | 790 | return !bar->isVisible(); |
761 | } | 791 | } |
762 | 792 | ||
763 | QString KSyncManager::syncFileName() | 793 | QString KSyncManager::syncFileName() |
764 | { | 794 | { |
765 | 795 | ||
766 | QString fn = "tempfile"; | 796 | QString fn = "tempfile"; |
767 | switch(mTargetApp) | 797 | switch(mTargetApp) |
768 | { | 798 | { |
769 | case (KAPI): | 799 | case (KAPI): |
770 | fn = "tempsyncab.vcf"; | 800 | fn = "tempsyncab.vcf"; |
771 | break; | 801 | break; |
772 | case (KOPI): | 802 | case (KOPI): |
773 | fn = "tempsynccal.ics"; | 803 | fn = "tempsynccal.ics"; |
774 | break; | 804 | break; |
775 | case (PWMPI): | 805 | case (PWMPI): |
776 | fn = "tempsyncpw.pwm"; | 806 | fn = "tempsyncpw.pwm"; |
777 | break; | 807 | break; |
778 | default: | 808 | default: |
779 | break; | 809 | break; |
780 | } | 810 | } |
781 | #ifdef _WIN32_ | 811 | #ifdef _WIN32_ |
782 | return locateLocal( "tmp", fn ); | 812 | return locateLocal( "tmp", fn ); |
783 | #else | 813 | #else |
784 | return (QString( "/tmp/" )+ fn ); | 814 | return (QString( "/tmp/" )+ fn ); |
785 | #endif | 815 | #endif |
786 | } | 816 | } |
787 | 817 | ||
788 | |||
789 | void KSyncManager::syncPi() | 818 | void KSyncManager::syncPi() |
790 | { | 819 | { |
791 | qApp->processEvents(); | 820 | qApp->processEvents(); |
821 | if ( mAskForPreferences ) | ||
822 | edit_pisync_options(); | ||
792 | bool ok; | 823 | bool ok; |
793 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); | 824 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); |
794 | if ( ! ok ) { | 825 | if ( ! ok ) { |
795 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 826 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
796 | return; | 827 | return; |
797 | } | 828 | } |
798 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); | 829 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); |
799 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 830 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
800 | mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); | 831 | mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); |
801 | commandSocket->readFile( syncFileName() ); | 832 | commandSocket->readFile( syncFileName() ); |
802 | } | 833 | } |
803 | 834 | ||
804 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | 835 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) |
805 | { | 836 | { |
806 | qDebug("MainWindow::deleteCommandSocket %d", state); | 837 | qDebug("MainWindow::deleteCommandSocket %d", state); |
807 | 838 | ||
808 | //enum { success, errorW, errorR, quiet }; | 839 | //enum { success, errorW, errorR, quiet }; |
809 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { | 840 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { |
810 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); | 841 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); |
811 | delete s; | 842 | delete s; |
812 | if ( state == KCommandSocket::errorR ) { | 843 | if ( state == KCommandSocket::errorR ) { |
813 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 844 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); |
814 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 845 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
815 | commandSocket->sendStop(); | 846 | commandSocket->sendStop(); |
816 | } | 847 | } |
817 | return; | 848 | return; |
818 | 849 | ||
819 | } else if ( state == KCommandSocket::errorW ) { | 850 | } else if ( state == KCommandSocket::errorW ) { |
820 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); | 851 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); |
821 | 852 | ||
822 | } else if ( state == KCommandSocket::successR ) { | 853 | } else if ( state == KCommandSocket::successR ) { |
823 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); | 854 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); |
824 | 855 | ||
825 | } else if ( state == KCommandSocket::successW ) { | 856 | } else if ( state == KCommandSocket::successW ) { |
826 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 857 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
827 | } | 858 | } |
828 | 859 | ||
829 | delete s; | 860 | delete s; |
830 | } | 861 | } |
831 | 862 | ||
832 | void KSyncManager::readFileFromSocket() | 863 | void KSyncManager::readFileFromSocket() |
833 | { | 864 | { |
834 | QString fileName = syncFileName(); | 865 | QString fileName = syncFileName(); |
835 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); | 866 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); |
836 | if ( ! syncWithFile( fileName , true ) ) { | 867 | if ( ! syncWithFile( fileName , true ) ) { |
837 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); | 868 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); |
838 | qDebug("Syncing failed "); | 869 | qDebug("Syncing failed "); |
839 | return; | 870 | return; |
840 | } | 871 | } |
841 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 872 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); |
842 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 873 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
843 | if ( mWriteBackFile ) | 874 | if ( mWriteBackFile ) |
844 | commandSocket->writeFile( fileName ); | 875 | commandSocket->writeFile( fileName ); |
845 | else { | 876 | else { |
846 | commandSocket->sendStop(); | 877 | commandSocket->sendStop(); |
847 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 878 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
848 | } | 879 | } |
849 | } | 880 | } |
850 | 881 | ||
851 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 882 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) |
852 | { | 883 | { |
853 | mPassWord = pw; | 884 | mPassWord = pw; |
854 | mSocket = 0; | 885 | mSocket = 0; |
855 | mSyncActionDialog = 0; | 886 | mSyncActionDialog = 0; |
856 | blockRC = false; | 887 | blockRC = false; |
857 | }; | 888 | }; |
858 | 889 | ||
859 | void KServerSocket::newConnection ( int socket ) | 890 | void KServerSocket::newConnection ( int socket ) |
860 | { | 891 | { |
861 | // qDebug("KServerSocket:New connection %d ", socket); | 892 | // qDebug("KServerSocket:New connection %d ", socket); |
862 | if ( mSocket ) { | 893 | if ( mSocket ) { |
863 | qDebug("KServerSocket::newConnection Socket deleted! "); | 894 | qDebug("KServerSocket::newConnection Socket deleted! "); |
864 | delete mSocket; | 895 | delete mSocket; |
865 | mSocket = 0; | 896 | mSocket = 0; |
866 | } | 897 | } |
867 | mSocket = new QSocket( this ); | 898 | mSocket = new QSocket( this ); |
868 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 899 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
869 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 900 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
870 | mSocket->setSocket( socket ); | 901 | mSocket->setSocket( socket ); |
871 | } | 902 | } |
872 | 903 | ||
873 | void KServerSocket::discardClient() | 904 | void KServerSocket::discardClient() |
874 | { | 905 | { |
875 | //qDebug(" KServerSocket::discardClient()"); | 906 | //qDebug(" KServerSocket::discardClient()"); |
876 | if ( mSocket ) { | 907 | if ( mSocket ) { |
877 | delete mSocket; | 908 | delete mSocket; |
878 | mSocket = 0; | 909 | mSocket = 0; |
879 | } | 910 | } |
880 | //emit endConnect(); | 911 | //emit endConnect(); |
881 | } | 912 | } |
882 | void KServerSocket::readClient() | 913 | void KServerSocket::readClient() |
883 | { | 914 | { |
884 | if ( blockRC ) | 915 | if ( blockRC ) |
885 | return; | 916 | return; |
886 | if ( mSocket == 0 ) { | 917 | if ( mSocket == 0 ) { |
887 | qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); | 918 | qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); |
888 | return; | 919 | return; |
889 | } | 920 | } |
890 | qDebug("KServerSocket readClient()"); | 921 | qDebug("KServerSocket readClient()"); |
891 | if ( mSocket->canReadLine() ) { | 922 | if ( mSocket->canReadLine() ) { |
892 | QString line = mSocket->readLine(); | 923 | QString line = mSocket->readLine(); |
893 | qDebug("KServerSocket readline: %s ", line.latin1()); | 924 | qDebug("KServerSocket readline: %s ", line.latin1()); |
894 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); | 925 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); |
895 | if ( tokens[0] == "GET" ) { | 926 | if ( tokens[0] == "GET" ) { |
896 | if ( tokens[1] == mPassWord ) | 927 | if ( tokens[1] == mPassWord ) |
897 | //emit sendFile( mSocket ); | 928 | //emit sendFile( mSocket ); |
898 | send_file(); | 929 | send_file(); |
899 | else { | 930 | else { |
900 | KMessageBox::information( 0, i18n("ERROR:\nGot send file request\nwith invalid password")); | 931 | KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); |
901 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); | 932 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); |
902 | } | 933 | } |
903 | } | 934 | } |
904 | if ( tokens[0] == "PUT" ) { | 935 | if ( tokens[0] == "PUT" ) { |
905 | if ( tokens[1] == mPassWord ) { | 936 | if ( tokens[1] == mPassWord ) { |
906 | //emit getFile( mSocket ); | 937 | //emit getFile( mSocket ); |
907 | blockRC = true; | 938 | blockRC = true; |
908 | get_file(); | 939 | get_file(); |
909 | } | 940 | } |
910 | else { | 941 | else { |
911 | KMessageBox::information( 0, i18n("ERROR:\nGot receive file request\nwith invalid password")); | 942 | KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password")); |
912 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); | 943 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); |
913 | } | 944 | } |
914 | } | 945 | } |
915 | if ( tokens[0] == "STOP" ) { | 946 | if ( tokens[0] == "STOP" ) { |
916 | //emit endConnect(); | 947 | //emit endConnect(); |
917 | end_connect(); | 948 | end_connect(); |
918 | } | 949 | } |
919 | } | 950 | } |
920 | } | 951 | } |
921 | void KServerSocket::end_connect() | 952 | void KServerSocket::end_connect() |
922 | { | 953 | { |
923 | delete mSyncActionDialog; | 954 | delete mSyncActionDialog; |
924 | mSyncActionDialog = 0; | 955 | mSyncActionDialog = 0; |
925 | } | 956 | } |
926 | void KServerSocket::send_file() | 957 | void KServerSocket::send_file() |
927 | { | 958 | { |
928 | //qDebug("MainWindow::sendFile(QSocket* s) "); | 959 | //qDebug("MainWindow::sendFile(QSocket* s) "); |
929 | if ( mSyncActionDialog ) | 960 | if ( mSyncActionDialog ) |
930 | delete mSyncActionDialog; | 961 | delete mSyncActionDialog; |
931 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); | 962 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); |
932 | mSyncActionDialog->setCaption(i18n("Received sync request")); | 963 | mSyncActionDialog->setCaption(i18n("Received sync request")); |
933 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); | 964 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); |
934 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); | 965 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); |
935 | lay->addWidget( label); | 966 | lay->addWidget( label); |
936 | lay->setMargin(7); | 967 | lay->setMargin(7); |
937 | lay->setSpacing(7); | 968 | lay->setSpacing(7); |
938 | mSyncActionDialog->setFixedSize( 230, 120); | 969 | mSyncActionDialog->setFixedSize( 230, 120); |
939 | mSyncActionDialog->show(); | 970 | mSyncActionDialog->show(); |
940 | mSyncActionDialog->raise(); | 971 | mSyncActionDialog->raise(); |
941 | qDebug("KSS::saving ... "); | 972 | qDebug("KSS::saving ... "); |
942 | emit request_file(); | 973 | emit request_file(); |
943 | qApp->processEvents(); | 974 | qApp->processEvents(); |
944 | QString fileName = mFileName; | 975 | QString fileName = mFileName; |
945 | QFile file( fileName ); | 976 | QFile file( fileName ); |
946 | if (!file.open( IO_ReadOnly ) ) { | 977 | if (!file.open( IO_ReadOnly ) ) { |
947 | delete mSyncActionDialog; | 978 | delete mSyncActionDialog; |
948 | mSyncActionDialog = 0; | 979 | mSyncActionDialog = 0; |
949 | qDebug("KSS::error open file "); | 980 | qDebug("KSS::error open file "); |
950 | mSocket->close(); | 981 | mSocket->close(); |
951 | if ( mSocket->state() == QSocket::Idle ) | 982 | if ( mSocket->state() == QSocket::Idle ) |
952 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 983 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
953 | return ; | 984 | return ; |
954 | 985 | ||
955 | } | 986 | } |
956 | mSyncActionDialog->setCaption( i18n("Sending file...") ); | 987 | mSyncActionDialog->setCaption( i18n("Sending file...") ); |
957 | QTextStream ts( &file ); | 988 | QTextStream ts( &file ); |
958 | ts.setEncoding( QTextStream::Latin1 ); | 989 | ts.setEncoding( QTextStream::Latin1 ); |
959 | 990 | ||
960 | QTextStream os( mSocket ); | 991 | QTextStream os( mSocket ); |
961 | os.setEncoding( QTextStream::Latin1 ); | 992 | os.setEncoding( QTextStream::Latin1 ); |
962 | while ( ! ts.atEnd() ) { | 993 | while ( ! ts.atEnd() ) { |
963 | os << ts.readLine() << "\n"; | 994 | os << ts.readLine() << "\n"; |
964 | } | 995 | } |
965 | //os << ts.read(); | 996 | //os << ts.read(); |
966 | file.close(); | 997 | file.close(); |
967 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); | 998 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); |
968 | mSocket->close(); | 999 | mSocket->close(); |
969 | if ( mSocket->state() == QSocket::Idle ) | 1000 | if ( mSocket->state() == QSocket::Idle ) |
970 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 1001 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
971 | } | 1002 | } |
972 | void KServerSocket::get_file() | 1003 | void KServerSocket::get_file() |
973 | { | 1004 | { |
974 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); | 1005 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); |
975 | 1006 | ||
@@ -1094,83 +1125,86 @@ void KCommandSocket::sendStop() | |||
1094 | mSocket = new QSocket( this ); | 1125 | mSocket = new QSocket( this ); |
1095 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1126 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1096 | } | 1127 | } |
1097 | mSocket->connectToHost( mHost, mPort ); | 1128 | mSocket->connectToHost( mHost, mPort ); |
1098 | QTextStream os2( mSocket ); | 1129 | QTextStream os2( mSocket ); |
1099 | os2.setEncoding( QTextStream::Latin1 ); | 1130 | os2.setEncoding( QTextStream::Latin1 ); |
1100 | os2 << "STOP\r\n"; | 1131 | os2 << "STOP\r\n"; |
1101 | mSocket->close(); | 1132 | mSocket->close(); |
1102 | if ( mSocket->state() == QSocket::Idle ) | 1133 | if ( mSocket->state() == QSocket::Idle ) |
1103 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1134 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1104 | } | 1135 | } |
1105 | 1136 | ||
1106 | void KCommandSocket::startReadFileFromSocket() | 1137 | void KCommandSocket::startReadFileFromSocket() |
1107 | { | 1138 | { |
1108 | if ( ! mFirst ) | 1139 | if ( ! mFirst ) |
1109 | return; | 1140 | return; |
1110 | mFirst = false; | 1141 | mFirst = false; |
1111 | mTimerSocket->stop(); | 1142 | mTimerSocket->stop(); |
1112 | mFileString = ""; | 1143 | mFileString = ""; |
1113 | mTime.start(); | 1144 | mTime.start(); |
1114 | QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) )); | 1145 | QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) )); |
1115 | 1146 | ||
1116 | } | 1147 | } |
1117 | void KCommandSocket::readFileFromSocket() | 1148 | void KCommandSocket::readFileFromSocket() |
1118 | { | 1149 | { |
1119 | //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); | 1150 | //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); |
1120 | while ( mSocket->canReadLine () ) { | 1151 | while ( mSocket->canReadLine () ) { |
1121 | mTime.restart(); | 1152 | mTime.restart(); |
1122 | QString line = mSocket->readLine (); | 1153 | QString line = mSocket->readLine (); |
1123 | mFileString += line; | 1154 | mFileString += line; |
1124 | //qDebug("readline: %s ", line.latin1()); | 1155 | //qDebug("readline: %s ", line.latin1()); |
1125 | } | 1156 | } |
1126 | if ( mTime.elapsed () < 3000 ) { | 1157 | if ( mTime.elapsed () < 3000 ) { |
1127 | // wait for more | 1158 | // wait for more |
1128 | //qDebug("waitformore "); | 1159 | //qDebug("waitformore "); |
1129 | QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); | 1160 | QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); |
1130 | return; | 1161 | return; |
1131 | } | 1162 | } |
1132 | QString fileName = mFileName; | 1163 | QString fileName = mFileName; |
1133 | QFile file ( fileName ); | 1164 | QFile file ( fileName ); |
1134 | if (!file.open( IO_WriteOnly ) ) { | 1165 | if (!file.open( IO_WriteOnly ) ) { |
1135 | mFileString = ""; | 1166 | mFileString = ""; |
1136 | mRetVal = errorR; | 1167 | mRetVal = errorR; |
1137 | qDebug("Error open temp calender file for writing: %s",fileName.latin1() ); | 1168 | qDebug("Error open temp calender file for writing: %s",fileName.latin1() ); |
1138 | deleteSocket(); | 1169 | deleteSocket(); |
1139 | return ; | 1170 | return ; |
1140 | 1171 | ||
1141 | } | 1172 | } |
1142 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 1173 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
1143 | QTextStream ts ( &file ); | 1174 | QTextStream ts ( &file ); |
1144 | ts.setEncoding( QTextStream::Latin1 ); | 1175 | ts.setEncoding( QTextStream::Latin1 ); |
1145 | ts << mFileString; | 1176 | ts << mFileString; |
1146 | file.close(); | 1177 | file.close(); |
1147 | mFileString = ""; | 1178 | mFileString = ""; |
1148 | mRetVal = successR; | 1179 | mRetVal = successR; |
1149 | mSocket->close(); | 1180 | mSocket->close(); |
1150 | // if state is not idle, deleteSocket(); is called via | 1181 | // if state is not idle, deleteSocket(); is called via |
1151 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1182 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1152 | if ( mSocket->state() == QSocket::Idle ) | 1183 | if ( mSocket->state() == QSocket::Idle ) |
1153 | deleteSocket(); | 1184 | deleteSocket(); |
1154 | } | 1185 | } |
1155 | 1186 | ||
1156 | void KCommandSocket::deleteSocket() | 1187 | void KCommandSocket::deleteSocket() |
1157 | { | 1188 | { |
1189 | //qDebug("KCommandSocket::deleteSocket() "); | ||
1158 | if ( mTimerSocket->isActive () ) { | 1190 | if ( mTimerSocket->isActive () ) { |
1159 | mTimerSocket->stop(); | 1191 | mTimerSocket->stop(); |
1160 | mRetVal = errorTO; | 1192 | mRetVal = errorTO; |
1193 | qDebug("Connection to remote host timed out"); | ||
1161 | if ( mSocket ) { | 1194 | if ( mSocket ) { |
1162 | mSocket->close(); | 1195 | mSocket->close(); |
1163 | if ( mSocket->state() == QSocket::Idle ) | 1196 | //if ( mSocket->state() == QSocket::Idle ) |
1164 | deleteSocket(); | 1197 | // deleteSocket(); |
1165 | return; | 1198 | delete mSocket; |
1199 | mSocket = 0; | ||
1166 | } | 1200 | } |
1201 | KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host? ")); | ||
1202 | emit commandFinished( this, mRetVal ); | ||
1203 | return; | ||
1167 | } | 1204 | } |
1168 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); | 1205 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); |
1169 | if ( mSocket) | 1206 | if ( mSocket) |
1170 | delete mSocket; | 1207 | delete mSocket; |
1171 | mSocket = 0; | 1208 | mSocket = 0; |
1172 | if ( mRetVal == errorTO) | ||
1173 | KMessageBox::information( 0, i18n("ERROR:\nConnection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host? ")); | ||
1174 | |||
1175 | emit commandFinished( this, mRetVal ); | 1209 | emit commandFinished( this, mRetVal ); |
1176 | } | 1210 | } |
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 1f7c7e7..5b05383 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -112,96 +112,97 @@ class KSyncManager : public QObject | |||
112 | PWMPI = 2 }; | 112 | PWMPI = 2 }; |
113 | 113 | ||
114 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); | 114 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); |
115 | ~KSyncManager() ; | 115 | ~KSyncManager() ; |
116 | 116 | ||
117 | void multiSync( bool askforPrefs ); | 117 | void multiSync( bool askforPrefs ); |
118 | bool blockSave() { return mBlockSaveFlag; } | 118 | bool blockSave() { return mBlockSaveFlag; } |
119 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } | 119 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } |
120 | void setDefaultFileName( QString s) { mDefFileName = s ;} | 120 | void setDefaultFileName( QString s) { mDefFileName = s ;} |
121 | QString defaultFileName() { return mDefFileName ;} | 121 | QString defaultFileName() { return mDefFileName ;} |
122 | QString syncFileName(); | 122 | QString syncFileName(); |
123 | 123 | ||
124 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } | 124 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } |
125 | QString getCurrentSyncName() { return mCurrentSyncName; } | 125 | QString getCurrentSyncName() { return mCurrentSyncName; } |
126 | 126 | ||
127 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); | 127 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); |
128 | void hideProgressBar(); | 128 | void hideProgressBar(); |
129 | bool isProgressBarCanceled(); | 129 | bool isProgressBarCanceled(); |
130 | 130 | ||
131 | // sync stuff | 131 | // sync stuff |
132 | QString mLocalMachineName; | 132 | QString mLocalMachineName; |
133 | QStringList mExternSyncProfiles; | 133 | QStringList mExternSyncProfiles; |
134 | QStringList mSyncProfileNames; | 134 | QStringList mSyncProfileNames; |
135 | bool mAskForPreferences; | 135 | bool mAskForPreferences; |
136 | bool mShowSyncSummary; | 136 | bool mShowSyncSummary; |
137 | bool mWriteBackExistingOnly; | 137 | bool mWriteBackExistingOnly; |
138 | int mSyncAlgoPrefs; | 138 | int mSyncAlgoPrefs; |
139 | bool mWriteBackFile; | 139 | bool mWriteBackFile; |
140 | int mWriteBackInFuture; | 140 | int mWriteBackInFuture; |
141 | QString mPhoneDevice; | 141 | QString mPhoneDevice; |
142 | QString mPhoneConnection; | 142 | QString mPhoneConnection; |
143 | QString mPhoneModel; | 143 | QString mPhoneModel; |
144 | QString mPassWordPiSync; | 144 | QString mPassWordPiSync; |
145 | QString mActiveSyncPort; | 145 | QString mActiveSyncPort; |
146 | QString mActiveSyncIP ; | 146 | QString mActiveSyncIP ; |
147 | 147 | ||
148 | signals: | 148 | signals: |
149 | void save(); | 149 | void save(); |
150 | void request_file(); | 150 | void request_file(); |
151 | void getFile( bool ); | 151 | void getFile( bool ); |
152 | 152 | ||
153 | public slots: | 153 | public slots: |
154 | void slotSyncMenu( int ); | 154 | void slotSyncMenu( int ); |
155 | void deleteCommandSocket(KCommandSocket*s, int state); | 155 | void deleteCommandSocket(KCommandSocket*s, int state); |
156 | void readFileFromSocket(); | 156 | void readFileFromSocket(); |
157 | void fillSyncMenu(); | 157 | void fillSyncMenu(); |
158 | 158 | ||
159 | private: | 159 | private: |
160 | void syncPi(); | 160 | void syncPi(); |
161 | KServerSocket * mServerSocket; | 161 | KServerSocket * mServerSocket; |
162 | void enableQuick(); | 162 | void enableQuick(); |
163 | KPimPrefs* mPrefs; | 163 | KPimPrefs* mPrefs; |
164 | QString mDefFileName; | 164 | QString mDefFileName; |
165 | QString mCurrentSyncDevice; | 165 | QString mCurrentSyncDevice; |
166 | QString mCurrentSyncName; | 166 | QString mCurrentSyncName; |
167 | void quickSyncLocalFile(); | 167 | void quickSyncLocalFile(); |
168 | bool syncWithFile( QString fn , bool quick ); | 168 | bool syncWithFile( QString fn , bool quick ); |
169 | void syncLocalFile(); | 169 | void syncLocalFile(); |
170 | void syncPhone(); | 170 | void syncPhone(); |
171 | void syncSharp(); | 171 | void syncSharp(); |
172 | bool syncExternalApplication(QString); | 172 | bool syncExternalApplication(QString); |
173 | int mCurrentSyncProfile ; | 173 | int mCurrentSyncProfile ; |
174 | void syncRemote( KSyncProfile* prof, bool ask = true); | 174 | void syncRemote( KSyncProfile* prof, bool ask = true); |
175 | void edit_sync_options(); | 175 | void edit_sync_options(); |
176 | void edit_pisync_options(); | ||
176 | int ringSync(); | 177 | int ringSync(); |
177 | QString getPassword( ); | 178 | QString getPassword( ); |
178 | 179 | ||
179 | private slots: | 180 | private slots: |
180 | void confSync(); | 181 | void confSync(); |
181 | private: | 182 | private: |
182 | bool mBlockSaveFlag; | 183 | bool mBlockSaveFlag; |
183 | QWidget* mParent; | 184 | QWidget* mParent; |
184 | KSyncInterface* mImplementation; | 185 | KSyncInterface* mImplementation; |
185 | TargetApp mTargetApp; | 186 | TargetApp mTargetApp; |
186 | QPopupMenu* mSyncMenu; | 187 | QPopupMenu* mSyncMenu; |
187 | QProgressBar* bar; | 188 | QProgressBar* bar; |
188 | 189 | ||
189 | }; | 190 | }; |
190 | 191 | ||
191 | 192 | ||
192 | class KSyncInterface | 193 | class KSyncInterface |
193 | { | 194 | { |
194 | public : | 195 | public : |
195 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; | 196 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; |
196 | virtual bool syncExternal(KSyncManager* manager, QString resource) | 197 | virtual bool syncExternal(KSyncManager* manager, QString resource) |
197 | { | 198 | { |
198 | // empty implementation, because some syncable applications do not | 199 | // empty implementation, because some syncable applications do not |
199 | // have an external(sharpdtm) syncmode, like pwmanager. | 200 | // have an external(sharpdtm) syncmode, like pwmanager. |
200 | return false; | 201 | return false; |
201 | } | 202 | } |
202 | 203 | ||
203 | 204 | ||
204 | }; | 205 | }; |
205 | 206 | ||
206 | 207 | ||
207 | #endif | 208 | #endif |