summaryrefslogtreecommitdiffstats
path: root/redhat/kdebase/kdebase-3.5.13-support_hal_04.patch
blob: 0a92b6b98c03d16a9be9a299109236e8a8db2729 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
--- kdebase/ksmserver/shutdowndlg.h.rhel4	2012-09-08 05:43:47.950945974 -0400
+++ kdebase/ksmserver/shutdowndlg.h	2012-09-08 05:45:55.807337959 -0400
@@ -32,6 +32,9 @@
 
 #include <config.h>
 
+// RHEL 4 dirty hack to remove HAL support in ksmshutdown
+#undef COMPILE_HALBACKEND
+
 #ifndef NO_QT3_DBUS_SUPPORT
 /* We acknowledge the the dbus API is unstable */
 #define DBUS_API_SUBJECT_TO_CHANGE
--- kdebase/kioslave/media/mediamanager/halbackend.cpp.hal04	2012-09-08 14:15:10.324373357 -0400
+++ kdebase/kioslave/media/mediamanager/halbackend.cpp	2012-09-08 14:26:12.422302958 -0400
@@ -41,12 +41,10 @@
 #include <kprocess.h>
 
 #define MOUNT_SUFFIX    (                                                                       \
-    (medium->isMounted() ? TQString("_mounted") : TQString("_unmounted")) +   \
-    (medium->isEncrypted() ? (halClearVolume ? "_decrypted" : "_encrypted") : "" )          \
+    (medium->isMounted() ? TQString("_mounted") : TQString("_unmounted"))   \
     )
 #define MOUNT_ICON_SUFFIX   (                                                              \
-    (medium->isMounted() ? TQString("_mount") : TQString("_unmount")) +   \
-    (medium->isEncrypted() ? (halClearVolume ? "_decrypt" : "_encrypt") : "" )      \
+    (medium->isMounted() ? TQString("_mount") : TQString("_unmount"))   \
     )
 
 /* Static instance of this class, for static HAL callbacks */
@@ -57,10 +55,10 @@
 {
     char*   _ppt_string;
     TQString _ppt_QString;
-    _ppt_string = libhal_device_get_property_string(ctx, udi, key, NULL);
+    _ppt_string = hal_device_get_property_string(ctx, udi, key);
     if ( _ppt_string )
         _ppt_QString = _ppt_string;
-    libhal_free_string(_ppt_string);
+    hal_free_string(_ppt_string);
     return _ppt_QString;
 }
 
@@ -92,7 +90,7 @@
 
         /* Remove all the registered media first */
         int numDevices;
-        char** halDeviceList = libhal_get_all_devices( m_halContext, &numDevices, NULL );
+        char** halDeviceList = hal_get_all_devices( m_halContext, &numDevices );
 
         if ( halDeviceList )
         {
@@ -102,70 +100,39 @@
             }
         }
 
-        libhal_free_string_array( halDeviceList );
+        hal_free_string_array( halDeviceList );
 
-        DBusError error;
-        dbus_error_init(&error);
-        libhal_ctx_shutdown(m_halContext, &error);
-        libhal_ctx_free(m_halContext);
+        hal_shutdown(m_halContext);
     }
 
     if (m_halStoragePolicy)
