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 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>KAuth.Action</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" href="../common/doxygen.css" />
<link rel="stylesheet" media="screen" type="text/css" title="KDE Colors" href="../common/kde.css" />
</head>
<body>
<div id="container">
<div id="header">
<div id="header_top">
<div>
<div>
<img alt ="" src="../common/top-kde.jpg"/>
KDE 4.7 PyKDE API Reference
</div>
</div>
</div>
<div id="header_bottom">
<div id="location">
<ul>
<li>KDE's Python API</li>
</ul>
</div>
<div id="menu">
<ul>
<li><a href="../modules.html">Overview</a></li>
<li><a href="http://techbase.kde.org/Development/Languages/Python">PyKDE Home</a></li>
<li><a href="http://kde.org/family/">Sitemap</a></li>
<li><a href="http://kde.org/contact/">Contact Us</a></li>
</ul>
</div>
</div>
</div>
<div id="body_wrapper">
<div id="body">
<div id="right">
<div class="content">
<div id="main">
<div class="clearer"> </div>
<h1>Action Class Reference</h1>
<code>from PyKDE4.kdecore import *</code>
<p>
Namespace: <a href="../kdecore/KAuth.html">KAuth</a><br />
<h2>Detailed Description</h2>
<p>Class to access, authorize and execute actions.
</p>
<p>
This is the main class of the kauth API. It provides the interface to
manipulate actions. Every action is identified by its name. Every instance
of the Action class with the same name refers to the same action.
</p>
<p>
Once you have an action object you can tell the helper to execute it
(asking the user to authenticate if needed) with one of the execute*() methods.
The simplest thing to do is to execute a single action synchronously
blocking for the reply, using the execute() method.
</p>
<p>
For asynchronous calls, use the executeAsync() method. It sends the request
to the helper and returns immediately. You can optionally provide an object
and a slot. This will be connected to the actionPerformed() signal of the
action's ActionWatcher object.
By calling the watcher() method, you obtain an object that emits some useful
signals that you can receive while the action is in progress. Those signals
are emitted also with the synchronous calls.
To execute a bunch of actions with a single call, you can use the executeActions()
static method. This is not the same as calling executeAsync() for each action,
because the actions are execute with a single request to the helper.
To use any of the execute*() methods you have to set the default helper's ID using
the setHelperID() static method. Alternatively, you can specify the helperID using
the overloaded version of the methods that takes it as a parameter.
</p>
<p>
Each action object contains a QVariantMap object that is passed directly to the
helper when the action is executed. You can access this map using the arguments()
method. You can insert into it any kind of custom data you need to pass to the helper.
</p>
<p>
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.4
</dd></dl>
</p>
<table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2"><br><h2>Enumerations</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="#AuthStatus">AuthStatus</a> </td><td class="memItemRight" valign="bottom">{ Denied, Error, Invalid, Authorized, AuthRequired, UserCancelled }</td></tr>
<tr><td colspan="2"><br><h2>Methods</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#Action">__init__</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#Action">__init__</a> (self, <a href="../kdecore/KAuth.Action.html">KAuth.Action</a> action)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#Action">__init__</a> (self, QString name)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#Action">__init__</a> (self, QString name, QString details)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#addArgument">addArgument</a> (self, QString key, QVariant value)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">{QString:QVariant} </td><td class="memItemRight" valign="bottom"><a class="el" href="#arguments">arguments</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KAuth.Action.html#AuthStatus">KAuth.Action.AuthStatus</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#authorize">authorize</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><a class="el" href="#details">details</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KAuth.Action.html#AuthStatus">KAuth.Action.AuthStatus</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#earlyAuthorize">earlyAuthorize</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KAuth.ActionReply.html">KAuth.ActionReply</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#execute">execute</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KAuth.ActionReply.html">KAuth.ActionReply</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#execute">execute</a> (self, QString helperID)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#executesAsync">executesAsync</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#hasHelper">hasHelper</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><a class="el" href="#helperID">helperID</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#isValid">isValid</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><a class="el" href="#name">name</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#operator !=">operator !=</a> (self, <a href="../kdecore/KAuth.Action.html">KAuth.Action</a> action)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#operator ==">operator ==</a> (self, <a href="../kdecore/KAuth.Action.html">KAuth.Action</a> action)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QWidget </td><td class="memItemRight" valign="bottom"><a class="el" href="#parentWidget">parentWidget</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setArguments">setArguments</a> (self, {QString:QVariant} arguments)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setDetails">setDetails</a> (self, QString details)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setExecutesAsync">setExecutesAsync</a> (self, bool async)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setHelperID">setHelperID</a> (self, QString id)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setName">setName</a> (self, QString name)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setParentWidget">setParentWidget</a> (self, QWidget parent)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KAuth.Action.html#AuthStatus">KAuth.Action.AuthStatus</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#status">status</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#stop">stop</a> (self)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#stop">stop</a> (self, QString helperID)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../kdecore/KAuth.ActionWatcher.html">KAuth.ActionWatcher</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#watcher">watcher</a> (self)</td></tr>
<tr><td colspan="2"><br><h2>Static Methods</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#executeActions">executeActions</a> ([<a href="../kdecore/KAuth.Action.html">KAuth.Action</a>] actions, [<a href="../kdecore/KAuth.Action.html">KAuth.Action</a>] deniedActions, QString helperId)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#executeActions">executeActions</a> ([<a href="../kdecore/KAuth.Action.html">KAuth.Action</a>] actions, [<a href="../kdecore/KAuth.Action.html">KAuth.Action</a>] deniedActions, QString helperId, QWidget parent)</td></tr>
</table>
<hr><h2>Method Documentation</h2><a class="anchor" name="Action"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Default constructor
</p>
<p>
This constructor sets the name to the empty string.
Such an action is invalid and cannot be authorized nor executed, so
you need to call setName() before you can use the object.
</p></div></div><a class="anchor" name="Action"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KAuth.Action.html">KAuth.Action</a> </td>
<td class="paramname"><em>action</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Copy constructor
</p></div></div><a class="anchor" name="Action"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString </td>
<td class="paramname"><em>name</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>This creates a new action object with this name
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>name</em> </td><td> The name of the new action
</td></tr>
</table></dl>
<p>
</p></div></div><a class="anchor" name="Action"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">__init__</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString </td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString </td>
<td class="paramname"><em>details</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>This creates a new action object with this name and details
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>name</em> </td><td> The name of the new action
<tr><td></td><td valign="top"><em>details</em> </td><td> The details of the action
</td></tr>
</table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> setDetails
</dd></dl>
</p></div></div><a class="anchor" name="addArgument"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> addArgument</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString </td>
<td class="paramname"><em>key</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QVariant </td>
<td class="paramname"><em>value</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Convenience method to add an argument.
</p>
<p>
This method adds the pair key/value to the QVariantMap used to
send custom data to the helper.
</p>
<p>
Use this method if you don't want to create a new QVariantMap only to
add a new entry.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>key</em> </td><td> The new entry's key
<tr><td></td><td valign="top"><em>value</em> </td><td> The value of the new entry
</td></tr>
</table></dl>
<p>
</p></div></div><a class="anchor" name="arguments"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">{QString:QVariant} arguments</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns map object used to pass arguments to the helper.
</p>
<p>
This method returns the variant map that the application
can use to pass arbitrary data to the helper when executing the action.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> The arguments map that will be passed to the helper.
</dd></dl>
</p></div></div><a class="anchor" name="authorize"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KAuth.Action.html#AuthStatus">KAuth.Action.AuthStatus</a> authorize</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Acquires authorization for an action without excuting it.
</p>
<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd> Please use this method if you really know what you are doing. If you are
implementing a GUI, you probably should look into earlyAuthorize instead.
</dd></dl> </p>
<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd> Please remember that calling this method is not required for a successful action
execution: it is safe and advised to call execute() only, without a previous call
to authorize or earlyAuthorize.
</dd></dl> </p>
<p>
This method acquires the authorization rights for the action, asking
the user to authenticate if needed. It tries very hard to resolve a possible
challenge (AuthRequired); for this reason, it is meant only for advanced usages.
If you are unsure, always use earlyAuthorize or execute the action directly.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> The result of the authorization process
</dd></dl> </p>
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd> earlyAuthorize
</dd></dl>
</p></div></div><a class="anchor" name="details"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString details</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Gets the action's details
</p>
<p>
The details that will be shown in the authorization dialog, if the
backend supports it.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> The action's details
</dd></dl>
</p></div></div><a class="anchor" name="earlyAuthorize"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KAuth.Action.html#AuthStatus">KAuth.Action.AuthStatus</a> earlyAuthorize</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Tries to resolve authorization status in the best possible way without executing the action
</p>
<p>
This method checks for the status of the action, and tries to acquire authorization
(if needed) if the backend being used supports client-side authorization.
</p>
<p>
This means this method is not reliable - its purpose is to provide user interfaces with
an efficient means to acquire authorization as early as possible, without interrupting
the user's workflow. If the backend's authentication phase happens in the helper and the
action requires authentication, Authorized will be returned.
</p>
<p>
The main difference with authorize is that this method does not try to acquire authorization
if the backend's authentication phase happens in the helper: using authorize in such a case
might lead to ask the user its password twice, as the helper might time out, or in the case
of a one shot authorization, the scope of the authorization would end with the authorization
check itself. For this reason, you should <b>always</b> use this method instead of authorize, which
is meant only for very advanced usages.
</p>
<p>
This method is always safe to be called and used before an execution, even if not needed.
</p>
<p>
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.5
</dd></dl> </p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> The result of the early authorization process, with the caveats described above.
</dd></dl>
</p></div></div><a class="anchor" name="execute"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KAuth.ActionReply.html">KAuth.ActionReply</a> execute</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Synchronously executes the action with a specific helperID
</p>
<p>
This method does the exact same thing as execute(), but it takes a specific helperID, useful
if you don't want to use the default one without changing it with setHelperID()
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>helperID</em> </td><td> The helper ID to use for the execution of this action
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> The reply from the helper, or an error if something's wrong.
</dd></dl>
</p></div></div><a class="anchor" name="execute"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KAuth.ActionReply.html">KAuth.ActionReply</a> execute</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString </td>
<td class="paramname"><em>helperID</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Synchronously executes the action with a specific helperID
</p>
<p>
This method does the exact same thing as execute(), but it takes a specific helperID, useful
if you don't want to use the default one without changing it with setHelperID()
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>helperID</em> </td><td> The helper ID to use for the execution of this action
</td></tr> </table></dl>
<p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> The reply from the helper, or an error if something's wrong.
</dd></dl>
</p></div></div><a class="anchor" name="executesAsync"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool executesAsync</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"></div></div><a class="anchor" name="hasHelper"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool hasHelper</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Checks if the action has an helper
</p>
<p>
This function can be used to check if an helper will be called upon the
execution of an action. Such an helper can be set through setHelperID. If
this function returns false, upon execution the action will be just authorized.
</p>
<p>
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.5
</dd></dl> </p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> Whether the action has an helper or not
</dd></dl> </p>
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd> setHelperID
</dd></dl>
</p></div></div><a class="anchor" name="helperID"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString helperID</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Gets the default helper ID used for actions execution
</p>
<p>
The helper ID is the string that uniquely identifies the helper in
the system. It is the string passed to the KDE4_AUTH_HELPER() macro
in the helper source. Because one could have different helpers,
you need to specify an helper ID for each execution, or set a default
ID by calling setHelperID(). This method returns the current default
value.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> The default helper ID.
</dd></dl>
</p></div></div><a class="anchor" name="isValid"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool isValid</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns if the object represents a valid action
</p>
<p>
Action names have to respect a simple syntax.
They have to be all in lowercase characters, separated
by dots. Dots can't appear at the beginning and at the end of
the name.
</p>
<p>
In other words, the action name has to match this perl-like
regular expression:
@verbatim
/^[a-z]+(\.[a-z]+)*$/
@endverbatim
</p>
<p>
This method returns false if the action name doesn't match the
valid syntax.
</p>
<p>
If the backend supports it, this method also checks if the action is
valid and recognized by the backend itself.
</p>
<p>
Invalid actions cannot be authorized nor executed.
The empty string is not a valid action name, so the default
constructor returns an invalid action.
</p></div></div><a class="anchor" name="name"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QString name</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Gets the action's name.
</p>
<p>
This is the unique attribute that identifies
an action object. Two action objects with the same
name always refer to the same action.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> The action name
</dd></dl>
</p></div></div><a class="anchor" name="operator !="></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool operator !=</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KAuth.Action.html">KAuth.Action</a> </td>
<td class="paramname"><em>action</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Negated comparison operator
</p>
<p>
Returns the negation of operator==
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if the two actions are different and not both invalid
</dd></dl>
</p></div></div><a class="anchor" name="operator =="></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool operator ==</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype"><a href="../kdecore/KAuth.Action.html">KAuth.Action</a> </td>
<td class="paramname"><em>action</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Comparison operator
</p>
<p>
This comparison operator compares the <b>names</b> of two
actions and returns whether they are the same. It does not
care about the arguments stored in the actions. However,
if two actions are invalid they'll match as equal, even
if the invalid names are different.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> true if the two actions are the same or both invalid
</dd></dl>
</p></div></div><a class="anchor" name="parentWidget"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">QWidget parentWidget</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Returns the parent widget for the authentication dialog for this action
</p>
<p>
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.6
</dd></dl> </p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> A QWidget which will is being used as the dialog's parent
</dd></dl>
</p></div></div><a class="anchor" name="setArguments"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setArguments</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">{QString:QVariant} </td>
<td class="paramname"><em>arguments</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Sets the map object used to pass arguments to the helper.
</p>
<p>
This method sets the variant map that the application
can use to pass arbitrary data to the helper when executing the action.
</p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>arguments</em> </td><td> The new arguments map
</td></tr>
</table></dl>
<p>
</p></div></div><a class="anchor" name="setDetails"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setDetails</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString </td>
<td class="paramname"><em>details</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Sets the action's details
</p>
<p>
You can use this function to provide the user more details
(if the backend supports it) on the action being authorized in
the authorization dialog
</p></div></div><a class="anchor" name="setExecutesAsync"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setExecutesAsync</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>async</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"></div></div><a class="anchor" name="setHelperID"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setHelperID</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString </td>
<td class="paramname"><em>id</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Sets the default helper ID used for actions execution
</p>
<p>
This method sets the helper ID which contains the body of this action.
If the string is non-empty, the corresponding helper will be fired and
the action executed inside the helper. Otherwise, the action will be just
authorized.
</p>
<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd> To unset a previously set helper, just pass an empty string
</dd></dl> </p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>id</em> </td><td> The default helper ID.
</td></tr>
</table></dl>
<p> <dl class="see" compact><dt><b>See also:</b></dt><dd> hasHelper
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> helperID
</dd></dl>
</p></div></div><a class="anchor" name="setName"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setName</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString </td>
<td class="paramname"><em>name</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Sets the action's name.
</p>
<p>
It's not common to change the action name
after its creation. Usually you set the name
with the constructor (and you have to, because
there's no default constructor)
</p></div></div><a class="anchor" name="setParentWidget"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> setParentWidget</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QWidget </td>
<td class="paramname"><em>parent</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Sets a parent widget for the authentication dialog
</p>
<p>
This function is used for explicitly setting a parent window for an eventual authentication dialog required when
authorization is triggered. Some backends, in fact, (like polkit-1) need to have a parent explicitly set for displaying
the dialog correctly.
</p>
<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd> If you are using KAuth through one of KDE's GUI components (KPushButton, KCModule...) you do not need and should not
call this function, as it is already done by the component itself.
</dd></dl> </p>
<p>
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.6
</dd></dl> </p>
<p>
</p><dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign="top"><em>parent</em> </td><td> A QWidget which will be used as the dialog's parent
</td></tr>
</table></dl>
<p>
</p></div></div><a class="anchor" name="status"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KAuth.Action.html#AuthStatus">KAuth.Action.AuthStatus</a> status</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Gets information about the authorization status of an action
</p>
<p>
This methods query the authorization backend to know if the user can try
to acquire the authorization for this action. If the result is Action.AuthRequired,
the user can try to acquire the authorization by authenticating.
</p>
<p>
It should not be needed to call this method directly, because the execution methods
already take care of all the authorization stuff.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> Action.Denied if the user doesn't have the authorization to execute the action,
</dd></dl> Action.Authorized if the action can be executed,
Action.AuthRequired if the user could acquire the authorization after authentication,
Action.UserCancelled if the user cancels the authentication dialog. Not currently supported by the Polkit backend
</p></div></div><a class="anchor" name="stop"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> stop</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Ask the helper to stop executing an action, using a specific helper ID
</p>
<p>
This method works exactly as the stop() method, but it lets you specify an helper ID different from the
default one.
</p>
<p>
To stop an action you need to send the stop request to the helper that is executing that action. This of course means you have to
use the same helperID used for the execution call (either passed as a parameter or set as default with setHelperID() )
</p></div></div><a class="anchor" name="stop"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"> stop</td>
<td>(</td>
<td class="paramtype"> <em>self</em>, </td>
<td class="paramname"></td>
</tr><tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString </td>
<td class="paramname"><em>helperID</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Ask the helper to stop executing an action, using a specific helper ID
</p>
<p>
This method works exactly as the stop() method, but it lets you specify an helper ID different from the
default one.
</p>
<p>
To stop an action you need to send the stop request to the helper that is executing that action. This of course means you have to
use the same helperID used for the execution call (either passed as a parameter or set as default with setHelperID() )
</p></div></div><a class="anchor" name="watcher"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname"><a href="../kdecore/KAuth.ActionWatcher.html">KAuth.ActionWatcher</a> watcher</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>self</em> )</td>
<td width="100%"> </td>
</tr>
</table>
</div>
<div class="memdoc"><p>Gets the ActionWatcher object for this action
</p>
<p>
ActionWatcher objects are used to get notifications about the action
execution status. Every action watcher is tied to an action and
every action has a watcher. This means that if you call this method
on two different Action objects with the same name, you'll get the
same watcher object.
</p>
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd> The action watcher for this action
</dd></dl>
</p></div></div><hr><h2>Static Method Documentation</h2><a class="anchor" name="executeActions"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool executeActions</td>
<td>(</td>
<td class="paramtype">[<a href="../kdecore/KAuth.Action.html">KAuth.Action</a>] </td>
<td class="paramname"><em>actions</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">[<a href="../kdecore/KAuth.Action.html">KAuth.Action</a>] </td>
<td class="paramname"><em>deniedActions</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString </td>
<td class="paramname"><em>helperId</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Convenience overload. This overload lets you specify, in addition, a QWidget which will be used as the
authentication dialog's parent.
</p>
<p>
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.6
</dd></dl> </p>
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd> executeActions
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> setParentWidget
</dd></dl>
</p></div></div><a class="anchor" name="executeActions"></a>
<div class="memitem">
<div class="memproto">
<table class="memname"><tr>
<td class="memname">bool executeActions</td>
<td>(</td>
<td class="paramtype">[<a href="../kdecore/KAuth.Action.html">KAuth.Action</a>] </td>
<td class="paramname"><em>actions</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">[<a href="../kdecore/KAuth.Action.html">KAuth.Action</a>] </td>
<td class="paramname"><em>deniedActions</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QString </td>
<td class="paramname"><em>helperId</em>, </td>
</tr>
<tr>
<td class="memname"></td>
<td></td>
<td class="paramtype">QWidget </td>
<td class="paramname"><em>parent</em></td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td>
<td></td>
<td width="100%"> </td>
</tr></table>
</div>
<div class="memdoc"><p>Convenience overload. This overload lets you specify, in addition, a QWidget which will be used as the
authentication dialog's parent.
</p>
<p>
<dl class="since" compact><dt><b>Since:</b></dt><dd> 4.6
</dd></dl> </p>
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd> executeActions
</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd> setParentWidget
</dd></dl>
</p></div></div><hr><h2>Enumeration Documentation</h2><a class="anchor" name="AuthStatus"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr><td class="memname">AuthStatus</td>
</tr>
</table>
</div>
<div class="memdoc"><p>The three values returned by authorization methods
</p><dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0"><tr><td valign="top"><em>Denied</em> </td><td><tr><td valign="top"><em>Error</em> </td><td><tr><td valign="top"><em>Invalid</em> </td><td><tr><td valign="top"><em>Authorized</em> </td><td><tr><td valign="top"><em>AuthRequired</em> </td><td><tr><td valign="top"><em>UserCancelled</em> </td><td></table>
</dl>
</div></div><p>
</div>
</div>
</div>
<div id="left">
<div class="menu_box">
<div class="nav_list">
<ul>
<li><a href="../allclasses.html">Full Index</a></li>
</ul>
</div>
<a name="cp-menu" /><div class="menutitle"><div>
<h2 id="cp-menu-project">Modules</h2>
</div></div>
<div class="nav_list">
<ul><li><a href="../akonadi/index.html">akonadi</a></li>
<li><a href="../dnssd/index.html">dnssd</a></li>
<li><a href="../kdecore/index.html">kdecore</a></li>
<li><a href="../kdeui/index.html">kdeui</a></li>
<li><a href="../khtml/index.html">khtml</a></li>
<li><a href="../kio/index.html">kio</a></li>
<li><a href="../knewstuff/index.html">knewstuff</a></li>
<li><a href="../kparts/index.html">kparts</a></li>
<li><a href="../kutils/index.html">kutils</a></li>
<li><a href="../nepomuk/index.html">nepomuk</a></li>
<li><a href="../phonon/index.html">phonon</a></li>
<li><a href="../plasma/index.html">plasma</a></li>
<li><a href="../polkitqt/index.html">polkitqt</a></li>
<li><a href="../solid/index.html">solid</a></li>
<li><a href="../soprano/index.html">soprano</a></li>
</ul></div></div>
</div>
</div>
<div class="clearer"/>
</div>
<div id="end_body"></div>
</div>
<div id="footer"><div id="footer_text">
This documentation is maintained by <a href="mailto:simon@simonzone.com">Simon Edwards</a>.<br />
KDE<sup>®</sup> and <a href="../images/kde_gear_black.png">the K Desktop Environment<sup>®</sup> logo</a> are registered trademarks of <a href="http://ev.kde.org/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> |
<a href="http://www.kde.org/contact/impressum.php">Legal</a>
</div></div>
</body>
</html>
|