equal
deleted
inserted
replaced
23 _LIT( KMdsFileServerPlugin, "MdsFileServerPlugin" ); |
23 _LIT( KMdsFileServerPlugin, "MdsFileServerPlugin" ); |
24 |
24 |
25 /* Server name */ |
25 /* Server name */ |
26 _LIT( KHarvesterServerName, "HarvesterServer" ); |
26 _LIT( KHarvesterServerName, "HarvesterServer" ); |
27 |
27 |
28 const TInt KCleanQueueTreshoald( 1000 ); |
28 const TInt KCleanQueueTreshold( 1000 ); |
29 |
29 |
30 //----------------------------------------------------------------------------- |
30 //----------------------------------------------------------------------------- |
31 // CMdsFileServerPlugin implementation |
31 // CMdsFileServerPlugin implementation |
32 //----------------------------------------------------------------------------- |
32 //----------------------------------------------------------------------------- |
33 // |
33 // |
751 //----------------------------------------------------------------------------- |
751 //----------------------------------------------------------------------------- |
752 // |
752 // |
753 TInt CMdsFileServerPlugin::AddNotificationPath( const CFsPluginConnRequest& aRequest ) |
753 TInt CMdsFileServerPlugin::AddNotificationPath( const CFsPluginConnRequest& aRequest ) |
754 { |
754 { |
755 WRITELOG( "CMdsFileServerPlugin::AddNotificationPath()" ); |
755 WRITELOG( "CMdsFileServerPlugin::AddNotificationPath()" ); |
756 TInt err = KErrNone; |
756 TInt err( KErrNone ); |
757 |
757 |
758 TMdsFSPStatusPckg pckg; |
758 TMdsFSPStatusPckg pckg; |
759 TRAP( err, aRequest.ReadParam1L(pckg) ); |
759 TRAP( err, aRequest.ReadParam1L(pckg) ); |
760 |
760 |
761 if ( err != KErrNone ) |
761 if ( err != KErrNone ) |
765 |
765 |
766 TMdsFSPStatus& status = pckg(); |
766 TMdsFSPStatus& status = pckg(); |
767 |
767 |
768 if ( status.iFileName.Length() > 0 ) |
768 if ( status.iFileName.Length() > 0 ) |
769 { |
769 { |
770 // check if already exists |
770 // check if already exist |
771 const TInt count( iPaths.Count() ); |
771 const TInt ret = iPaths.FindInOrder(&status.iFileName, |
772 for ( TInt i = count; --i >= 0; ) |
772 TLinearOrder<TDesC>(CMdsFileServerPlugin::Compare)); |
773 { |
773 |
774 TDesC* tf = iPaths[i]; |
774 if( ret >= 0 ) |
775 if ( MdsUtils::Compare( status.iFileName, *tf ) == 0 ) |
775 { |
776 { |
776 return KErrNone; |
777 return KErrNone; |
777 } |
778 } |
|
779 } |
|
780 |
778 |
781 WRITELOG1( "CMdsFileServerPlugin::AddNotificationPath() - add path: %S", &status.iFileName ); |
779 WRITELOG1( "CMdsFileServerPlugin::AddNotificationPath() - add path: %S", &status.iFileName ); |
782 HBufC* fn = status.iFileName.Alloc(); |
780 HBufC* fn = status.iFileName.Alloc(); |
783 if ( fn ) |
781 if ( fn ) |
784 { |
782 { |
785 iPaths.Append( fn ); |
783 iPaths.InsertInOrder(fn, TLinearOrder<TDesC>(CMdsFileServerPlugin::Compare)); |
786 } |
784 } |
787 else |
785 else |
788 { |
786 { |
789 err = KErrNoMemory; |
787 err = KErrNoMemory; |
790 } |
788 } |
802 //----------------------------------------------------------------------------- |
800 //----------------------------------------------------------------------------- |
803 // |
801 // |
804 TInt CMdsFileServerPlugin::RemoveNotificationPath( const CFsPluginConnRequest& aRequest ) |
802 TInt CMdsFileServerPlugin::RemoveNotificationPath( const CFsPluginConnRequest& aRequest ) |
805 { |
803 { |
806 WRITELOG( "CMdsFileServerPlugin::RemoveNotificationPath()" ); |
804 WRITELOG( "CMdsFileServerPlugin::RemoveNotificationPath()" ); |
807 TInt err = KErrNone; |
805 TInt err( KErrNone ); |
808 |
806 |
809 TMdsFSPStatusPckg pckg; |
807 TMdsFSPStatusPckg pckg; |
810 TRAP( err, aRequest.ReadParam1L(pckg) ); |
808 TRAP( err, aRequest.ReadParam1L(pckg) ); |
811 |
809 |
812 if ( err != KErrNone ) |
810 if ( err != KErrNone ) |
816 |
814 |
817 TMdsFSPStatus& status = pckg(); |
815 TMdsFSPStatus& status = pckg(); |
818 |
816 |
819 if ( status.iFileName.Length() > 0 ) |
817 if ( status.iFileName.Length() > 0 ) |
820 { |
818 { |
821 for ( TInt i = iPaths.Count(); --i >= 0; ) |
819 const TInt ret = iPaths.FindInOrder(&status.iFileName, |
822 { |
820 TLinearOrder<TDesC>(CMdsFileServerPlugin::Compare)); |
823 TDesC* tf = iPaths[i]; |
821 |
824 if ( MdsUtils::Compare( status.iFileName, *tf ) == 0 ) |
822 if( ret >= 0 ) |
825 { |
823 { |
826 WRITELOG1( "CMdsFileServerPlugin::RemoveNotificationPath() - remove path: %S", &status.iFileName ); |
824 WRITELOG1( "CMdsFileServerPlugin::RemoveNotificationPath() - remove path: %S", &status.iFileName ); |
827 delete tf; |
825 delete iPaths[ret]; |
828 tf = NULL; |
826 iPaths[ret] = NULL; |
829 iPaths.Remove( i ); |
827 iPaths.Remove( ret ); |
830 } |
828 } |
831 } |
|
832 iPaths.Compress(); |
829 iPaths.Compress(); |
833 } |
830 } |
834 else |
831 else |
835 { |
832 { |
836 err = KErrNotFound; |
833 err = KErrNotFound; |
844 //----------------------------------------------------------------------------- |
841 //----------------------------------------------------------------------------- |
845 // |
842 // |
846 TInt CMdsFileServerPlugin::AddIgnorePath( const CFsPluginConnRequest& aRequest ) |
843 TInt CMdsFileServerPlugin::AddIgnorePath( const CFsPluginConnRequest& aRequest ) |
847 { |
844 { |
848 WRITELOG( "CMdsFileServerPlugin::AddIgnorePath()" ); |
845 WRITELOG( "CMdsFileServerPlugin::AddIgnorePath()" ); |
849 TInt err = KErrNone; |
846 TInt err( KErrNone ); |
850 |
847 |
851 TMdsFSPStatusPckg pckg; |
848 TMdsFSPStatusPckg pckg; |
852 TRAP( err, aRequest.ReadParam1L(pckg) ); |
849 TRAP( err, aRequest.ReadParam1L(pckg) ); |
853 |
850 |
854 if ( err != KErrNone ) |
851 if ( err != KErrNone ) |
859 TMdsFSPStatus& status = pckg(); |
856 TMdsFSPStatus& status = pckg(); |
860 |
857 |
861 if ( status.iFileName.Length() > 0 ) |
858 if ( status.iFileName.Length() > 0 ) |
862 { |
859 { |
863 // check if already exist |
860 // check if already exist |
864 for ( TInt i = iIgnorePaths.Count(); --i >= 0; ) |
861 const TInt ret = iIgnorePaths.FindInOrder(&status.iFileName, |
865 { |
862 TLinearOrder<TDesC>(CMdsFileServerPlugin::Compare)); |
866 TDesC* tf = iIgnorePaths[i]; |
863 |
867 if ( MdsUtils::Compare( status.iFileName, *tf ) == 0 ) |
864 if( ret >= 0 ) |
868 { |
865 { |
869 return KErrNone; |
866 return KErrNone; |
870 } |
|
871 } |
867 } |
872 |
868 |
873 WRITELOG1( "CMdsFileServerPlugin::AddIgnorePath() - add path: %S", &status.iFileName ); |
869 WRITELOG1( "CMdsFileServerPlugin::AddIgnorePath() - add path: %S", &status.iFileName ); |
874 HBufC* fn = status.iFileName.Alloc(); |
870 HBufC* fn = status.iFileName.Alloc(); |
875 if ( fn ) |
871 if ( fn ) |
876 { |
872 { |
877 iIgnorePaths.Append( fn ); // ownership is transferred |
873 iIgnorePaths.InsertInOrder(fn, TLinearOrder<TDesC>(CMdsFileServerPlugin::Compare)); |
878 } |
874 } |
879 else |
875 else |
880 { |
876 { |
881 err = KErrNoMemory; |
877 err = KErrNoMemory; |
882 } |
878 } |
894 //----------------------------------------------------------------------------- |
890 //----------------------------------------------------------------------------- |
895 // |
891 // |
896 TInt CMdsFileServerPlugin::RemoveIgnorePath( const CFsPluginConnRequest& aRequest ) |
892 TInt CMdsFileServerPlugin::RemoveIgnorePath( const CFsPluginConnRequest& aRequest ) |
897 { |
893 { |
898 WRITELOG( "CMdsFileServerPlugin::RemoveIgnorePath()" ); |
894 WRITELOG( "CMdsFileServerPlugin::RemoveIgnorePath()" ); |
899 TInt err = KErrNone; |
895 TInt err( KErrNone ); |
900 |
896 |
901 TMdsFSPStatusPckg pckg; |
897 TMdsFSPStatusPckg pckg; |
902 TRAP( err, aRequest.ReadParam1L(pckg) ); |
898 TRAP( err, aRequest.ReadParam1L(pckg) ); |
903 |
899 |
904 if ( err != KErrNone ) |
900 if ( err != KErrNone ) |
908 |
904 |
909 TMdsFSPStatus& status = pckg(); |
905 TMdsFSPStatus& status = pckg(); |
910 |
906 |
911 if ( status.iFileName.Length() > 0 ) |
907 if ( status.iFileName.Length() > 0 ) |
912 { |
908 { |
913 // check if already exist |
909 const TInt ret = iIgnorePaths.FindInOrder(&status.iFileName, |
914 for ( TInt i = iIgnorePaths.Count(); --i >= 0; ) |
910 TLinearOrder<TDesC>(CMdsFileServerPlugin::Compare)); |
915 { |
911 |
916 TDesC* tf = iIgnorePaths[i]; |
912 if( ret >= 0 ) |
917 if ( MdsUtils::Compare(status.iFileName, *tf ) == 0 ) |
913 { |
918 { |
914 WRITELOG1( "CMdsFileServerPlugin::RemoveIgnorePath() - remove path: %S", &status.iFileName ); |
919 WRITELOG1( "CMdsFileServerPlugin::RemoveIgnorePath() - remove path: %S", &status.iFileName ); |
915 delete iIgnorePaths[ret]; |
920 delete tf; |
916 iIgnorePaths[ret] = NULL; |
921 tf = NULL; |
917 iIgnorePaths.Remove( ret ); |
922 iIgnorePaths.Remove( i ); |
918 } |
923 } |
|
924 } |
|
925 iIgnorePaths.Compress(); |
919 iIgnorePaths.Compress(); |
926 } |
920 } |
927 else |
921 else |
928 { |
922 { |
929 err = KErrNotFound; |
923 err = KErrNotFound; |
936 // CheckPath |
930 // CheckPath |
937 //----------------------------------------------------------------------------- |
931 //----------------------------------------------------------------------------- |
938 // |
932 // |
939 TBool CMdsFileServerPlugin::CheckPath( const TDesC& aFilename ) const |
933 TBool CMdsFileServerPlugin::CheckPath( const TDesC& aFilename ) const |
940 { |
934 { |
941 // check if ignored pathlist |
935 // check if ignored pathlist |
942 for ( TInt i = iIgnorePaths.Count(); --i >= 0; ) |
936 #ifdef __WINSCW__ |
|
937 // start checking from beginning of list as if the path is ignored, there |
|
938 // is higher possibility that it is located on beginning side of the list |
|
939 const TInt count( iIgnorePaths.Count() ); |
|
940 for ( TInt i = 0; i < count; i++ ) |
|
941 #else |
|
942 for ( TInt i = iIgnorePaths.Count(); --i >= 0; ) |
|
943 #endif |
943 { |
944 { |
944 TDesC* pathName = iIgnorePaths[i]; |
945 TDesC* pathName = iIgnorePaths[i]; |
945 if ( MdsUtils::Find( aFilename, *pathName ) != KErrNotFound ) |
946 if ( MdsUtils::Find( aFilename, *pathName ) != KErrNotFound ) |
946 { |
947 { |
947 return EFalse; |
948 return EFalse; |
949 } |
950 } |
950 |
951 |
951 // check if notification path |
952 // check if notification path |
952 if ( iPaths.Count() > 0 ) |
953 if ( iPaths.Count() > 0 ) |
953 { |
954 { |
|
955 #ifdef __WINSCW__ |
|
956 // start checking from beginning of list as if the path is supported, there |
|
957 // is higher possibility that it is located on beginning side of the list |
|
958 const TInt count( iPaths.Count() ); |
|
959 for ( TInt i = 0; i < count; i++ ) |
|
960 #else |
954 for ( TInt i = iPaths.Count(); --i >= 0; ) |
961 for ( TInt i = iPaths.Count(); --i >= 0; ) |
|
962 #endif |
955 { |
963 { |
956 TDesC* pathName = iPaths[i]; |
964 TDesC* pathName = iPaths[i]; |
957 if ( MdsUtils::Find( aFilename, *pathName ) != KErrNotFound ) |
965 if ( MdsUtils::Find( aFilename, *pathName ) != KErrNotFound ) |
958 { |
966 { |
959 return ETrue; |
967 return ETrue; |
1040 // |
1048 // |
1041 TBool CMdsFileServerPlugin::CheckHarvesterStatus() |
1049 TBool CMdsFileServerPlugin::CheckHarvesterStatus() |
1042 { |
1050 { |
1043 WRITELOG( "CMdsFileServerPlugin::CheckHarvesterStatus() - begin" ); |
1051 WRITELOG( "CMdsFileServerPlugin::CheckHarvesterStatus() - begin" ); |
1044 |
1052 |
1045 if( iPendingEvents <= KCleanQueueTreshoald ) |
1053 if( iPendingEvents <= KCleanQueueTreshold ) |
1046 { |
1054 { |
1047 WRITELOG( "CMdsFileServerPlugin::CheckHarvesterStatus() - end" ); |
1055 WRITELOG( "CMdsFileServerPlugin::CheckHarvesterStatus() - end" ); |
1048 return ETrue; |
1056 return ETrue; |
1049 } |
1057 } |
1050 |
1058 |
1285 default: |
1293 default: |
1286 break; |
1294 break; |
1287 } |
1295 } |
1288 } |
1296 } |
1289 #endif |
1297 #endif |
|
1298 |
|
1299 TInt CMdsFileServerPlugin::Compare(const TDesC& aFirst, const TDesC& aSecond) |
|
1300 { |
|
1301 return aFirst.CompareF( aSecond ); |
|
1302 } |
|
1303 |