Add kgetcred ability

pull/1/head
Timothy Pearson 13 years ago
parent 4973863521
commit 3dbc24a1be

@ -8,4 +8,4 @@ Terminal=false
DocPath=kerberostray/index.html
X-KDE-StartupNotify=true
X-DCOP-ServiceType=Multi
Categories=Qt;KDE;Utilities;
Categories=Qt;KDE;Utility;

@ -51,6 +51,7 @@
#include <kdialogbase.h>
#include <kaction.h>
#include <knotifydialog.h>
#include <klineeditdlg.h>
#include <libtdeldap.h>
#include "configdlg.h"
@ -67,6 +68,7 @@ TopLevel::TopLevel() : KSystemTray(), ticketWatch(0), m_refreshTimer(0), notifyE
getNewTGTAct = new KAction(i18n("&Obtain New Ticket Granting Ticket"), "add_user", 0, TQT_TQOBJECT(this), TQT_SLOT(getNewTGT()), actionCollection(), "getnewtgt");
getNewSTAct = new KAction(i18n("&Obtain New Primary Service Ticket"), "add_user", 0, TQT_TQOBJECT(this), TQT_SLOT(getNewServiceTicket()), actionCollection(), "getnewserviceticket");
getNewStandardSTAct = new KAction(i18n("&Obtain Authenticated Service Ticket"), "add_user", 0, TQT_TQOBJECT(this), TQT_SLOT(getNewServiceTicketWithExistingCreds()), actionCollection(), "getstandardserviceticket");
destroyAllAct = new KAction(i18n("&Destroy All Tickets"), "delete_user", 0, TQT_TQOBJECT(this), TQT_SLOT(destroyAllTickets()), actionCollection(), "destroyall");
confAct = new KAction(i18n("&Configure..."), "configure", 0, TQT_TQOBJECT(this), TQT_SLOT(config()), actionCollection(), "configure");
@ -80,6 +82,7 @@ TopLevel::TopLevel() : KSystemTray(), ticketWatch(0), m_refreshTimer(0), notifyE
menu->insertSeparator();
getNewTGTAct->plug(menu);
getNewSTAct->plug(menu);
getNewStandardSTAct->plug(menu);
destroyAllAct->plug(menu);
menu->insertSeparator();
confAct->plug(menu);
@ -161,6 +164,15 @@ void TopLevel::updateTicketList() {
ticketWatch->startScan();
}
if (m_ticketList.count() > 0) {
getNewStandardSTAct->setEnabled(true);
destroyAllAct->setEnabled(true);
}
else {
getNewStandardSTAct->setEnabled(false);
destroyAllAct->setEnabled(false);
}
repaint();
}
@ -231,6 +243,19 @@ void TopLevel::getNewServiceTicket() {
getNewTicket(true);
}
void TopLevel::getNewServiceTicketWithExistingCreds() {
TQString errorstring;
TQString service;
bool ok;
service = KLineEditDlg::getText(i18n("Enter the name of the Kerberos service principal you wish to obtain"), TQString::null, &ok, this);
if (ok) {
if (LDAPManager::obtainKerberosServiceTicket(service, &errorstring) != 0) {
KMessageBox::error(this, i18n("<qt>Failed to obtain service ticket<p>%1</qt>").arg(errorstring), i18n("Failed to obtain Kerberos service ticket"));
}
}
}
void TopLevel::destroyAllTickets() {
if (system("kdestroy --all") != 0) {
KMessageBox::error(this, i18n("Unable to destroy tickets!"), i18n("Internal Error"));
@ -238,7 +263,7 @@ void TopLevel::destroyAllTickets() {
updateTicketList();
}
void TopLevel::resizeEvent ( TQResizeEvent * )
void TopLevel::resizeEvent (TQResizeEvent *)
{
activeTicketsPixmap = loadSizedIcon("kerberos_activetickets", width());
noTicketsPixmap = loadSizedIcon("kerberos_notickets", width());
@ -357,7 +382,7 @@ void TopLevel::showTicketList() {
TQString listText = "<qt>";
updateTicketList();
if (m_ticketList.count() <= 0) {
listText += "<i>No Kerberos tickets to display!</i>";
listText += "No Kerberos tickets available";
}
else {
i = 1;

@ -68,6 +68,7 @@ private slots:
void updateMenu();
void getNewTGT();
void getNewServiceTicket();
void getNewServiceTicketWithExistingCreds();
void getNewTicket(bool requestServiceTicket=false);
void destroyAllTickets();
void showTicketList();
@ -82,6 +83,7 @@ private:
KAction *confAct;
KAction *getNewTGTAct;
KAction *getNewSTAct;
KAction *getNewStandardSTAct;
KAction *destroyAllAct;
TQPopupMenu *menu;
TQString lastTip;

Loading…
Cancel
Save