-        libhal_storage_policy_free(m_halStoragePolicy);
+        hal_storage_policy_free(m_halStoragePolicy);
 }
 
 /* Connect to the HAL */
 bool HALBackend::InitHal()
 {
     kdDebug(1219) << "Context new" << endl;
-    m_halContext = libhal_ctx_new();
+
+    /* libhal initialization */
+    m_halFunctions.main_loop_integration	= HALBackend::hal_main_loop_integration;
+    m_halFunctions.device_added		= HALBackend::hal_device_added;
+    m_halFunctions.device_removed		= HALBackend::hal_device_removed;
+    m_halFunctions.device_new_capability	= NULL;
+    m_halFunctions.device_lost_capability	= NULL;
+    m_halFunctions.device_property_modified	= HALBackend::hal_device_property_modified;
+    m_halFunctions.device_condition		= HALBackend::hal_device_condition;
+
+    m_halContext = hal_initialize(&m_halFunctions, false);
     if (!m_halContext)
     {
         kdDebug(1219) << "Failed to initialize HAL!" << endl;
         return false;
     }
 
-    // Main loop integration
-    kdDebug(1219) << "Main loop integration" << endl;
-    DBusError error;
-    dbus_error_init(&error);
-    dbus_connection = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
-
-    if (!dbus_connection || dbus_error_is_set(&error)) {
-        dbus_error_free(&error);
-        libhal_ctx_free(m_halContext);
-        m_halContext = NULL;
-        return false;
-    }
-
-    dbus_connection_set_exit_on_disconnect (dbus_connection, FALSE);
-
-    MainLoopIntegration(dbus_connection);
-    libhal_ctx_set_dbus_connection(m_halContext, dbus_connection);
-
-    // HAL callback functions
-    kdDebug(1219) << "Callback functions" << endl;
-    libhal_ctx_set_device_added(m_halContext, HALBackend::hal_device_added);
-    libhal_ctx_set_device_removed(m_halContext, HALBackend::hal_device_removed);
-    libhal_ctx_set_device_new_capability (m_halContext, NULL);
-    libhal_ctx_set_device_lost_capability (m_halContext, NULL);
-    libhal_ctx_set_device_property_modified (m_halContext, HALBackend::hal_device_property_modified);
-    libhal_ctx_set_device_condition(m_halContext, HALBackend::hal_device_condition);
-
-    kdDebug(1219) << "Context Init" << endl;
-    if (!libhal_ctx_init(m_halContext, &error))
-    {
-        if (dbus_error_is_set(&error))
-            dbus_error_free(&error);
-        libhal_ctx_free(m_halContext);
-        m_halContext = NULL;
-        kdDebug(1219) << "Failed to init HAL context!" << endl;
-        return false;
-    }
-
     /** @todo customize watch policy */
     kdDebug(1219) << "Watch properties" << endl;
-    if (!libhal_device_property_watch_all(m_halContext, &error))
+    if (hal_device_property_watch_all(m_halContext))
     {
         kdDebug(1219) << "Failed to watch HAL properties!" << endl;
         return false;
@@ -173,7 +140,7 @@
 
     /* libhal-storage initialization */
     kdDebug(1219) << "Storage Policy" << endl;
-    m_halStoragePolicy = libhal_storage_policy_new();
+    m_halStoragePolicy = hal_storage_policy_new();
     /** @todo define libhal-storage icon policy */
 
     /* List devices at startup */
@@ -186,16 +153,19 @@
     kdDebug(1219) << "ListDevices" << endl;
 
     int numDevices;
-    char** halDeviceList = libhal_get_all_devices(m_halContext, &numDevices, NULL);
+    char** halDeviceList = hal_get_all_devices(m_halContext, &numDevices);
 
     if (!halDeviceList)
         return false;
 
     kdDebug(1219) << "HALBackend::ListDevices : " << numDevices << " devices found" << endl;
-    for (int i = 0; i < numDevices; i++)
+    for (int i = 0; i < numDevices; i++) {
+		kdDebug(1219) << "HALBackend::ListDevices : adding device " << i << endl;
         AddDevice(halDeviceList[i], false);
+		kdDebug(1219) << "HALBackend::ListDevices : end adding device " << i << endl;
+    }
 
-    libhal_free_string_array( halDeviceList );
+    hal_free_string_array( halDeviceList );
 
     return true;
 }
@@ -206,63 +176,54 @@
 {
     /* We don't deal with devices that do not expose their capabilities.
        If we don't check this, we will get a lot of warning messages from libhal */
-    if (!libhal_device_property_exists(m_halContext, udi, "info.capabilities", NULL))
+    if (!hal_device_property_exists(m_halContext, udi, "info.capabilities")) {
+        kdDebug(1219) << "HALBackend::AddDevice : Device does not expose capability. Skipping." << endl;   
         return;
+    }
 
     /* If the device is already listed, do not process.
        This should not happen, but who knows... */
     /** @todo : refresh properties instead ? */
-    if (m_mediaList.findById(udi))
+    if (m_mediaList.findById(udi)) {
+        kdDebug(1219) << "HALBackend::AddDevice : Device is already listed. Skipping." << endl;   
         return;
+    }
 
-    if (libhal_device_get_property_bool(m_halContext, "/org/freedesktop/Hal/devices/computer", "storage.disable_volume_handling", NULL))
+    if (hal_device_get_property_bool(m_halContext, "/org/freedesktop/Hal/devices/computer", "storage.disable_volume_handling"))
         allowNotification=false;
 
     /* Add volume block devices */
-    if (libhal_device_query_capability(m_halContext, udi, "volume", NULL))
+    if (hal_device_query_capability(m_halContext, udi, "volume"))
     {
+		kdDebug(1219) << "HALBackend::AddDevice : Device is a volume." << endl;   
         /* We only list volumes that...
-         *  - are encrypted with LUKS or
          *  - have a filesystem or
          *  - have an audio track
          */
-        if ( ( libhal_device_get_property_QString(m_halContext, udi, "volume.fsusage") != "crypto" ||
-               libhal_device_get_property_QString(m_halContext, udi, "volume.fstype") != "crypto_LUKS"
-             ) &&
-             libhal_device_get_property_QString(m_halContext, udi, "volume.fsusage") != "filesystem" &&
-             !libhal_device_get_property_bool(m_halContext, udi, "volume.disc.has_audio", NULL) &&
-             !libhal_device_get_property_bool(m_halContext, udi, "volume.disc.is_blank", NULL) )
+        if ( (libhal_device_get_property_QString(m_halContext, udi, "volume.fsusage") != "filesystem") &&
+             (!hal_device_get_property_bool(m_halContext, udi, "volume.disc.has_audio")) &&
+             (!hal_device_get_property_bool(m_halContext, udi, "volume.disc.is_blank")) ) {
+            kdDebug(1219) << "HALBackend::AddDevice : no filesystem, no audio track on device. Skipping." << endl;   
             return;
+        }
 
         /* Query drive udi */
         TQString driveUdi = libhal_device_get_property_QString(m_halContext, udi, "block.storage_device");
-        if ( driveUdi.isNull() ) // no storage - no fun
+        if ( driveUdi.isNull() ) { // no storage - no fun
+            kdDebug(1219) << "HALBackend::AddDevice : UDI is null. Skipping." << endl;   
             return;
+        }
 
         // if the device is locked do not act upon it
-        if (libhal_device_get_property_bool(m_halContext, driveUdi.ascii(), "info.locked", NULL))
+        if (hal_device_get_property_bool(m_halContext, driveUdi.ascii(), "info.locked"))
             allowNotification=false;
 
         // if the device is locked do not act upon it
-        if (libhal_device_get_property_bool(m_halContext, driveUdi.ascii(), "storage.partition_table_changed", NULL))
+        if (hal_device_get_property_bool(m_halContext, driveUdi.ascii(), "storage.partition_table_changed"))
             allowNotification=false;
 
         /** @todo check exclusion list **/
 
-        /* Special handling for clear crypto volumes */
-        LibHalVolume* halVolume = libhal_volume_from_udi(m_halContext, udi);
-        if (!halVolume)
-            return;
-        const char* backingVolumeUdi = libhal_volume_crypto_get_backing_volume_udi(halVolume);
-        if ( backingVolumeUdi != NULL )
-        {
-            /* The crypto drive was unlocked and may now be mounted... */
-            kdDebug(1219) << "HALBackend::AddDevice : ClearVolume appeared for " << backingVolumeUdi << endl;
-            ResetProperties(backingVolumeUdi, allowNotification);
-            libhal_volume_free(halVolume);
-            return;
-        }
-        libhal_volume_free(halVolume);
 
         /* Create medium */
         Medium* medium = new Medium(udi, "");
@@ -272,18 +233,20 @@
         {
             // if it's not mountable by user and not by HAL, don't show it at all
             if ( ( libhal_device_get_property_QString(m_halContext, udi, "volume.fsusage") == "filesystem" &&
-                   !libhal_device_get_property_bool(m_halContext, udi, "volume.is_mounted", NULL ) ) &&
-                 ( libhal_device_get_property_bool(m_halContext, udi, "volume.ignore", NULL ) ) )
+                   !hal_device_get_property_bool(m_halContext, udi, "volume.is_mounted") ) &&
+                 ( hal_device_get_property_bool(m_halContext, udi, "volume.ignore") ) )
             {
+                kdDebug(1219) << "HALBackend::AddDevice : Device is not mountable. Skipping." << endl;   
                 delete medium;
                 return;
             }
         }
         
-	// instert medium into list
-	m_mediaList.addMedium(medium, allowNotification);
+	    // insert medium into list
+        kdDebug(1219) << "HALBackend::AddDevice : Adding medium into list." << endl;   
+	    m_mediaList.addMedium(medium, allowNotification);
 
-	// finally check for automount
+	    // finally check for automount
         TQMap<TQString,TQString> options = MediaManagerUtils::splitOptions(mountoptions(udi));
         kdDebug() << "automount " << options["automount"] << endl;
         if (options["automount"] == "true" && allowNotification ) {
@@ -294,14 +257,18 @@
 
         return;
     }
+    else
+    {
+		kdDebug(1219) << "HALBackend::AddDevice : Device is not a volume." << endl;   
+    }
 
     /* Floppy & zip drives */
-    if (libhal_device_query_capability(m_halContext, udi, "storage", NULL))
+    if (hal_device_query_capability(m_halContext, udi, "storage"))
         if ((libhal_device_get_property_QString(m_halContext, udi, "storage.drive_type") == "floppy") ||
             (libhal_device_get_property_QString(m_halContext, udi, "storage.drive_type") == "zip") ||
             (libhal_device_get_property_QString(m_halContext, udi, "storage.drive_type") == "jaz"))
         {
-            if (! libhal_device_get_property_bool(m_halContext, udi, "storage.removable.media_available", NULL) )
+            if (! hal_device_get_property_bool(m_halContext, udi, "storage.removable.media_available") )
                 allowNotification = false;
             /* Create medium */
             Medium* medium = new Medium(udi, "");
@@ -314,11 +281,9 @@
         }
 
     /* Camera handled by gphoto2*/
-    if (libhal_device_query_capability(m_halContext, udi, "camera", NULL) &&
-        ((libhal_device_get_property_QString(m_halContext, udi, "camera.access_method")=="ptp") ||
-
-         (libhal_device_property_exists(m_halContext, udi, "camera.libgphoto2.support", NULL) &&
-          libhal_device_get_property_bool(m_halContext, udi, "camera.libgphoto2.support", NULL)))
+    if (hal_device_query_capability(m_halContext, udi, "camera") &&
+         hal_device_property_exists(m_halContext, udi, "camera.libgphoto2.support") &&
+         hal_device_get_property_bool(m_halContext, udi, "camera.libgphoto3.support")
         )
     {
         /* Create medium */
@@ -327,6 +292,7 @@
         m_mediaList.addMedium(medium, allowNotification);
         return;
     }
+    kdDebug(1219) << "HALBackend::AddDevice : Device was intentionally not added. Skipping." << endl;   
 }
 
 void HALBackend::RemoveDevice(const char *udi)
@@ -348,7 +314,7 @@
         return;
     bool allowNotification = false;
     if (strcmp(key, "storage.removable.media_available") == 0)
-        allowNotification = libhal_device_get_property_bool(m_halContext, udi, key, NULL);
+        allowNotification = hal_device_get_property_bool(m_halContext, udi, key);
     ResetProperties(mediumUdi, allowNotification);
 }
 
