28 #include <nsICategoryManager.h>
29 #include <nsIGenericFactory.h>
30 #include <nsIObserverService.h>
31 #include <nsIStringBundle.h>
33 #include <nsAutoLock.h>
34 #include <nsAutoPtr.h>
35 #include <nsComponentManagerUtils.h>
37 #include <nsServiceManagerUtils.h>
63 #include <sbIPropertyBuilder.h>
75 static PRLogModuleInfo* gPropManLog = nsnull;
78 #define LOG(args) PR_LOG(gPropManLog, PR_LOG_WARN, args)
80 #define __FUNCTION__ __PRETTY_FUNCTION__
84 #if !defined(SB_STRING_BUNDLE_CHROME_URL)
85 #define SB_STRING_BUNDLE_CHROME_URL "chrome://songbird/locale/songbird.properties"
110 : mPropIDsLock(nsnull)
114 gPropManLog = PR_NewLogModule(
"sbPropMan");
118 PRBool success = mPropInfoHashtable.Init(100);
119 NS_ASSERTION(success,
120 "sbPropertyManager::mPropInfoHashtable failed to initialize!");
122 success = mPropDependencyMap.Init(100);
123 NS_ASSERTION(success,
124 "sbPropertyManager::mPropInfoHashtable failed to initialize!");
126 mPropIDsLock = PR_NewLock();
127 NS_ASSERTION(mPropIDsLock,
128 "sbPropertyManager::mPropIDsLock failed to create lock!");
146 NS_ENSURE_SUCCESS(rv, rv);
148 rv = RegisterFilterListPickerProperties();
149 NS_ENSURE_SUCCESS(rv, rv);
151 nsCOMPtr<nsIObserverService> obs =
152 do_GetService(
"@mozilla.org/observer-service;1");
157 nsCOMPtr<nsIObserver> startupNotifier =
158 do_CreateInstance(
"@mozilla.org/embedcomp/appstartup-notifier;1", &rv);
159 NS_ENSURE_SUCCESS(rv, rv);
168 NS_ENSURE_ARG_POINTER(aPropertyIDs);
174 NS_ENSURE_TRUE(*aPropertyIDs, NS_ERROR_OUT_OF_MEMORY);
175 NS_ADDREF(*aPropertyIDs);
180 NS_IMETHODIMP sbPropertyManager::AddPropertyInfo(
sbIPropertyInfo *aPropertyInfo)
182 NS_ENSURE_ARG_POINTER(aPropertyInfo);
186 PRBool success = PR_FALSE;
188 rv = aPropertyInfo->GetId(
id);
189 NS_ENSURE_SUCCESS(rv, rv);
192 NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);
202 NS_IMETHODIMP sbPropertyManager::GetPropertyInfo(
const nsAString & aID,
205 LOG((
"sbPropertyManager::GetPropertyInfo(%s)",
206 NS_LossyConvertUTF16toASCII(aID).
get() ));
208 NS_ENSURE_ARG_POINTER(_retval);
217 nsRefPtr<sbTextPropertyInfo> textProperty;
220 NS_ENSURE_TRUE(textProperty, NS_ERROR_OUT_OF_MEMORY);
222 rv = textProperty->Init();
223 NS_ENSURE_SUCCESS(rv, rv);
225 rv = textProperty->SetId(aID);
226 NS_ENSURE_SUCCESS(rv, rv);
228 nsCOMPtr<sbIPropertyInfo> propInfo = do_QueryInterface(NS_ISUPPORTS_CAST(
sbITextPropertyInfo*, textProperty), &rv);
229 NS_ENSURE_SUCCESS(rv, rv);
231 rv = AddPropertyInfo(propInfo);
232 NS_ENSURE_SUCCESS(rv, rv);
242 return NS_ERROR_NOT_AVAILABLE;
245 NS_IMETHODIMP sbPropertyManager::HasProperty(
const nsAString &aID,
248 NS_ENSURE_ARG_POINTER(_retval);
257 NS_IMETHODIMP sbPropertyManager::CreateBundle(
const char *aURLSpec,
258 nsIStringBundle **_retval)
260 NS_ENSURE_ARG_POINTER(aURLSpec);
261 NS_ENSURE_ARG_POINTER(_retval);
265 nsCOMPtr<nsIStringBundleService> stringBundleService =
266 do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
267 NS_ENSURE_SUCCESS(rv, rv);
269 nsCOMPtr<nsIStringBundle> stringBundle;
270 rv = stringBundleService->CreateBundle(aURLSpec,
271 getter_AddRefs(stringBundle));
272 NS_ENSURE_SUCCESS(rv, rv);
274 *_retval = stringBundle;
280 NS_IMETHODIMP sbPropertyManager::GetStringFromName(nsIStringBundle *aBundle,
281 const nsAString &
aName,
284 NS_ENSURE_ARG_POINTER(aBundle);
287 nsresult rv = aBundle->GetStringFromName(aName.BeginReading(),
288 getter_Copies(value));
289 if (NS_SUCCEEDED(rv)) {
290 _retval.Assign(value);
295 char*
message = PR_smprintf(
"sbPropertyManager: '%s' not found in bundle",
296 NS_LossyConvertUTF16toASCII(aName).
get());
298 PR_smprintf_free(message);
305 NS_IMETHODIMP sbPropertyManager::GetDependentProperties(
const nsAString & aId,
308 NS_ENSURE_ARG_POINTER(_retval);
310 PRBool success = PR_FALSE;
316 nsCOMPtr<sbIMutablePropertyArray> deps;
321 NS_ENSURE_SUCCESS(rv, rv);
322 rv = deps->SetStrict(PR_FALSE);
323 NS_ENSURE_SUCCESS(rv, rv);
326 NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);
330 nsCOMPtr<sbIPropertyInfo> propertyInfo;
331 nsCOMPtr<sbIPropertyArray> secondarySort;
332 nsCOMPtr<sbIPropertyArray> currentDeps;
334 nsString dependentID =
mPropIDs.ElementAt(
i);
335 rv = GetPropertyInfo(dependentID, getter_AddRefs(propertyInfo));
336 NS_ENSURE_SUCCESS(rv, rv);
338 secondarySort = nsnull;
339 rv = propertyInfo->GetSecondarySort(getter_AddRefs(secondarySort));
341 if (NS_SUCCEEDED(rv) && secondarySort) {
342 PRUint32 propertyCount;
343 rv = secondarySort->GetLength(&propertyCount);
344 NS_ENSURE_SUCCESS(rv, rv);
347 for (PRUint32 j=0; j < propertyCount; j++) {
348 nsCOMPtr<sbIProperty> property;
349 rv = secondarySort->GetPropertyAt(j, getter_AddRefs(property));
350 NS_ENSURE_SUCCESS(rv, rv);
352 rv =
property->GetId(propertyID);
353 NS_ENSURE_SUCCESS(rv, rv);
356 NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
357 deps = do_QueryInterface(currentDeps, &rv);
358 NS_ENSURE_SUCCESS(rv, rv);
360 rv = deps->AppendProperty(dependentID, EmptyString());
361 NS_ENSURE_SUCCESS(rv, rv);
369 NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
380 nsCOMPtr<nsIStringBundle> stringBundle;
382 NS_ENSURE_SUCCESS(rv, rv);
386 NS_LITERAL_STRING(
"property.ordinal"),
387 stringBundle, PR_TRUE, PR_FALSE, 0, PR_FALSE, 0, PR_FALSE,
388 PR_FALSE, PR_FALSE, NULL);
389 NS_ENSURE_SUCCESS(rv, rv);
393 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
395 NS_ENSURE_SUCCESS(rv, rv);
399 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
401 NS_ENSURE_SUCCESS(rv, rv);
405 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
407 NS_ENSURE_SUCCESS(rv, rv);
411 stringBundle, PR_FALSE, PR_FALSE, 0, PR_FALSE,
412 0, PR_FALSE, PR_TRUE, PR_FALSE, nsnull);
413 NS_ENSURE_SUCCESS(rv, rv);
417 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE,
419 NS_ENSURE_SUCCESS(rv, rv);
423 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, PR_FALSE);
424 NS_ENSURE_SUCCESS(rv, rv);
428 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, PR_FALSE);
429 NS_ENSURE_SUCCESS(rv, rv);
433 EmptyString(), stringBundle, PR_FALSE, PR_FALSE,
435 NS_ENSURE_SUCCESS(rv, rv);
439 NS_LITERAL_STRING(
"property.date_created"),
446 NS_ENSURE_SUCCESS(rv, rv);
450 NS_LITERAL_STRING(
"property.date_updated"),
457 NS_ENSURE_SUCCESS(rv, rv);
461 NS_LITERAL_STRING(
"property.content_url"),
466 NS_ENSURE_SUCCESS(rv, rv);
471 NS_LITERAL_STRING(
"property.content_type"),
473 NS_ENSURE_SUCCESS(rv, rv);
478 nsCOMPtr<sbIPropertyInfo> contentTypePropInfo;
480 getter_AddRefs(contentTypePropInfo));
481 NS_ENSURE_SUCCESS(rv, rv);
483 rv = contentTypePropInfo->SetUsedInIdentity(PR_TRUE);
484 NS_ENSURE_SUCCESS(rv, rv);
488 NS_LITERAL_STRING(
"property.content_length"),
497 NS_ENSURE_SUCCESS(rv, rv);
501 NS_LITERAL_STRING(
"property.content_hash"),
508 NS_ENSURE_SUCCESS(rv, rv);
512 NS_LITERAL_STRING(
"property.metadata_hash_identity"),
519 NS_ENSURE_SUCCESS(rv, rv);
523 NS_LITERAL_STRING(
"property.track_name"),
524 stringBundle, PR_TRUE, PR_TRUE,
527 PR_TRUE, PR_TRUE, PR_FALSE);
528 NS_ENSURE_SUCCESS(rv, rv);
531 nsCOMPtr<sbIMutablePropertyArray> albumSecondarySort =
533 NS_ENSURE_SUCCESS(rv, rv);
535 rv = albumSecondarySort->SetStrict(PR_FALSE);
536 NS_ENSURE_SUCCESS(rv, rv);
539 rv = albumSecondarySort->AppendProperty(
541 NS_LITERAL_STRING(
"a"));
542 NS_ENSURE_SUCCESS(rv, rv);
544 rv = albumSecondarySort->AppendProperty(
546 NS_LITERAL_STRING(
"a"));
547 NS_ENSURE_SUCCESS(rv, rv);
549 rv = albumSecondarySort->AppendProperty(
551 NS_LITERAL_STRING(
"a"));
552 NS_ENSURE_SUCCESS(rv, rv);
555 NS_LITERAL_STRING(
"property.album_name"),
556 stringBundle, PR_TRUE, PR_TRUE,
559 PR_TRUE, PR_TRUE, PR_FALSE, albumSecondarySort);
560 NS_ENSURE_SUCCESS(rv, rv);
563 nsCOMPtr<sbIMutablePropertyArray> artistSecondarySort =
565 NS_ENSURE_SUCCESS(rv, rv);
567 rv = artistSecondarySort->SetStrict(PR_FALSE);
568 NS_ENSURE_SUCCESS(rv, rv);
571 rv = artistSecondarySort->AppendProperty(
573 NS_LITERAL_STRING(
"a"));
574 NS_ENSURE_SUCCESS(rv, rv);
576 rv = artistSecondarySort->AppendProperty(
578 NS_LITERAL_STRING(
"a"));
579 NS_ENSURE_SUCCESS(rv, rv);
581 rv = artistSecondarySort->AppendProperty(
583 NS_LITERAL_STRING(
"a"));
584 NS_ENSURE_SUCCESS(rv, rv);
586 rv = artistSecondarySort->AppendProperty(
588 NS_LITERAL_STRING(
"a"));
589 NS_ENSURE_SUCCESS(rv, rv);
592 NS_LITERAL_STRING(
"property.artist_name"),
593 stringBundle, PR_TRUE, PR_TRUE,
596 PR_TRUE, PR_TRUE, PR_FALSE, artistSecondarySort);
597 NS_ENSURE_SUCCESS(rv, rv);
601 NS_LITERAL_STRING(
"property.track_source"),
602 stringBundle, PR_TRUE, PR_TRUE,
603 PR_TRUE, PR_TRUE, nsString());
604 NS_ENSURE_SUCCESS(rv, rv);
608 NS_LITERAL_STRING(
"property.duration"),
609 stringBundle, PR_TRUE, PR_FALSE, PR_TRUE, PR_TRUE);
610 NS_ENSURE_SUCCESS(rv, rv);
614 nsCOMPtr<sbIMutablePropertyArray> genreSecondarySort =
616 NS_ENSURE_SUCCESS(rv, rv);
618 rv = genreSecondarySort->SetStrict(PR_FALSE);
619 NS_ENSURE_SUCCESS(rv, rv);
622 rv = genreSecondarySort->AppendProperty(
624 NS_LITERAL_STRING(
"a"));
625 NS_ENSURE_SUCCESS(rv, rv);
627 rv = genreSecondarySort->AppendProperty(
629 NS_LITERAL_STRING(
"a"));
630 NS_ENSURE_SUCCESS(rv, rv);
632 rv = genreSecondarySort->AppendProperty(
634 NS_LITERAL_STRING(
"a"));
635 NS_ENSURE_SUCCESS(rv, rv);
637 rv = genreSecondarySort->AppendProperty(
639 NS_LITERAL_STRING(
"a"));
640 NS_ENSURE_SUCCESS(rv, rv);
642 rv = genreSecondarySort->AppendProperty(
644 NS_LITERAL_STRING(
"a"));
645 NS_ENSURE_SUCCESS(rv, rv);
648 NS_LITERAL_STRING(
"property.genre"),
649 stringBundle, PR_TRUE, PR_TRUE,
652 PR_TRUE, PR_TRUE, PR_FALSE, genreSecondarySort);
653 NS_ENSURE_SUCCESS(rv, rv);
657 nsCOMPtr<sbIMutablePropertyArray> yearSecondarySort =
659 NS_ENSURE_SUCCESS(rv, rv);
661 rv = yearSecondarySort->SetStrict(PR_FALSE);
662 NS_ENSURE_SUCCESS(rv, rv);
666 rv = yearSecondarySort->AppendProperty(
668 NS_LITERAL_STRING(
"a"));
669 NS_ENSURE_SUCCESS(rv, rv);
671 rv = yearSecondarySort->AppendProperty(
673 NS_LITERAL_STRING(
"a"));
674 NS_ENSURE_SUCCESS(rv, rv);
676 rv = yearSecondarySort->AppendProperty(
678 NS_LITERAL_STRING(
"a"));
679 NS_ENSURE_SUCCESS(rv, rv);
681 rv = yearSecondarySort->AppendProperty(
683 NS_LITERAL_STRING(
"a"));
684 NS_ENSURE_SUCCESS(rv, rv);
686 rv = yearSecondarySort->AppendProperty(
688 NS_LITERAL_STRING(
"a"));
689 NS_ENSURE_SUCCESS(rv, rv);
692 NS_LITERAL_STRING(
"property.year"),
693 stringBundle, PR_TRUE, PR_TRUE, 0, PR_FALSE, 9999, PR_TRUE,
694 PR_TRUE, PR_TRUE, NULL, yearSecondarySort);
695 NS_ENSURE_SUCCESS(rv, rv);
698 nsCOMPtr<sbIMutablePropertyArray> trackSecondarySort =
700 NS_ENSURE_SUCCESS(rv, rv);
702 rv = trackSecondarySort->SetStrict(PR_FALSE);
703 NS_ENSURE_SUCCESS(rv, rv);
706 rv = trackSecondarySort->AppendProperty(
708 NS_LITERAL_STRING(
"a"));
709 NS_ENSURE_SUCCESS(rv, rv);
711 rv = trackSecondarySort->AppendProperty(
713 NS_LITERAL_STRING(
"a"));
714 NS_ENSURE_SUCCESS(rv, rv);
716 rv = trackSecondarySort->AppendProperty(
718 NS_LITERAL_STRING(
"a"));
719 NS_ENSURE_SUCCESS(rv, rv);
722 NS_LITERAL_STRING(
"property.track_no"),
723 stringBundle, PR_TRUE, PR_TRUE, 1, PR_TRUE, 9999, PR_TRUE,
724 PR_TRUE, PR_TRUE, NULL, trackSecondarySort);
725 NS_ENSURE_SUCCESS(rv, rv);
728 nsCOMPtr<sbIMutablePropertyArray> discSecondarySort =
730 NS_ENSURE_SUCCESS(rv, rv);
732 rv = discSecondarySort->SetStrict(PR_FALSE);
733 NS_ENSURE_SUCCESS(rv, rv);
736 rv = discSecondarySort->AppendProperty(
738 NS_LITERAL_STRING(
"a"));
739 NS_ENSURE_SUCCESS(rv, rv);
741 rv = discSecondarySort->AppendProperty(
743 NS_LITERAL_STRING(
"a"));
744 NS_ENSURE_SUCCESS(rv, rv);
746 rv = discSecondarySort->AppendProperty(
748 NS_LITERAL_STRING(
"a"));
749 NS_ENSURE_SUCCESS(rv, rv);
751 rv = discSecondarySort->AppendProperty(
753 NS_LITERAL_STRING(
"a"));
754 NS_ENSURE_SUCCESS(rv, rv);
757 NS_LITERAL_STRING(
"property.disc_no"),
758 stringBundle, PR_TRUE, PR_TRUE, 1, PR_TRUE, 999, PR_TRUE,
759 PR_TRUE, PR_TRUE, NULL, discSecondarySort);
760 NS_ENSURE_SUCCESS(rv, rv);
764 NS_LITERAL_STRING(
"property.total_discs"),
765 stringBundle, PR_FALSE, PR_TRUE, 1, PR_TRUE, 999, PR_TRUE,
766 PR_TRUE, PR_TRUE, NULL);
767 NS_ENSURE_SUCCESS(rv, rv);
771 NS_LITERAL_STRING(
"property.total_tracks"),
772 stringBundle, PR_FALSE, PR_TRUE, 1, PR_TRUE, 9999, PR_TRUE,
773 PR_TRUE, PR_TRUE, NULL);
774 NS_ENSURE_SUCCESS(rv, rv);
778 NS_LITERAL_STRING(
"property.is_part_of_compilation"),
779 stringBundle, PR_FALSE, PR_TRUE,
781 NS_ENSURE_SUCCESS(rv, rv);
785 NS_LITERAL_STRING(
"property.producer"),
786 stringBundle, PR_FALSE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
787 PR_TRUE, PR_TRUE, PR_FALSE);
788 NS_ENSURE_SUCCESS(rv, rv);
792 NS_LITERAL_STRING(
"property.composer"),
793 stringBundle, PR_TRUE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
794 PR_TRUE, PR_TRUE, PR_FALSE);
795 NS_ENSURE_SUCCESS(rv, rv);
799 NS_LITERAL_STRING(
"property.conductor"),
800 stringBundle, PR_FALSE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
801 PR_TRUE, PR_TRUE, PR_FALSE);
802 NS_ENSURE_SUCCESS(rv, rv);
806 NS_LITERAL_STRING(
"property.lyricist"),
807 stringBundle, PR_FALSE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
808 PR_TRUE, PR_TRUE, PR_FALSE);
809 NS_ENSURE_SUCCESS(rv, rv);
813 NS_LITERAL_STRING(
"property.lyrics"),
814 stringBundle, PR_FALSE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
815 PR_TRUE, PR_TRUE, PR_FALSE);
816 NS_ENSURE_SUCCESS(rv, rv);
820 NS_LITERAL_STRING(
"property.record_label_name"),
821 stringBundle, PR_FALSE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
822 PR_TRUE, PR_TRUE, PR_FALSE);
823 NS_ENSURE_SUCCESS(rv, rv);
828 NS_LITERAL_STRING(
"property.primary_image_url"),
829 stringBundle, PR_FALSE, PR_TRUE, PR_TRUE, PR_TRUE);
830 NS_ENSURE_SUCCESS(rv, rv);
834 NS_LITERAL_STRING(
"property.last_play_time"),
836 stringBundle, PR_TRUE, PR_FALSE, PR_TRUE, PR_FALSE);
837 NS_ENSURE_SUCCESS(rv, rv);
841 NS_LITERAL_STRING(
"property.play_count"),
842 stringBundle, PR_TRUE, PR_FALSE, 0, PR_FALSE, 0, PR_FALSE,
843 PR_TRUE, PR_FALSE, NULL);
844 NS_ENSURE_SUCCESS(rv, rv);
849 stringBundle, PR_FALSE, PR_FALSE, 0, PR_FALSE, 0, PR_FALSE,
850 PR_FALSE, PR_FALSE, NULL);
851 NS_ENSURE_SUCCESS(rv, rv);
855 NS_LITERAL_STRING(
"property.last_skip_time"),
857 stringBundle, PR_TRUE, PR_FALSE, PR_TRUE, PR_FALSE);
858 NS_ENSURE_SUCCESS(rv, rv);
862 NS_LITERAL_STRING(
"property.skip_count"),
863 stringBundle, PR_TRUE, PR_FALSE, 0, PR_FALSE, 0, PR_FALSE,
864 PR_TRUE, PR_FALSE, NULL);
865 NS_ENSURE_SUCCESS(rv, rv);
876 NS_ENSURE_SUCCESS(rv, rv);
880 NS_LITERAL_STRING(
"property.bitrate"),
881 stringBundle, PR_TRUE, PR_FALSE, 0, PR_FALSE, 0, PR_FALSE,
883 NS_ENSURE_SUCCESS(rv, rv);
887 NS_LITERAL_STRING(
"property.channels"),
888 stringBundle, PR_TRUE, PR_FALSE, 0, PR_FALSE, 0, PR_FALSE,
889 PR_TRUE, PR_TRUE, NULL);
890 NS_ENSURE_SUCCESS(rv, rv);
894 NS_LITERAL_STRING(
"property.samplerate"),
895 stringBundle, PR_TRUE, PR_FALSE, 0, PR_FALSE, 0, PR_FALSE,
897 NS_ENSURE_SUCCESS(rv, rv);
901 NS_LITERAL_STRING(
"property.bpm"),
902 stringBundle, PR_TRUE, PR_FALSE, 0, PR_FALSE, 999, PR_TRUE,
903 PR_TRUE, PR_TRUE, NULL);
904 NS_ENSURE_SUCCESS(rv, rv);
908 NS_LITERAL_STRING(
"property.key"),
909 stringBundle, PR_FALSE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
910 PR_TRUE, PR_TRUE, PR_FALSE);
911 NS_ENSURE_SUCCESS(rv, rv);
915 NS_LITERAL_STRING(
"property.language"),
916 stringBundle, PR_FALSE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
917 PR_TRUE, PR_TRUE, PR_FALSE);
918 NS_ENSURE_SUCCESS(rv, rv);
922 NS_LITERAL_STRING(
"property.comment"),
923 stringBundle, PR_TRUE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
924 PR_TRUE, PR_TRUE, PR_FALSE);
925 NS_ENSURE_SUCCESS(rv, rv);
929 NS_LITERAL_STRING(
"property.copyright"),
930 stringBundle, PR_FALSE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
931 PR_TRUE, PR_TRUE, PR_FALSE);
932 NS_ENSURE_SUCCESS(rv, rv);
936 NS_LITERAL_STRING(
"property.copyright_url"),
937 stringBundle, PR_FALSE, PR_FALSE, PR_TRUE, PR_FALSE);
938 NS_ENSURE_SUCCESS(rv, rv);
942 NS_LITERAL_STRING(
"property.subtitle"),
943 stringBundle, PR_FALSE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
944 PR_TRUE, PR_TRUE, PR_FALSE);
945 NS_ENSURE_SUCCESS(rv, rv);
949 NS_LITERAL_STRING(
"property.metadata_uuid"),
950 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
952 NS_ENSURE_SUCCESS(rv, rv);
956 NS_LITERAL_STRING(
"property.vendor"),
957 stringBundle, PR_FALSE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
958 PR_TRUE, PR_TRUE, PR_FALSE);
959 NS_ENSURE_SUCCESS(rv, rv);
963 NS_LITERAL_STRING(
"property.origin_url"),
964 stringBundle, PR_FALSE, PR_FALSE, PR_TRUE, PR_FALSE);
965 NS_ENSURE_SUCCESS(rv, rv);
969 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
971 NS_ENSURE_SUCCESS(rv, rv);
975 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
977 NS_ENSURE_SUCCESS(rv, rv);
981 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
983 NS_ENSURE_SUCCESS(rv, rv);
987 NS_LITERAL_STRING(
"property.destination"),
988 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, PR_FALSE);
989 NS_ENSURE_SUCCESS(rv, rv);
994 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE,
995 0, PR_TRUE, PR_TRUE, PR_FALSE);
996 NS_ENSURE_SUCCESS(rv, rv);
1000 NS_LITERAL_STRING(
"property.hidden"),
1001 stringBundle, PR_FALSE, PR_FALSE,
1003 NS_ENSURE_SUCCESS(rv, rv);
1007 NS_LITERAL_STRING(
"property.column_spec"),
1008 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1010 NS_ENSURE_SUCCESS(rv, rv);
1014 NS_LITERAL_STRING(
"property.default_column_spec"),
1015 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1017 NS_ENSURE_SUCCESS(rv, rv);
1021 NS_LITERAL_STRING(
"property.origin_page"),
1022 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1023 PR_TRUE, PR_FALSE, PR_FALSE);
1024 NS_ENSURE_SUCCESS(rv, rv);
1028 NS_LITERAL_STRING(
"property.artist_detail_url"),
1029 stringBundle, PR_FALSE, PR_TRUE, PR_TRUE, PR_TRUE);
1030 NS_ENSURE_SUCCESS(rv, rv);
1034 NS_LITERAL_STRING(
"property.album_detail_url"),
1035 stringBundle, PR_FALSE, PR_TRUE, PR_TRUE, PR_TRUE);
1036 NS_ENSURE_SUCCESS(rv, rv);
1040 NS_LITERAL_STRING(
"property.origin_pagetitle"),
1041 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1042 PR_TRUE, PR_FALSE, PR_FALSE);
1043 NS_ENSURE_SUCCESS(rv, rv);
1047 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1048 PR_TRUE, PR_FALSE, PR_FALSE);
1049 NS_ENSURE_SUCCESS(rv, rv);
1053 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, PR_FALSE);
1054 NS_ENSURE_SUCCESS(rv, rv);
1057 nsRefPtr<sbDownloadButtonPropertyBuilder> dbBuilder =
1059 NS_ENSURE_TRUE(dbBuilder, NS_ERROR_OUT_OF_MEMORY);
1061 rv = dbBuilder->Init();
1062 NS_ENSURE_SUCCESS(rv, rv);
1064 dbBuilder->SetUserViewable(PR_FALSE);
1066 rv = dbBuilder->SetRemoteReadable(PR_TRUE);
1067 NS_ENSURE_SUCCESS(rv, rv);
1069 rv = dbBuilder->SetRemoteWritable(PR_TRUE);
1070 NS_ENSURE_SUCCESS(rv, rv);
1072 nsCOMPtr<sbIPropertyInfo> propertyInfo;
1073 rv = dbBuilder->Get(getter_AddRefs(propertyInfo));
1074 NS_ENSURE_SUCCESS(rv, rv);
1076 rv = AddPropertyInfo(propertyInfo);
1077 NS_ENSURE_SUCCESS(rv, rv);
1081 NS_LITERAL_STRING(
"property.download_details"),
1082 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1083 PR_TRUE, PR_TRUE, PR_FALSE);
1084 NS_ENSURE_SUCCESS(rv, rv);
1088 NS_ENSURE_TRUE(rBuilder, NS_ERROR_OUT_OF_MEMORY);
1090 rv = rBuilder->Init();
1091 NS_ENSURE_SUCCESS(rv, rv);
1093 rBuilder->SetUserViewable(PR_TRUE);
1096 NS_ENSURE_SUCCESS(rv, rv);
1098 rv = rBuilder->SetDisplayNameKey(NS_LITERAL_STRING(
"property.rating"));
1099 NS_ENSURE_SUCCESS(rv, rv);
1101 rv = rBuilder->SetRemoteReadable(PR_TRUE);
1102 NS_ENSURE_SUCCESS(rv, rv);
1104 rv = rBuilder->SetRemoteWritable(PR_TRUE);
1105 NS_ENSURE_SUCCESS(rv, rv);
1107 rv = rBuilder->Get(getter_AddRefs(propertyInfo));
1108 NS_ENSURE_SUCCESS(rv, rv);
1110 rv = AddPropertyInfo(propertyInfo);
1111 NS_ENSURE_SUCCESS(rv, rv);
1114 nsRefPtr<sbStatusPropertyBuilder> statusBuilder =
1116 NS_ENSURE_TRUE(statusBuilder, NS_ERROR_OUT_OF_MEMORY);
1118 rv = statusBuilder->Init();
1119 NS_ENSURE_SUCCESS(rv, rv);
1121 statusBuilder->SetUserViewable(PR_FALSE);
1124 NS_ENSURE_SUCCESS(rv, rv);
1126 rv = statusBuilder->SetDisplayNameKey(NS_LITERAL_STRING(
"property.cdrip_status"));
1127 NS_ENSURE_SUCCESS(rv, rv);
1129 rv = statusBuilder->SetLabelKey(NS_LITERAL_STRING(
"property.cdrip_status"));
1130 NS_ENSURE_SUCCESS(rv, rv);
1132 rv = statusBuilder->SetCompletedLabelKey(NS_LITERAL_STRING(
"property.cdrip_completed"));
1133 NS_ENSURE_SUCCESS(rv, rv);
1135 rv = statusBuilder->SetFailedLabelKey(NS_LITERAL_STRING(
"property.cdrip_failed"));
1136 NS_ENSURE_SUCCESS(rv, rv);
1138 rv = statusBuilder->SetRemoteReadable(PR_TRUE);
1139 NS_ENSURE_SUCCESS(rv, rv);
1141 rv = statusBuilder->SetRemoteWritable(PR_TRUE);
1142 NS_ENSURE_SUCCESS(rv, rv);
1144 rv = statusBuilder->Get(getter_AddRefs(propertyInfo));
1145 NS_ENSURE_SUCCESS(rv, rv);
1147 rv = AddPropertyInfo(propertyInfo);
1148 NS_ENSURE_SUCCESS(rv, rv);
1161 NS_ENSURE_SUCCESS(rv, rv);
1165 NS_ENSURE_TRUE(iBuilder, NS_ERROR_OUT_OF_MEMORY);
1167 rv = iBuilder->Init();
1168 NS_ENSURE_SUCCESS(rv, rv);
1170 iBuilder->SetUserViewable(PR_FALSE);
1173 NS_ENSURE_SUCCESS(rv, rv);
1175 rv = iBuilder->SetDisplayNameKey(NS_LITERAL_STRING(
"property.origin_page_image"));
1176 NS_ENSURE_SUCCESS(rv, rv);
1178 rv = iBuilder->SetRemoteReadable(PR_TRUE);
1179 NS_ENSURE_SUCCESS(rv, rv);
1181 rv = iBuilder->SetRemoteWritable(PR_TRUE);
1182 NS_ENSURE_SUCCESS(rv, rv);
1184 rv = iBuilder->SetUserEditable(PR_FALSE);
1185 NS_ENSURE_SUCCESS(rv, rv);
1187 rv = iBuilder->Get(getter_AddRefs(propertyInfo));
1188 NS_ENSURE_SUCCESS(rv, rv);
1190 rv = AddPropertyInfo(propertyInfo);
1191 NS_ENSURE_SUCCESS(rv, rv);
1195 NS_LITERAL_STRING(
"property.artist_detail_image"),
1197 PR_FALSE, PR_TRUE, PR_TRUE, PR_TRUE,
1202 NS_LITERAL_STRING(
"property.album_detail_image"),
1204 PR_FALSE, PR_TRUE, PR_TRUE, PR_TRUE,
1209 NS_LITERAL_STRING(
"property.rapi_scope_url"),
1210 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, PR_FALSE);
1211 NS_ENSURE_SUCCESS(rv, rv);
1215 NS_LITERAL_STRING(
"property.rapi_site_id"),
1216 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1218 NS_ENSURE_SUCCESS(rv, rv);
1222 NS_LITERAL_STRING(
"property.media_list_name"),
1223 stringBundle, PR_FALSE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
1224 PR_TRUE, PR_TRUE, PR_FALSE);
1225 NS_ENSURE_SUCCESS(rv, rv);
1230 stringBundle, PR_FALSE, PR_FALSE,
1232 NS_ENSURE_SUCCESS(rv, rv);
1237 stringBundle, PR_FALSE, PR_FALSE,
1239 NS_ENSURE_SUCCESS(rv, rv);
1243 EmptyString(), stringBundle, PR_FALSE, PR_FALSE,
1245 NS_ENSURE_SUCCESS(rv, rv);
1250 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1251 PR_FALSE, PR_FALSE);
1252 NS_ENSURE_SUCCESS(rv, rv);
1256 NS_LITERAL_STRING(
"property.default_mediapage_url"),
1260 PR_FALSE, PR_FALSE);
1261 NS_ENSURE_SUCCESS(rv, rv);
1265 NS_LITERAL_STRING(
"property.availability"),
1268 0, PR_FALSE, 0, PR_FALSE,
1269 PR_FALSE, PR_FALSE, NULL);
1273 nsCOMPtr<sbIMutablePropertyArray> albumArtistSecondarySort =
1275 NS_ENSURE_SUCCESS(rv, rv);
1277 rv = albumArtistSecondarySort->SetStrict(PR_FALSE);
1278 NS_ENSURE_SUCCESS(rv, rv);
1281 rv = albumArtistSecondarySort->AppendProperty(
1283 NS_LITERAL_STRING(
"a"));
1284 NS_ENSURE_SUCCESS(rv, rv);
1286 rv = albumArtistSecondarySort->AppendProperty(
1288 NS_LITERAL_STRING(
"a"));
1289 NS_ENSURE_SUCCESS(rv, rv);
1291 rv = albumArtistSecondarySort->AppendProperty(
1293 NS_LITERAL_STRING(
"a"));
1294 NS_ENSURE_SUCCESS(rv, rv);
1296 rv = albumArtistSecondarySort->AppendProperty(
1298 NS_LITERAL_STRING(
"a"));
1299 NS_ENSURE_SUCCESS(rv, rv);
1302 NS_LITERAL_STRING(
"property.albumartistname"),
1303 stringBundle, PR_TRUE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
1304 PR_TRUE, PR_TRUE, PR_FALSE, albumArtistSecondarySort);
1305 NS_ENSURE_SUCCESS(rv, rv);
1310 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1311 PR_FALSE, PR_FALSE);
1312 NS_ENSURE_SUCCESS(rv, rv);
1317 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1318 PR_FALSE, PR_FALSE);
1319 NS_ENSURE_SUCCESS(rv, rv);
1324 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1325 PR_FALSE, PR_FALSE);
1326 NS_ENSURE_SUCCESS(rv, rv);
1332 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, PR_FALSE);
1333 NS_ENSURE_SUCCESS(rv, rv);
1338 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE, PR_FALSE,
1340 NS_ENSURE_SUCCESS(rv, rv);
1345 NS_LITERAL_STRING(
"property.dummy.playlist"),
1347 NS_ENSURE_SUCCESS(rv, rv);
1351 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, PR_FALSE);
1352 NS_ENSURE_SUCCESS(rv, rv);
1357 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1358 PR_FALSE, PR_FALSE);
1359 NS_ENSURE_SUCCESS(rv, rv);
1364 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1365 PR_FALSE, PR_FALSE);
1366 NS_ENSURE_SUCCESS(rv, rv);
1371 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1373 NS_ENSURE_SUCCESS(rv, rv);
1378 stringBundle, PR_FALSE, PR_FALSE, PR_FALSE, 0, PR_FALSE,
1380 NS_ENSURE_SUCCESS(rv, rv);
1384 NS_LITERAL_STRING(
"property.shouldrip"),
1386 PR_FALSE, PR_TRUE, PR_FALSE, PR_FALSE, PR_FALSE);
1387 NS_ENSURE_SUCCESS(rv, rv);
1391 EmptyString(), stringBundle, PR_FALSE, PR_FALSE,
1392 PR_FALSE, PR_FALSE);
1393 NS_ENSURE_SUCCESS(rv, rv);
1404 NS_ENSURE_SUCCESS(rv, rv);
1408 NS_LITERAL_STRING(
"property.keywords"),
1409 stringBundle, PR_TRUE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
1410 PR_TRUE, PR_TRUE, PR_FALSE);
1411 NS_ENSURE_SUCCESS(rv, rv);
1414 NS_LITERAL_STRING(
"property.description"),
1415 stringBundle, PR_TRUE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
1416 PR_TRUE, PR_TRUE, PR_FALSE);
1417 NS_ENSURE_SUCCESS(rv, rv);
1420 NS_LITERAL_STRING(
"property.showName"),
1421 stringBundle, PR_TRUE, PR_TRUE, PR_FALSE, 0, PR_FALSE,
1422 PR_TRUE, PR_TRUE, PR_FALSE);
1423 NS_ENSURE_SUCCESS(rv, rv);
1426 NS_LITERAL_STRING(
"property.episodeNumber"),
1427 stringBundle, PR_TRUE, PR_TRUE, 1, PR_TRUE, 0,
1428 PR_FALSE, PR_TRUE, PR_TRUE, nsnull);
1429 NS_ENSURE_SUCCESS(rv, rv);
1432 NS_LITERAL_STRING(
"property.seasonNumber"),
1433 stringBundle, PR_TRUE, PR_TRUE, 1, PR_TRUE, 0,
1434 PR_FALSE, PR_TRUE, PR_TRUE, nsnull);
1435 NS_ENSURE_SUCCESS(rv, rv);
1439 NS_LITERAL_STRING(
"property.playlist_url"),
1443 PR_FALSE, PR_FALSE);
1444 NS_ENSURE_SUCCESS(rv, rv);
1447 rv = RegisterBoolean
1455 NS_ENSURE_SUCCESS(rv, rv);
1461 sbPropertyManager::RegisterFilterListPickerProperties()
1465 nsCOMPtr<nsICategoryManager>
cm =
1466 do_GetService(
"@mozilla.org/categorymanager;1", &rv);
1467 NS_ENSURE_SUCCESS(rv, rv);
1471 rv = cm->AddCategoryEntry(
"filter-list-picker-properties",
1477 NS_ENSURE_SUCCESS(rv, rv);
1484 sbPropertyManager::RegisterBlob(
const nsAString& aPropertyID,
1485 const nsAString& aDisplayKey,
1486 nsIStringBundle* aStringBundle,
1487 PRBool aUserViewable,
1488 PRBool aUserEditable,
1489 PRBool aUsedInIdentity,
1491 PRBool aHasNullSort,
1492 PRBool aRemoteReadable,
1493 PRBool aRemoteWritable)
1495 NS_ASSERTION(aStringBundle,
"aStringBundle is null");
1498 NS_ENSURE_TRUE(blobProperty, NS_ERROR_OUT_OF_MEMORY);
1500 nsresult rv = blobProperty->Init();
1501 NS_ENSURE_SUCCESS(rv, rv);
1503 rv = blobProperty->SetId(aPropertyID);
1504 NS_ENSURE_SUCCESS(rv, rv);
1506 if (!aDisplayKey.IsEmpty()) {
1507 nsAutoString displayValue;
1508 rv = GetStringFromName(aStringBundle, aDisplayKey, displayValue);
1509 if(NS_SUCCEEDED(rv)) {
1510 rv = blobProperty->SetDisplayName(displayValue);
1511 NS_ENSURE_SUCCESS(rv, rv);
1514 rv = blobProperty->SetLocalizationKey(aDisplayKey);
1515 NS_ENSURE_SUCCESS(rv, rv);
1519 rv = blobProperty->SetNullSort(aNullSort);
1520 NS_ENSURE_SUCCESS(rv, rv);
1523 rv = blobProperty->SetUserViewable(aUserViewable);
1524 NS_ENSURE_SUCCESS(rv, rv);
1526 rv = blobProperty->SetUserEditable(aUserEditable);
1527 NS_ENSURE_SUCCESS(rv, rv);
1529 rv = blobProperty->SetUsedInIdentity(aUsedInIdentity);
1530 NS_ENSURE_SUCCESS(rv, rv);
1532 nsCOMPtr<sbIPropertyInfo> propInfo =
1533 do_QueryInterface(NS_ISUPPORTS_CAST(
sbIPropertyInfo*, blobProperty), &rv);
1534 NS_ENSURE_SUCCESS(rv, rv);
1536 rv = SetRemoteAccess(propInfo, aRemoteReadable, aRemoteWritable);
1537 NS_ENSURE_SUCCESS(rv, rv);
1539 rv = AddPropertyInfo(propInfo);
1540 NS_ENSURE_SUCCESS(rv, rv);
1546 sbPropertyManager::RegisterText(
const nsAString& aPropertyID,
1547 const nsAString& aDisplayKey,
1548 nsIStringBundle* aStringBundle,
1549 PRBool aUserViewable,
1550 PRBool aUserEditable,
1551 PRBool aUsedInIdentity,
1553 PRBool aHasNullSort,
1554 PRBool aRemoteReadable,
1555 PRBool aRemoteWritable,
1556 PRBool aCompressWhitespace,
1559 NS_ASSERTION(aStringBundle,
"aStringBundle is null");
1562 NS_ENSURE_TRUE(textProperty, NS_ERROR_OUT_OF_MEMORY);
1564 nsresult rv = textProperty->Init();
1565 NS_ENSURE_SUCCESS(rv, rv);
1567 rv = textProperty->SetId(aPropertyID);
1568 NS_ENSURE_SUCCESS(rv, rv);
1570 if (!aDisplayKey.IsEmpty()) {
1571 nsAutoString displayValue;
1572 rv = GetStringFromName(aStringBundle, aDisplayKey, displayValue);
1573 if(NS_SUCCEEDED(rv)) {
1574 rv = textProperty->SetDisplayName(displayValue);
1575 NS_ENSURE_SUCCESS(rv, rv);
1578 rv = textProperty->SetLocalizationKey(aDisplayKey);
1579 NS_ENSURE_SUCCESS(rv, rv);
1583 rv = textProperty->SetNullSort(aNullSort);
1584 NS_ENSURE_SUCCESS(rv, rv);
1587 rv = textProperty->SetUserViewable(aUserViewable);
1588 NS_ENSURE_SUCCESS(rv, rv);
1590 rv = textProperty->SetUserEditable(aUserEditable);
1591 NS_ENSURE_SUCCESS(rv, rv);
1593 rv = textProperty->SetUsedInIdentity(aUsedInIdentity);
1594 NS_ENSURE_SUCCESS(rv, rv);
1596 if (aSecondarySort) {
1597 rv = textProperty->SetSecondarySort(aSecondarySort);
1598 NS_ENSURE_SUCCESS(rv, rv);
1601 if (!aCompressWhitespace) {
1602 rv = textProperty->SetNoCompressWhitespace(!aCompressWhitespace);
1603 NS_ENSURE_SUCCESS(rv, rv);
1606 nsCOMPtr<sbIPropertyInfo> propInfo =
1608 NS_ENSURE_SUCCESS(rv, rv);
1610 rv = SetRemoteAccess(propInfo, aRemoteReadable, aRemoteWritable);
1611 NS_ENSURE_SUCCESS(rv, rv);
1613 rv = AddPropertyInfo(propInfo);
1614 NS_ENSURE_SUCCESS(rv, rv);
1620 sbPropertyManager::RegisterTrackTypeImageLabel(
const nsAString& aPropertyID,
1621 const nsAString& aDisplayKey,
1622 nsIStringBundle* aStringBundle,
1623 PRBool aUserViewable,
1624 PRBool aUserEditable,
1625 PRBool aRemoteReadable,
1626 PRBool aRemoteWritable,
1627 const nsAString& aUrlPropertyID)
1629 NS_ASSERTION(aStringBundle,
"aStringBundle is null");
1632 nsRefPtr<sbTrackTypeImageLabelPropertyInfo> trackTypeProperty(
1634 NS_ENSURE_TRUE(trackTypeProperty, NS_ERROR_OUT_OF_MEMORY);
1636 rv = trackTypeProperty->Init();
1637 NS_ENSURE_SUCCESS(rv, rv);
1639 rv = trackTypeProperty->SetPropertyID(aPropertyID);
1640 NS_ENSURE_SUCCESS(rv, rv);
1642 if (!aDisplayKey.IsEmpty()) {
1643 nsAutoString displayValue;
1644 rv = GetStringFromName(aStringBundle, aDisplayKey, displayValue);
1645 if(NS_SUCCEEDED(rv)) {
1646 rv = trackTypeProperty->SetDisplayName(displayValue);
1647 NS_ENSURE_SUCCESS(rv, rv);
1650 rv = trackTypeProperty->SetLocalizationKey(aDisplayKey);
1651 NS_ENSURE_SUCCESS(rv, rv);
1654 rv = trackTypeProperty->SetUserViewable(aUserViewable);
1655 NS_ENSURE_SUCCESS(rv, rv);
1657 rv = trackTypeProperty->SetUserEditable(aUserEditable);
1658 NS_ENSURE_SUCCESS(rv, rv);
1660 rv = trackTypeProperty->SetRemoteReadable(aRemoteReadable);
1661 NS_ENSURE_SUCCESS(rv, rv);
1663 rv = trackTypeProperty->SetRemoteWritable(aRemoteWritable);
1664 NS_ENSURE_SUCCESS(rv, rv);
1666 rv = AddPropertyInfo(trackTypeProperty);
1667 NS_ENSURE_SUCCESS(rv, rv);
1673 sbPropertyManager::RegisterDateTime(
const nsAString& aPropertyID,
1674 const nsAString& aDisplayKey,
1676 nsIStringBundle* aStringBundle,
1677 PRBool aUserViewable,
1678 PRBool aUserEditable,
1679 PRBool aRemoteReadable,
1680 PRBool aRemoteWritable)
1682 NS_ASSERTION(aStringBundle,
"aStringBundle is null");
1684 nsRefPtr<sbDatetimePropertyInfo>
1686 NS_ENSURE_TRUE(datetimeProperty, NS_ERROR_OUT_OF_MEMORY);
1688 nsresult rv = datetimeProperty->Init();
1689 NS_ENSURE_SUCCESS(rv, rv);
1691 rv = datetimeProperty->SetId(aPropertyID);
1692 NS_ENSURE_SUCCESS(rv, rv);
1694 rv = datetimeProperty->SetTimeType(aType);
1695 NS_ENSURE_SUCCESS(rv, rv);
1697 if (!aDisplayKey.IsEmpty()) {
1698 nsAutoString displayValue;
1699 rv = GetStringFromName(aStringBundle, aDisplayKey, displayValue);
1700 if(NS_SUCCEEDED(rv)) {
1701 rv = datetimeProperty->SetDisplayName(displayValue);
1702 NS_ENSURE_SUCCESS(rv, rv);
1705 rv = datetimeProperty->SetLocalizationKey(aDisplayKey);
1706 NS_ENSURE_SUCCESS(rv, rv);
1709 rv = datetimeProperty->SetUserViewable(aUserViewable);
1710 NS_ENSURE_SUCCESS(rv, rv);
1712 rv = datetimeProperty->SetUserEditable(aUserEditable);
1713 NS_ENSURE_SUCCESS(rv, rv);
1715 nsCOMPtr<sbIPropertyInfo> propInfo =
1717 NS_ENSURE_SUCCESS(rv, rv);
1719 rv = SetRemoteAccess(propInfo, aRemoteReadable, aRemoteWritable);
1720 NS_ENSURE_SUCCESS(rv, rv);
1722 rv = AddPropertyInfo(propInfo);
1723 NS_ENSURE_SUCCESS(rv, rv);
1729 sbPropertyManager::RegisterDuration(
const nsAString& aPropertyID,
1730 const nsAString& aDisplayKey,
1731 nsIStringBundle* aStringBundle,
1732 PRBool aUserViewable,
1733 PRBool aUserEditable,
1734 PRBool aRemoteReadable,
1735 PRBool aRemoteWritable)
1737 NS_ASSERTION(aStringBundle,
"aStringBundle is null");
1739 nsRefPtr<sbDurationPropertyInfo>
1741 NS_ENSURE_TRUE(durationProperty, NS_ERROR_OUT_OF_MEMORY);
1743 nsresult rv = durationProperty->Init();
1744 NS_ENSURE_SUCCESS(rv, rv);
1746 rv = durationProperty->SetId(aPropertyID);
1747 NS_ENSURE_SUCCESS(rv, rv);
1749 if (!aDisplayKey.IsEmpty()) {
1750 nsAutoString displayValue;
1751 rv = GetStringFromName(aStringBundle, aDisplayKey, displayValue);
1752 if(NS_SUCCEEDED(rv)) {
1753 rv = durationProperty->SetDisplayName(displayValue);
1754 NS_ENSURE_SUCCESS(rv, rv);
1757 rv = durationProperty->SetLocalizationKey(aDisplayKey);
1758 NS_ENSURE_SUCCESS(rv, rv);
1761 rv = durationProperty->SetUserViewable(aUserViewable);
1762 NS_ENSURE_SUCCESS(rv, rv);
1764 rv = durationProperty->SetUserEditable(aUserEditable);
1765 NS_ENSURE_SUCCESS(rv, rv);
1768 rv = durationProperty->SetUnitConverter(propConverter);
1769 NS_ENSURE_SUCCESS(rv, rv);
1771 nsCOMPtr<sbIPropertyInfo> propInfo =
1773 NS_ENSURE_SUCCESS(rv, rv);
1775 rv = SetRemoteAccess(propInfo, aRemoteReadable, aRemoteWritable);
1776 NS_ENSURE_SUCCESS(rv, rv);
1778 rv = AddPropertyInfo(propInfo);
1779 NS_ENSURE_SUCCESS(rv, rv);
1785 sbPropertyManager::RegisterURI(
const nsAString& aPropertyID,
1786 const nsAString& aDisplayKey,
1787 nsIStringBundle* aStringBundle,
1788 PRBool aUserViewable,
1789 PRBool aUserEditable,
1790 PRBool aRemoteReadable,
1791 PRBool aRemoteWritable)
1793 NS_ASSERTION(aStringBundle,
"aStringBundle is null");
1796 NS_ENSURE_TRUE(uriProperty, NS_ERROR_OUT_OF_MEMORY);
1798 nsresult rv = uriProperty->Init();
1799 NS_ENSURE_SUCCESS(rv, rv);
1801 rv = uriProperty->SetId(aPropertyID);
1802 NS_ENSURE_SUCCESS(rv, rv);
1804 if (!aDisplayKey.IsEmpty()) {
1805 nsAutoString displayValue;
1806 rv = GetStringFromName(aStringBundle, aDisplayKey, displayValue);
1807 if(NS_SUCCEEDED(rv)) {
1808 rv = uriProperty->SetDisplayName(displayValue);
1809 NS_ENSURE_SUCCESS(rv, rv);
1812 rv = uriProperty->SetLocalizationKey(aDisplayKey);
1813 NS_ENSURE_SUCCESS(rv, rv);
1816 rv = uriProperty->SetUserViewable(aUserViewable);
1817 NS_ENSURE_SUCCESS(rv, rv);
1819 rv = uriProperty->SetUserEditable(aUserEditable);
1820 NS_ENSURE_SUCCESS(rv, rv);
1822 nsCOMPtr<sbIPropertyInfo> propInfo =
1824 NS_ENSURE_SUCCESS(rv, rv);
1826 rv = SetRemoteAccess(propInfo, aRemoteReadable, aRemoteWritable);
1827 NS_ENSURE_SUCCESS(rv, rv);
1829 rv = AddPropertyInfo(propInfo);
1830 NS_ENSURE_SUCCESS(rv, rv);
1836 sbPropertyManager::RegisterImage(
const nsAString& aPropertyID,
1837 const nsAString& aDisplayKey,
1838 nsIStringBundle* aStringBundle,
1839 PRBool aUserViewable,
1840 PRBool aUserEditable,
1841 PRBool aRemoteReadable,
1842 PRBool aRemoteWritable)
1844 NS_ASSERTION(aStringBundle,
"aStringBundle is null");
1848 nsAutoString displayName(aDisplayKey);
1849 if (!aDisplayKey.IsEmpty()) {
1850 rv = GetStringFromName(aStringBundle, aDisplayKey, displayName);
1854 nsRefPtr<sbImagePropertyInfo> imageProperty(
1856 aRemoteReadable, aRemoteWritable, aUserViewable,
1858 NS_ENSURE_TRUE(imageProperty, NS_ERROR_OUT_OF_MEMORY);
1860 rv = AddPropertyInfo(imageProperty);
1861 NS_ENSURE_SUCCESS(rv, rv);
1867 sbPropertyManager::RegisterImageLink(
const nsAString& aPropertyID,
1868 const nsAString& aDisplayKey,
1869 nsIStringBundle* aStringBundle,
1870 PRBool aUserViewable,
1871 PRBool aUserEditable,
1872 PRBool aRemoteReadable,
1873 PRBool aRemoteWritable,
1874 const nsAString& aUrlPropertyID)
1876 NS_ASSERTION(aStringBundle,
"aStringBundle is null");
1880 nsAutoString displayName(aDisplayKey);
1881 if (!aDisplayKey.IsEmpty()) {
1882 rv = GetStringFromName(aStringBundle, aDisplayKey, displayName);
1886 nsRefPtr<sbImageLinkPropertyInfo> imageLinkProperty(
1888 aRemoteReadable, aRemoteWritable, aUserViewable,
1889 aUserEditable, aUrlPropertyID));
1890 NS_ENSURE_TRUE(imageLinkProperty, NS_ERROR_OUT_OF_MEMORY);
1892 rv = AddPropertyInfo(imageLinkProperty);
1893 NS_ENSURE_SUCCESS(rv, rv);
1899 sbPropertyManager::RegisterNumber(
const nsAString& aPropertyID,
1900 const nsAString& aDisplayKey,
1901 nsIStringBundle* aStringBundle,
1902 PRBool aUserViewable,
1903 PRBool aUserEditable,
1905 PRBool aHasMinValue,
1907 PRBool aHasMaxValue,
1908 PRBool aRemoteReadable,
1909 PRBool aRemoteWritable,
1913 NS_ASSERTION(aStringBundle,
"aStringBundle is null");
1916 NS_ENSURE_TRUE(numberProperty, NS_ERROR_OUT_OF_MEMORY);
1918 nsresult rv = numberProperty->Init();
1919 NS_ENSURE_SUCCESS(rv, rv);
1921 rv = numberProperty->SetId(aPropertyID);
1922 NS_ENSURE_SUCCESS(rv, rv);
1925 rv = numberProperty->SetMinValue(aMinValue);
1926 NS_ENSURE_SUCCESS(rv, rv);
1930 rv = numberProperty->SetMaxValue(aMaxValue);
1931 NS_ENSURE_SUCCESS(rv, rv);
1934 if (!aDisplayKey.IsEmpty()) {
1935 nsAutoString displayValue;
1936 rv = GetStringFromName(aStringBundle, aDisplayKey, displayValue);
1937 if(NS_SUCCEEDED(rv)) {
1938 rv = numberProperty->SetDisplayName(displayValue);
1939 NS_ENSURE_SUCCESS(rv, rv);
1942 rv = numberProperty->SetLocalizationKey(aDisplayKey);
1943 NS_ENSURE_SUCCESS(rv, rv);
1946 rv = numberProperty->SetUserViewable(aUserViewable);
1947 NS_ENSURE_SUCCESS(rv, rv);
1949 rv = numberProperty->SetUserEditable(aUserEditable);
1950 NS_ENSURE_SUCCESS(rv, rv);
1952 rv = numberProperty->SetUnitConverter(aUnitConverter);
1953 NS_ENSURE_SUCCESS(rv, rv);
1955 if (aSecondarySort) {
1956 rv = numberProperty->SetSecondarySort(aSecondarySort);
1957 NS_ENSURE_SUCCESS(rv, rv);
1960 nsCOMPtr<sbIPropertyInfo> propInfo =
1962 NS_ENSURE_SUCCESS(rv, rv);
1964 rv = SetRemoteAccess(propInfo, aRemoteReadable, aRemoteWritable);
1965 NS_ENSURE_SUCCESS(rv, rv);
1967 rv = AddPropertyInfo(propInfo);
1968 NS_ENSURE_SUCCESS(rv, rv);
1974 sbPropertyManager::RegisterBoolean(
const nsAString &aPropertyID,
1975 const nsAString &aDisplayKey,
1976 nsIStringBundle* aStringBundle,
1977 PRBool aUserViewable,
1978 PRBool aUserEditable,
1979 PRBool aRemoteReadable,
1980 PRBool aRemoteWritable,
1981 PRBool aShouldSuppress)
1983 LOG((
"sbPropertyManager::RegisterBoolean(%s)",
1984 NS_LossyConvertUTF16toASCII(aPropertyID).
get() ));
1985 NS_ASSERTION(aStringBundle,
"aStringBundle is null");
1988 NS_ENSURE_TRUE(booleanProperty, NS_ERROR_OUT_OF_MEMORY);
1990 nsresult rv = booleanProperty->Init();
1991 NS_ENSURE_SUCCESS(rv, rv);
1993 rv = booleanProperty->SetId(aPropertyID);
1994 NS_ENSURE_SUCCESS(rv, rv);
1996 if (!aDisplayKey.IsEmpty()) {
1997 nsAutoString displayValue;
1998 rv = GetStringFromName(aStringBundle, aDisplayKey, displayValue);
1999 if(NS_SUCCEEDED(rv)) {
2000 rv = booleanProperty->SetDisplayName(displayValue);
2001 NS_ENSURE_SUCCESS(rv, rv);
2004 rv = booleanProperty->SetLocalizationKey(aDisplayKey);
2005 NS_ENSURE_SUCCESS(rv, rv);
2008 rv = booleanProperty->SetUserViewable(aUserViewable);
2009 NS_ENSURE_SUCCESS(rv, rv);
2011 rv = booleanProperty->SetUserEditable(aUserEditable);
2012 NS_ENSURE_SUCCESS(rv, rv);
2014 rv = booleanProperty->SetSuppressSelect(aShouldSuppress);
2015 NS_ENSURE_SUCCESS(rv, rv);
2017 nsCOMPtr<sbIPropertyInfo> propInfo =
2019 NS_ENSURE_SUCCESS(rv, rv);
2021 rv = SetRemoteAccess(propInfo, aRemoteReadable, aRemoteWritable);
2022 NS_ENSURE_SUCCESS(rv, rv);
2024 rv = AddPropertyInfo(propInfo);
2025 NS_ENSURE_SUCCESS(rv, rv);
2032 const nsAString &aPropertyID,
2033 const nsAString &aDisplayKey,
2034 nsIStringBundle* aStringBundle)
2036 nsresult rv = dummyProperty->
Init();
2037 NS_ENSURE_SUCCESS(rv, rv);
2039 rv = dummyProperty->
SetId(aPropertyID);
2040 NS_ENSURE_SUCCESS(rv, rv);
2042 if (!aDisplayKey.IsEmpty()) {
2043 nsAutoString displayValue;
2044 rv = GetStringFromName(aStringBundle, aDisplayKey, displayValue);
2045 if(NS_SUCCEEDED(rv)) {
2047 NS_ENSURE_SUCCESS(rv, rv);
2051 NS_ENSURE_SUCCESS(rv, rv);
2054 nsCOMPtr<sbIPropertyInfo> propInfo = do_QueryInterface(NS_ISUPPORTS_CAST(
sbIDummyPropertyInfo*, dummyProperty), &rv);
2055 NS_ENSURE_SUCCESS(rv, rv);
2057 rv = AddPropertyInfo(propInfo);
2058 NS_ENSURE_SUCCESS(rv, rv);
2065 PRBool aRemoteReadable,
2066 PRBool aRemoteWritable)
2068 nsresult rv =
NS_OK;
2070 rv = aProperty->SetRemoteReadable(aRemoteReadable);
2071 NS_ENSURE_SUCCESS(rv, rv);
2073 rv = aProperty->SetRemoteWritable(aRemoteWritable);
2074 NS_ENSURE_SUCCESS(rv, rv);
#define SB_PROPERTY_TOTALDISCS
#define SB_PROPERTY_IMPORTTYPE
#define SB_PROPERTY_SHOULDRIP
#define SB_PROPERTY_KEYWORDS
#define SB_PROPERTY_CDRIP_STATUS
#define SB_PROPERTY_MEDIALISTNAME
#define SB_PROPERTY_PLAYCOUNT
#define SB_PROPERTY_METADATAUUID
#define SB_PROPERTY_TRACKTYPE
#define SB_PROPERTY_ORIGINLIBRARYGUID
#define SB_PROPERTY_SAMPLERATE
#define SB_PROPERTY_SEASONNUMBER
#define SB_PROPERTY_RAPISITEID
#define SB_PROPERTY_ORIGINURL
#define SB_PROPERTY_LYRICS
The property information specific to date/time fields.
#define SB_PROPERTY_CHANNELS
#define SB_PROPERTY_ALBUMARTISTNAME
#define SB_PROPERTY_ISCONTENTREADONLY
#define SB_PROPERTY_RATING
#define SB_PROPERTY_ISDRMPROTECTED
#define SB_PROPERTY_ORDINAL
The property information specific to URL/URI fields.
NS_IMPL_THREADSAFE_ISUPPORTS1(sbPropertyManager, sbIPropertyManager) sbPropertyManager
#define SB_PROPERTY_CONDUCTORNAME
#define SB_PROPERTY_HIDDEN
#define SB_PROPERTY_MANAGER_READY_CATEGORY
#define SB_PROPERTY_DEVICE_PERSISTENT_ID
const long TIMETYPE_DATETIME
Long date format, 2007-03-28 12:33:01 , no milliseconds.
#define SB_PROPERTY_SHOWNAME
#define SB_PROPERTY_ARTISTDETAIL
The property information specific to date/time fields.
#define SB_DUMMYPROPERTY_SMARTMEDIALIST_PLAYLIST
#define SB_PROPERTY_LYRICISTNAME
#define SB_PROPERTY_ONLY_CUSTOM_MEDIAPAGES
The property information specific to numeric fields.
#define SB_PROPERTY_RAPISCOPEURL
#define SB_PROPERTY_LASTPLAYPOSITION
#define SB_PROPERTY_EXCLUDE_FROM_HISTORY
#define SB_PROPERTY_DESCRIPTION
#define SB_PROPERTY_LASTPLAYTIME
#define SB_PROPERTY_TOTALTRACKS
nsTArray< nsString > mPropIDs
#define SB_PROPERTY_ISSORTABLE
#define SB_PROPERTY_METADATA_HASH_IDENTITY
#define SB_PROPERTY_BITRATE
#define SB_PROPERTY_LAST_SYNC_TIME
#define SB_PROPERTY_DONT_WRITE_METADATA
#define SB_PROPERTY_STORAGEGUID
#define SB_PROPERTY_CONTENTLENGTH
#define SB_PROPERTY_PLAYQUEUE_MEDIALIST_GUID
#define SB_PROPERTY_ORIGINPAGEIMAGE
#define SB_PROPERTY_ORIGINPAGE
nsInterfaceHashtableMT< nsStringHashKey, sbIPropertyArray > mPropDependencyMap
#define SB_PROPERTY_CREATED
#define SB_PROPERTY_OUTERGUID
#define SB_PROPERTY_COLUMNSPEC
#define SB_PROPERTY_ATTEMPTED_REMOTE_ART_FETCH
#define SB_PROPERTY_UPDATED
#define SB_PROPERTY_GENRE
#define SB_PROPERTY_ENABLE_AUTO_DOWNLOAD
#define SB_PROPERTY_CONTENTTYPE
#define SB_PROPERTY_DESTINATION
#define SB_PROPERTY_CDDISCHASH
#define SB_PROPERTY_SOFTWAREVENDOR
#define SB_PROPERTY_DURATION
NS_IMETHOD SetDisplayName(const nsAString &aDisplayName)
The property information specific to text fields.
#define SB_PROPERTY_ISREADONLY
An interface used to describe a metadata property for use by the UI and other sbILibrary interfaces (...
#define SB_PROPERTY_DEFAULTCOLUMNSPEC
#define SB_PROPERTY_COPYRIGHT
#define SB_PROPERTY_DISCNUMBER
#define SB_PROPERTY_ORIGIN_IS_IN_MAIN_LIBRARY
#define SB_STRING_BUNDLE_CHROME_URL
virtual ~sbPropertyManager()
#define SB_PROPERTY_DEVICE_LIBRARY_GUID
An interface used to recognize a dummy metadata property.
#define SB_PROPERTY_ARTISTNAME
#define SB_PROPERTY_SMARTMEDIALIST_STATE
#define SB_PROPERTY_LAST_SYNC_SKIPCOUNT
#define SB_PROPERTY_RECORDLABELNAME
Property unit converter interface This is an interface songbird property converter, used to convert a property value between its various units representations.
#define SB_PROPERTY_CREATED_FIRSTRUN_SMARTPLAYLISTS
#define SB_PROPERTY_ALBUMNAME
#define SB_PROPERTY_LANGUAGE
#define SB_PROPERTY_ARTISTDETAILURL
#define SB_PROPERTY_COMPOSERNAME
#define SB_PROPERTY_EPISODENUMBER
The property information specific to boolean properties.
NS_METHOD CreateSystemProperties()
#define SB_PROPERTY_DISABLE_DOWNLOAD
#define SB_PROPERTY_ALBUMDETAIL
#define SB_PROPERTY_ALBUMDETAILURL
#define SB_PROPERTY_DOWNLOAD_STATUS_TARGET
#define SB_PROPERTY_LISTTYPE
#define SB_PROPERTY_PRODUCERNAME
#define SB_PROPERTY_LASTSKIPTIME
#define SB_PROPERTY_PLAYLISTURL
#define SB_PROPERTY_TRACKNAME
#define SB_PROPERTY_AVAILABILITY
#define SB_PROPERTY_COMMENT
const struct @18 sFilterListPickerProperties[]
#define SB_PROPERTY_ISLIST
const unsigned long SORT_NULL_BIG
Causes null values to be infinitely large.
#define SB_PROPERTY_CUSTOMTYPE
#define SB_PROPERTY_COPYRIGHTURL
#define SB_PROPERTY_CONTENTURL
An interface to carry around arrays of nsIProperty instances. Users of this interface should only QI ...
nsInterfaceHashtableMT< nsStringHashKey, sbIPropertyInfo > mPropInfoHashtable
#define SB_PROPERTY_SUBTITLE
#define SB_PROPERTY_ORIGINITEMGUID
#define SB_PROPERTY_ITUNES_GUID
const long TIMETYPE_TIMESTAMP
Timestamp format, respects unix time, microsecond format.
_getSelectedPageStyle s i
#define SB_PROPERTY_PRIMARYIMAGEURL
Manager for system wide metadata properties.
#define SB_PROPERTY_TRANSFER_POLICY
#define SB_PROPERTY_DOWNLOAD_MEDIALIST_GUID
NS_IMETHOD SetLocalizationKey(const nsAString &aLocalizationKey)
#define SB_PROPERTY_ORIGINPAGETITLE
#define SB_PROPERTY_SKIPCOUNT
#define SB_PROPERTY_DOWNLOAD_DETAILS
#define SB_PROPERTY_LAST_SYNC_PLAYCOUNT
NS_IMETHOD SetId(const nsAString &aID)
#define SB_PROPERTY_DEFAULT_MEDIAPAGE_URL
#define SB_PROPERTY_TRACKNUMBER
#define SB_PROPERTY_ISPARTOFCOMPILATION