@@ -421,19 +387,13 @@
         return medium->id().ascii();
 
     /* Hard part : this is a volume whose drive is registered */
-    if (libhal_device_property_exists(m_halContext, udi, "info.capabilities", NULL))
-        if (libhal_device_query_capability(m_halContext, udi, "volume", NULL))
+    if (hal_device_property_exists(m_halContext, udi, "info.capabilities"))
+        if (hal_device_query_capability(m_halContext, udi, "volume"))
         {
             /* check if this belongs to an encrypted volume */
-            LibHalVolume* halVolume = libhal_volume_from_udi(m_halContext, udi);
+            HalVolume* halVolume = hal_volume_from_udi(m_halContext, udi);
             if (!halVolume) return NULL;
-            const char* backingUdi = libhal_volume_crypto_get_backing_volume_udi(halVolume);
-            if (backingUdi != NULL) {
-                const char* result = findMediumUdiFromUdi(backingUdi);
-                libhal_volume_free(halVolume);
-                return result;
-            }
-            libhal_volume_free(halVolume);
+            hal_volume_free(halVolume);
 
             /* this is a volume whose drive is registered */
             TQString driveUdi = libhal_device_get_property_QString(m_halContext, udi, "block.storage_device");
@@ -462,11 +422,11 @@
 
     Medium* m = new Medium(mediumUdi, "");
 
-    if (libhal_device_query_capability(m_halContext, mediumUdi, "volume", NULL))
+    if (hal_device_query_capability(m_halContext, mediumUdi, "volume"))
         setVolumeProperties(m);
-    if (libhal_device_query_capability(m_halContext, mediumUdi, "storage", NULL))
+    if (hal_device_query_capability(m_halContext, mediumUdi, "storage"))
         setFloppyProperties(m);
-    if (libhal_device_query_capability(m_halContext, mediumUdi, "camera", NULL))
+    if (hal_device_query_capability(m_halContext, mediumUdi, "camera"))
         setCameraProperties(m);
 
     m_mediaList.changeMediumState(*m, allowNotification);
@@ -480,84 +440,50 @@
 
     const char* udi = medium->id().ascii();
     /* Check if the device still exists */
-    if (!libhal_device_exists(m_halContext, udi, NULL))
+    if (!hal_device_exists(m_halContext, udi))
         return;
 
     /* Get device information from libhal-storage */
-    LibHalVolume* halVolume = libhal_volume_from_udi(m_halContext, udi);
+    HalVolume* halVolume = hal_volume_from_udi(m_halContext, udi);
     if (!halVolume)
         return;
-    TQString driveUdi = libhal_volume_get_storage_device_udi(halVolume);
-    LibHalDrive*  halDrive  = 0;
+    TQString driveUdi = hal_volume_get_storage_device_udi(halVolume);
+    HalDrive*  halDrive  = 0;
     if ( !driveUdi.isNull() )
-        halDrive = libhal_drive_from_udi(m_halContext, driveUdi.ascii());
+        halDrive = hal_drive_from_udi(m_halContext, driveUdi.ascii());
     if (!halDrive) {
         // at times HAL sends an UnmountForced event before the device is removed
-        libhal_volume_free(halVolume);
+        hal_volume_free(halVolume);
         return;
     }
 
     medium->setName(
-        generateName(libhal_volume_get_device_file(halVolume)) );
-
-    LibHalVolume* halClearVolume = NULL;
-    if ( libhal_device_get_property_QString(m_halContext, udi, "volume.fsusage") == "crypto" )
-    {
-        kdDebug(1219) << "HALBackend::setVolumeProperties : crypto volume" << endl;
+        generateName(hal_volume_get_device_file(halVolume)) );
 
-        medium->setEncrypted(true);
-        char* clearUdi = libhal_volume_crypto_get_clear_volume_udi(m_halContext, halVolume);
-	TQString clearUdiString;
-        if (clearUdi != NULL) {
-            kdDebug(1219) << "HALBackend::setVolumeProperties : crypto clear volume avail - " << clearUdi << endl;
-            halClearVolume = libhal_volume_from_udi(m_halContext, clearUdi);
-            // ignore if halClearVolume is NULL -> just not decrypted in this case
-	    clearUdiString = clearUdi;
-	    libhal_free_string(clearUdi);
-        }
-
-        if (halClearVolume)
-            medium->mountableState(
-                libhal_volume_get_device_file(halVolume),		/* Device node */
-                clearUdiString,
-                libhal_volume_get_mount_point(halClearVolume),		/* Mount point */
-                libhal_volume_get_fstype(halClearVolume),		/* Filesystem type */
-                libhal_volume_is_mounted(halClearVolume) );		/* Mounted ? */
-        else
-            medium->mountableState(
-                libhal_volume_get_device_file(halVolume),		/* Device node */
-                TQString::null,
-                TQString::null,		/* Mount point */
-                TQString::null,		/* Filesystem type */
-                false );		/* Mounted ? */
-    }
-    else
-    {
-        kdDebug(1219) << "HALBackend::setVolumeProperties : normal volume" << endl;
-        medium->mountableState(
-            libhal_volume_get_device_file(halVolume),		/* Device node */
-            libhal_volume_get_mount_point(halVolume),		/* Mount point */
-            libhal_volume_get_fstype(halVolume),		/* Filesystem type */
-            libhal_volume_is_mounted(halVolume) );		/* Mounted ? */
-    }
+    kdDebug(1219) << "HALBackend::setVolumeProperties : normal volume" << endl;
+    medium->mountableState(
+        hal_volume_get_device_file(halVolume),		/* Device node */
+        hal_volume_get_mount_point(halVolume),		/* Mount point */
+        hal_volume_get_fstype(halVolume),		/* Filesystem type */
+        hal_volume_is_mounted(halVolume) );		/* Mounted ? */
 
 
-    char* name = libhal_volume_policy_compute_display_name(halDrive, halVolume, m_halStoragePolicy);
+    char* name = hal_volume_policy_compute_display_name(halDrive, halVolume, m_halStoragePolicy);
     TQString volume_name = TQString::fromUtf8(name);
     TQString media_name = volume_name;
     medium->setLabel(media_name);
     free(name);
 
     TQString mimeType;
-    if (libhal_volume_is_disc(halVolume))
+    if (hal_volume_is_disc(halVolume))
     {
         mimeType = "media/cdrom" + MOUNT_SUFFIX;
 
-        LibHalVolumeDiscType discType = libhal_volume_get_disc_type(halVolume);
-        if ((discType == LIBHAL_VOLUME_DISC_TYPE_CDROM) ||
-            (discType == LIBHAL_VOLUME_DISC_TYPE_CDR) ||
-            (discType == LIBHAL_VOLUME_DISC_TYPE_CDRW))
-            if (libhal_volume_disc_is_blank(halVolume))
+        HalVolumeDiscType discType = hal_volume_get_disc_type(halVolume);
+        if ((discType == HAL_VOLUME_DISC_TYPE_CDROM) ||
+            (discType == HAL_VOLUME_DISC_TYPE_CDR) ||
+            (discType == HAL_VOLUME_DISC_TYPE_CDRW))
+            if (hal_volume_disc_is_blank(halVolume))
             {
                 mimeType = "media/blankcd";
                 medium->unmountableState("");
@@ -565,10 +491,10 @@
             else
                 mimeType = "media/cdwriter" + MOUNT_SUFFIX;
 
-        if ((discType == LIBHAL_VOLUME_DISC_TYPE_DVDROM) || (discType == LIBHAL_VOLUME_DISC_TYPE_DVDRAM) ||
-            (discType == LIBHAL_VOLUME_DISC_TYPE_DVDR) || (discType == LIBHAL_VOLUME_DISC_TYPE_DVDRW) ||
-            (discType == LIBHAL_VOLUME_DISC_TYPE_DVDPLUSR) || (discType == LIBHAL_VOLUME_DISC_TYPE_DVDPLUSRW) )
-            if (libhal_volume_disc_is_blank(halVolume))
+        if ((discType == HAL_VOLUME_DISC_TYPE_DVDROM) || (discType == HAL_VOLUME_DISC_TYPE_DVDRAM) ||
+            (discType == HAL_VOLUME_DISC_TYPE_DVDR) || (discType == HAL_VOLUME_DISC_TYPE_DVDRW) ||
+            (discType == HAL_VOLUME_DISC_TYPE_DVDPLUSR) || (discType == HAL_VOLUME_DISC_TYPE_DVDPLUSRW) )
+            if (hal_volume_disc_is_blank(halVolume))
             {
                 mimeType = "media/blankdvd";
                 medium->unmountableState("");
@@ -576,16 +502,16 @@
             else
                 mimeType = "media/dvd" + MOUNT_SUFFIX;
 
-        if (libhal_volume_disc_has_audio(halVolume) && !libhal_volume_disc_has_data(halVolume))
+        if (hal_volume_disc_has_audio(halVolume) && !hal_volume_disc_has_data(halVolume))
         {
             mimeType = "media/audiocd";
-            medium->unmountableState( "audiocd:/?device=" + TQString(libhal_volume_get_device_file(halVolume)) );
+            medium->unmountableState( "audiocd:/?device=" + TQString(hal_volume_get_device_file(halVolume)) );
         }
 
         medium->setIconName(TQString::null);
 
         /* check if the disc id a vcd or a video dvd */
-        DiscType type = LinuxCDPolling::identifyDiscType(libhal_volume_get_device_file(halVolume));
+        DiscType type = LinuxCDPolling::identifyDiscType(hal_volume_get_device_file(halVolume));
         switch (type)
         {
         case DiscType::VCD:
@@ -603,24 +529,24 @@
     {
         mimeType = "media/hdd" + MOUNT_SUFFIX;
         medium->setIconName(TQString::null); // reset icon
-        if (libhal_drive_is_hotpluggable(halDrive))
+        if (hal_drive_is_hotpluggable(halDrive))
         {
             mimeType = "media/removable" + MOUNT_SUFFIX;
             medium->needMounting();
-            switch (libhal_drive_get_type(halDrive)) {
-            case LIBHAL_DRIVE_TYPE_COMPACT_FLASH:
+            switch (hal_drive_get_type(halDrive)) {
+            case HAL_DRIVE_TYPE_COMPACT_FLASH:
                 medium->setIconName("compact_flash" + MOUNT_ICON_SUFFIX);
                 break;
-            case LIBHAL_DRIVE_TYPE_MEMORY_STICK:
+            case HAL_DRIVE_TYPE_MEMORY_STICK:
                 medium->setIconName("memory_stick" + MOUNT_ICON_SUFFIX);
                 break;
-            case LIBHAL_DRIVE_TYPE_SMART_MEDIA:
+            case HAL_DRIVE_TYPE_SMART_MEDIA:
                 medium->setIconName("smart_media" + MOUNT_ICON_SUFFIX);
                 break;
-            case LIBHAL_DRIVE_TYPE_SD_MMC:
+            case HAL_DRIVE_TYPE_SD_MMC:
                 medium->setIconName("sd_mmc" + MOUNT_ICON_SUFFIX);
                 break;
-            case LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER:
+            case HAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER:
             {
                 medium->setIconName("ipod" + MOUNT_ICON_SUFFIX);
 
@@ -628,25 +554,25 @@
 		         KProtocolInfo::isKnownProtocol( TQString("ipod") ) )
                 {
                     medium->unmountableState( "ipod:/" );
-                    medium->mountableState(  libhal_volume_is_mounted(halVolume) );
+                    medium->mountableState(  hal_volume_is_mounted(halVolume) );
                 }
                 break;
             }
-            case LIBHAL_DRIVE_TYPE_CAMERA:
+            case HAL_DRIVE_TYPE_CAMERA:
             {
                 mimeType = "media/camera" + MOUNT_SUFFIX;
-                const char *physdev = libhal_drive_get_physical_device_udi(halDrive);
+                const char *physdev = hal_drive_get_physical_device_udi(halDrive);
                 // get model from camera
-                if (physdev && libhal_device_query_capability(m_halContext, physdev, "camera", NULL))
+                if (physdev && hal_device_query_capability(m_halContext, physdev, "camera"))
                 {
-                    if (libhal_device_property_exists(m_halContext, physdev, "usb_device.product", NULL))
+                    if (hal_device_property_exists(m_halContext, physdev, "usb_device.product"))
                         medium->setLabel(libhal_device_get_property_QString(m_halContext, physdev, "usb_device.product"));
-                    else if (libhal_device_property_exists(m_halContext, physdev, "usb.product", NULL))
+                    else if (hal_device_property_exists(m_halContext, physdev, "usb.product"))
                         medium->setLabel(libhal_device_get_property_QString(m_halContext, physdev, "usb.product"));
                 }
                 break;
             }
-            case LIBHAL_DRIVE_TYPE_TAPE:
+            case HAL_DRIVE_TYPE_TAPE:
                 medium->setIconName(TQString::null); //FIXME need icon
                 break;
             default:
@@ -661,8 +587,8 @@
     }
     medium->setMimeType(mimeType);
 
-    libhal_drive_free(halDrive);
-    libhal_volume_free(halVolume);
+    hal_drive_free(halDrive);
+    hal_volume_free(halVolume);
 }
 
 bool HALBackend::setFstabProperties( Medium *medium )
@@ -713,10 +639,10 @@
 
     const char* udi = medium->id().ascii();
     /* Check if the device still exists */
-    if (!libhal_device_exists(m_halContext, udi, NULL))
+    if (!hal_device_exists(m_halContext, udi))
         return false;
 
-    LibHalDrive*  halDrive  = libhal_drive_from_udi(m_halContext, udi);
+    HalDrive*  halDrive  = hal_drive_from_udi(m_halContext, udi);
     if (!halDrive)
         return false;
 
@@ -724,21 +650,21 @@
 
     if (drive_type == "zip") {
         int numVolumes;
-        char** volumes = libhal_drive_find_all_volumes(m_halContext, halDrive, &numVolumes);
-        libhal_free_string_array(volumes);
+        char** volumes = hal_drive_find_all_volumes(m_halContext, halDrive, &numVolumes);
+        hal_free_string_array(volumes);
         kdDebug(1219) << " found " << numVolumes << " volumes" << endl;
         if (numVolumes)
         {
-            libhal_drive_free(halDrive);
+            hal_drive_free(halDrive);
             return false;
         }
     }
 
-    medium->setName( generateName(libhal_drive_get_device_file(halDrive)) );
+    medium->setName( generateName(hal_drive_get_device_file(halDrive)) );
     medium->setLabel(i18n("Unknown Drive"));
 
     // HAL hates floppies - so we have to do it twice ;(
-    medium->mountableState(libhal_drive_get_device_file(halDrive), TQString::null, TQString::null, false);
+    medium->mountableState(hal_drive_get_device_file(halDrive), TQString::null, TQString::null, false);
     setFloppyMountState(medium);
 
     if (drive_type == "floppy")
@@ -762,7 +688,7 @@
 
     medium->setIconName(TQString::null);
 
-    libhal_drive_free(halDrive);
+    hal_drive_free(halDrive);
 
     return true;
 }
@@ -796,7 +722,7 @@
 
     const char* udi = medium->id().ascii();
     /* Check if the device still exists */
-    if (!libhal_device_exists(m_halContext, udi, NULL))
+    if (!hal_device_exists(m_halContext, udi))
         return;
 
     /** @todo find name */
@@ -804,25 +730,25 @@
 
     TQString device = "camera:/";
 
-    char *cam = libhal_device_get_property_string(m_halContext, udi, "camera.libgphoto2.name", NULL);
+    char *cam = hal_device_get_property_string(m_halContext, udi, "camera.libgphoto2.name");
     DBusError error;
     dbus_error_init(&error);
     if (cam &&
-        libhal_device_property_exists(m_halContext, udi, "usb.linux.device_number", NULL) &&
-        libhal_device_property_exists(m_halContext, udi, "usb.bus_number", NULL))
+        hal_device_property_exists(m_halContext, udi, "usb.linux.device_number") &&
+        hal_device_property_exists(m_halContext, udi, "usb.bus_number"))
         device.sprintf("camera://%s@[usb:%03d,%03d]/", cam,
-                       libhal_device_get_property_int(m_halContext, udi, "usb.bus_number", &error),
-                       libhal_device_get_property_int(m_halContext, udi, "usb.linux.device_number", &error));
+                       hal_device_get_property_int(m_halContext, udi, "usb.bus_number"),
+                       hal_device_get_property_int(m_halContext, udi, "usb.linux.device_number"));
 
-    libhal_free_string(cam);
+    hal_free_string(cam);
 
     /** @todo find the rest of this URL */
     medium->unmountableState(device);
     medium->setMimeType("media/gphoto2camera");
     medium->setIconName(TQString::null);
-    if (libhal_device_property_exists(m_halContext, udi, "usb_device.product", NULL))
+    if (hal_device_property_exists(m_halContext, udi, "usb_device.product"))
         medium->setLabel(libhal_device_get_property_QString(m_halContext, udi, "usb_device.product"));
-    else if (libhal_device_property_exists(m_halContext, udi, "usb.product", NULL))
+    else if (hal_device_property_exists(m_halContext, udi, "usb.product"))
         medium->setLabel(libhal_device_get_property_QString(m_halContext, udi, "usb.product"));
     else
         medium->setLabel(i18n("Camera"));
@@ -837,6 +763,14 @@
  ** HAL CALL-BACKS                        **
  ******************************************/
 
+void HALBackend::hal_main_loop_integration(LibHalContext *ctx,
+                                         DBusConnection *dbus_connection)
+{
+    kdDebug(1219) << "HALBackend::hal_main_loop_integration" << endl;
+    Q_UNUSED(ctx);
+    s_HALBackend->MainLoopIntegration(dbus_connection);
+}
+
 void HALBackend::hal_device_added(LibHalContext *ctx, const char *udi)
 {
     kdDebug(1219) << "HALBackend::hal_device_added " << udi <<  endl;
@@ -863,7 +797,7 @@
 
 void HALBackend::hal_device_condition(LibHalContext *ctx, const char *udi,
                                       const char *condition_name,
-                                      const char* message
+                                      DBusMessage* message
     )
 {
     kdDebug(1219) << "HALBackend::hal_device_condition " << udi << " -- " << condition_name << endl;
@@ -875,24 +809,24 @@
 TQStringList HALBackend::getHALmountoptions(TQString udi)
 {
     const char*   _ppt_string;
-    LibHalVolume* volume;
-    LibHalDrive* drive;
+    HalVolume* volume;
+    HalDrive* drive;
 
     TQString _ppt_TQString;
 
-    volume = libhal_volume_from_udi( m_halContext, udi.latin1() );
+    volume = hal_volume_from_udi( m_halContext, udi.latin1() );
     if( volume )
-        drive = libhal_drive_from_udi( m_halContext, libhal_volume_get_storage_device_udi( volume ) );
+        drive = hal_drive_from_udi( m_halContext, hal_volume_get_storage_device_udi( volume ) );
     else
-        drive = libhal_drive_from_udi( m_halContext, udi.latin1() );
+        drive = hal_drive_from_udi( m_halContext, udi.latin1() );
 
     if( !drive )
            return TQString::null;
 
     if( volume )
-       _ppt_string = libhal_volume_policy_get_mount_options ( drive, volume, NULL );
+       _ppt_string = hal_volume_policy_get_mount_options ( drive, volume, NULL );
     else
-       _ppt_string = libhal_drive_policy_get_mount_options ( drive, NULL );
+       _ppt_string = hal_drive_policy_get_mount_options ( drive, NULL );
 
     _ppt_TQString = TQString(_ppt_string ? _ppt_string : "");
 
@@ -908,24 +842,6 @@
         return TQStringList(); // not handled by HAL - fstab entry
 
     TQString volume_udi = name;
-    if (medium->isEncrypted()) {
-        // see if we have a clear volume
-        LibHalVolume* halVolume = libhal_volume_from_udi(m_halContext, medium->id().latin1());
-        if (halVolume) {
-            char* clearUdi = libhal_volume_crypto_get_clear_volume_udi(m_halContext, halVolume);
-            if (clearUdi != NULL) {
-	        volume_udi = clearUdi;
-		libhal_free_string(clearUdi);
-	    } else {
-	        // if not decrypted yet then no mountoptions
-		return TQStringList();
-	    }
-            libhal_volume_free(halVolume);
-        } else {
-	    // strange...
-	    return TQStringList();
-	}
-    }
 
     KConfig config("mediamanagerrc");
     
@@ -939,17 +855,7 @@
     if (use_defaults)
 	config.setGroup("DefaultOptions");    
 
-    char ** array = libhal_device_get_property_strlist(m_halContext, volume_udi.latin1(), "volume.mount.valid_options", NULL);
     TQMap<TQString,bool> valids;
-
-    for (int index = 0; array && array[index]; ++index) {
-        TQString t = array[index];
-        if (t.endsWith("="))
-            t = t.left(t.length() - 1);
-        valids[t] = true;
-        kdDebug() << "valid " << t << endl;
-    }
-    libhal_free_string_array(array);
     TQStringList result;
     TQString tmp;
     
@@ -963,8 +869,8 @@
 
     bool removable = false;
     if ( !drive_udi.isNull() )
-        removable = libhal_device_get_property_bool(m_halContext, drive_udi.latin1(), "storage.removable", NULL)
-                     || libhal_device_get_property_bool(m_halContext, drive_udi.latin1(), "storage.hotpluggable", NULL);
+        removable = hal_device_get_property_bool(m_halContext, drive_udi.latin1(), "storage.removable")
+                     || hal_device_get_property_bool(m_halContext, drive_udi.latin1(), "storage.hotpluggable");
 
     bool value;
     if (use_defaults)
@@ -979,11 +885,11 @@
 	config.setGroup(current_group);
     }
 
-    if (libhal_device_get_property_bool(m_halContext, volume_udi.latin1(), "volume.disc.is_blank", NULL)
-        || libhal_device_get_property_bool(m_halContext, volume_udi.latin1(), "volume.disc.is_vcd", NULL)
-        || libhal_device_get_property_bool(m_halContext, volume_udi.latin1(), "volume.disc.is_svcd", NULL)
-        || libhal_device_get_property_bool(m_halContext, volume_udi.latin1(), "volume.disc.is_videodvd", NULL)
-        || libhal_device_get_property_bool(m_halContext, volume_udi.latin1(), "volume.disc.has_audio", NULL))
+    if (hal_device_get_property_bool(m_halContext, volume_udi.latin1(), "volume.disc.is_blank")
+        || hal_device_get_property_bool(m_halContext, volume_udi.latin1(), "volume.disc.is_vcd")
+        || hal_device_get_property_bool(m_halContext, volume_udi.latin1(), "volume.disc.is_svcd")
+        || hal_device_get_property_bool(m_halContext, volume_udi.latin1(), "volume.disc.is_videodvd")
+        || hal_device_get_property_bool(m_halContext, volume_udi.latin1(), "volume.disc.has_audio"))
         value = false;
 
     result << TQString("automount=%1").arg(value ? "true" : "false");
@@ -1540,29 +1446,6 @@
     }
     options[noptions] = NULL;
 
-    TQString qerror = i18n("Cannot mount encrypted drives!");
-
-    if (!medium->isEncrypted()) {
-        // normal volume
-    	qerror = mount_priv(medium->id().latin1(), mount_point.utf8(), options, noptions, dbus_connection);
-    } else {
-        // see if we have a clear volume
-        LibHalVolume* halVolume = libhal_volume_from_udi(m_halContext, medium->id().latin1());
-        if (halVolume) {
-            char* clearUdi = libhal_volume_crypto_get_clear_volume_udi(m_halContext, halVolume);
-            if (clearUdi != NULL) {
-                qerror = mount_priv(clearUdi, mount_point.utf8(), options, noptions, dbus_connection);
-                libhal_free_string(clearUdi);
-            }
-            libhal_volume_free(halVolume);
-        }
-    }
-
-    if (!qerror.isEmpty()) {
-        kdError() << "mounting " << medium->id() << " returned " << qerror << endl;
-        return qerror;
-    }
-
     medium->setHalMounted(true);
     ResetProperties(medium->id().latin1());
 
@@ -1584,11 +1467,11 @@
     if (!medium)
     {   // now we get fancy: if the udi is no volume, it _might_ be a device with only one
         // volume on it (think CDs) - so we're so nice to the caller to unmount that volume
-        LibHalDrive*  halDrive  = libhal_drive_from_udi(m_halContext, _udi.latin1());
+        HalDrive*  halDrive  = hal_drive_from_udi(m_halContext, _udi.latin1());
         if (halDrive)
         {
             int numVolumes;
-            char** volumes = libhal_drive_find_all_volumes(m_halContext, halDrive, &numVolumes);
+            char** volumes = hal_drive_find_all_volumes(m_halContext, halDrive, &numVolumes);
             if (numVolumes == 1)
                 medium = m_mediaList.findById( volumes[0] );
         }
@@ -1626,19 +1509,8 @@
     const char *options[2];
     TQString udi = TQString::null;
 
-    if (!medium->isEncrypted()) {
-        // normal volume
-        udi = medium->id();
-    } else {
-        // see if we have a clear volume
-        LibHalVolume* halVolume = libhal_volume_from_udi(m_halContext, medium->id().latin1());
-        if (halVolume) {
-            char *clearUdi = libhal_volume_crypto_get_clear_volume_udi(m_halContext, halVolume);
-	    udi = clearUdi;
-	    libhal_free_string(clearUdi);
-            libhal_volume_free(halVolume);
-        }
-    }
+    udi = medium->id();
+    
     if (udi.isNull()) {
         kdDebug() << "unmount failed: no udi" << endl;
         return i18n("Internal Error");
@@ -1748,111 +1620,4 @@
     return TQString();
 }
 
-TQString HALBackend::decrypt(const TQString &_udi, const TQString &password)
-{
-    const Medium* medium = m_mediaList.findById(_udi);
-    if (!medium)
-        return i18n("No such medium: %1").arg(_udi);
-
-    if (!medium->isEncrypted() || !medium->clearDeviceUdi().isNull())
-        return TQString();
-
-    const char *udi = medium->id().latin1();
-    DBusMessage *msg = NULL;
-    DBusMessage *reply = NULL;
-    DBusError error;
-
-    kdDebug() << "Setting up " << udi << " for crypto\n" <<endl;
-	
-    msg = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
-                                        "org.freedesktop.Hal.Device.Volume.Crypto",
-                                        "Setup");
-    if (msg == NULL) {
-        kdDebug() << "decrypt failed for " << udi << ": could not create dbus message\n";
-        return i18n("Internal Error");
-    }
-
-    TQCString pwdUtf8 = password.utf8();
-    const char *pwd_utf8 = pwdUtf8;
-    if (!dbus_message_append_args (msg, DBUS_TYPE_STRING, &pwd_utf8, DBUS_TYPE_INVALID)) {
-        kdDebug() << "decrypt failed for " << udi << ": could not append args to dbus message\n";
-        dbus_message_unref (msg);
-        return i18n("Internal Error");
-    }
-
-    dbus_error_init (&error);
-    if (!(reply = dbus_connection_send_with_reply_and_block (dbus_connection, msg, -1, &error)) || 
-        dbus_error_is_set (&error))
-    {
-        TQString qerror = i18n("Internal Error");
-        kdDebug() << "decrypt failed for " << udi << ": " << error.name << " " << error.message << endl;
-        if (strcmp (error.name, "org.freedesktop.Hal.Device.Volume.Crypto.SetupPasswordError") == 0) {
-            qerror = i18n("Wrong password");
-        }
-        dbus_error_free (&error);
-        dbus_message_unref (msg);
-        while (dbus_connection_dispatch(dbus_connection) == DBUS_DISPATCH_DATA_REMAINS) ;
-        return qerror;
-    }
-
-    dbus_message_unref (msg);
-    dbus_message_unref (reply);
-
-    while (dbus_connection_dispatch(dbus_connection) == DBUS_DISPATCH_DATA_REMAINS) ;
-
-    return TQString();
-}
-
-TQString HALBackend::undecrypt(const TQString &_udi)
-{
-    const Medium* medium = m_mediaList.findById(_udi);
-    if (!medium)
-        return i18n("No such medium: %1").arg(_udi);
-
-    if (!medium->isEncrypted() || medium->clearDeviceUdi().isNull())
-        return TQString();
-
-    const char *udi = medium->id().latin1();
-    DBusMessage *msg = NULL;
-    DBusMessage *reply = NULL;
-    DBusError error;
-
-    kdDebug() << "Tear down " << udi << "\n" <<endl;
-	
-    msg = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
-                                        "org.freedesktop.Hal.Device.Volume.Crypto",
-                                        "Teardown");
-    if (msg == NULL) {
-        kdDebug() << "teardown failed for " << udi << ": could not create dbus message\n";
-        return i18n("Internal Error");
-    }
-
-    if (!dbus_message_append_args (msg, DBUS_TYPE_INVALID)) {
-        kdDebug() << "teardown failed for " << udi << ": could not append args to dbus message\n";
-        dbus_message_unref (msg);
-        return i18n("Internal Error");
-    }
-
-    dbus_error_init (&error);
-    if (!(reply = dbus_connection_send_with_reply_and_block (dbus_connection, msg, -1, &error)) || 
-        dbus_error_is_set (&error))
-    {
-        TQString qerror = i18n("Internal Error");
-        kdDebug() << "teardown failed for " << udi << ": " << error.name << " " << error.message << endl;
-        dbus_error_free (&error);
-        dbus_message_unref (msg);
-        while (dbus_connection_dispatch(dbus_connection) == DBUS_DISPATCH_DATA_REMAINS) ;
-        return qerror;
-    }
-
-    dbus_message_unref (msg);
-    dbus_message_unref (reply);
-
-    ResetProperties(udi);
-
-    while (dbus_connection_dispatch(dbus_connection) == DBUS_DISPATCH_DATA_REMAINS) ;
-
-    return TQString();
-}
-
 #include "halbackend.moc"
--- kdebase/kioslave/media/mediamanager/halbackend.h.hal04	2012-09-08 14:15:10.324373357 -0400
+++ kdebase/kioslave/media/mediamanager/halbackend.h	2012-09-08 14:27:34.564678553 -0400
@@ -85,8 +85,6 @@
 	TQString mount(const TQString &id);
 	TQString mount(const Medium *medium);
 	TQString unmount(const TQString &id);
-	TQString decrypt(const TQString &id, const TQString &password);
-	TQString undecrypt(const TQString &id);
 
 private:
 	/**
@@ -152,6 +150,13 @@
 
 /* Hal call-backs -- from gvm*/
 public:
+	/** Invoked by libhal for integration with our mainloop.
+	*
+	*  @param  ctx                 LibHal context
+	*  @param  dbus_connection     D-BUS connection to integrate
+	*/
+	static void hal_main_loop_integration(LibHalContext *ctx, DBusConnection *dbus_connection);
+
 	/** Invoked when a device is added to the Global Device List.
 	*
 	*  @param  ctx                 LibHal context
@@ -184,7 +189,7 @@
 	*/
 	static void hal_device_condition(LibHalContext *ctx, const char *udi,
 				const char *condition_name,
-				const char* message
+				DBusMessage* message
 				);
 
 	TQStringList getHALmountoptions(TQString udi);
@@ -196,9 +201,14 @@
 	LibHalContext*		m_halContext;
 
 	/**
+	* Structure defining the hal callback function for devices events
+	*/
+	LibHalFunctions 	m_halFunctions;
+
+	/**
 	* libhal-storage HAL policy, e.g. for icon names
 	*/
-	LibHalStoragePolicy*	m_halStoragePolicy;
+	HalStoragePolicy*	m_halStoragePolicy;
 
 	/**
 	* The DBus-Qt bindings connection for mainloop integration