• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

storepassbar.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002  *
00003  * Copyright (C) 2009 Eduardo Robles Elvira <edulix at gmail dot com>
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public License
00016  * along with this library; see the file COPYING.LIB.  If not, write to
00017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #include "storepassbar.h"
00022 
00023 #include "khtmlviewbar.h"
00024 #include "khtml_part.h"
00025 #include "khtmlview.h"
00026 #include <kcolorscheme.h>
00027 #include <QPalette>
00028 
00029 StorePassBar::StorePassBar( QWidget *parent ) :
00030   KHTMLViewBarWidget( true, parent )
00031 {
00032   setupUi( centralWidget() );
00033 
00034   m_store->setIcon( KIcon( "document-save" ) );
00035   // Same as KStandardGuiItem::no()
00036   m_neverForThisSite->setIcon( KIcon( "process-stop" ) ); 
00037   m_doNotStore->setIcon( KIcon( "dialog-cancel" ) );
00038   centralWidget()->setFocusProxy( m_store );
00039   
00040   QPalette pal = palette();
00041   KColorScheme::adjustBackground(pal, KColorScheme::ActiveBackground);
00042   setPalette(pal);
00043   setBackgroundRole(QPalette::Base);
00044   setAutoFillBackground(true);
00045 
00046   connect( m_store, SIGNAL(clicked()), this, SIGNAL(storeClicked()) );
00047   connect( m_neverForThisSite, SIGNAL(clicked()), this,
00048     SIGNAL(neverForThisSiteClicked()) );
00049   connect( m_doNotStore, SIGNAL(clicked()), this,
00050     SIGNAL(doNotStoreClicked()) );
00051 
00052   m_store->setFocus();
00053 }
00054 
00055 
00056 void StorePassBar::setHost(const QString& host)
00057 {
00058   if(host.isEmpty())
00059     m_label->setText( i18n("Do you want to store this password?") );
00060   else
00061     m_label->setText( i18n("Do you want to store this password for %1?", host) );
00062 }
00063 
00064 
00065 
00066 StorePass::StorePass( KHTMLPart *part ) :
00067   m_part( part )
00068 {
00069   connect( &m_storePassBar, SIGNAL(storeClicked()), this, SLOT(slotStoreClicked()) );
00070   connect( &m_storePassBar, SIGNAL(neverForThisSiteClicked()), this,
00071     SLOT(slotNeverForThisSiteClicked()) );
00072   connect( &m_storePassBar, SIGNAL(doNotStoreClicked()), this,
00073     SLOT(slotDoNotStoreClicked()) );
00074 }
00075 
00076 StorePass::~StorePass()
00077 {
00078 }
00079 
00080 void StorePass::saveLoginInformation(const QString& host, const QString& key,
00081   const QMap<QString, QString>& walletMap)
00082 {
00083   m_host = host;
00084   m_key = key;
00085   m_walletMap = walletMap;
00086   m_storePassBar.setHost(host);
00087   
00088   m_part->pTopViewBar()->addBarWidget( &m_storePassBar );
00089   m_part->pTopViewBar()->showBarWidget( &m_storePassBar );
00090 }
00091 
00092 void StorePass::removeBar()
00093 {
00094   m_part->pTopViewBar()->hideCurrentBarWidget();
00095   m_walletMap.clear();
00096   m_host = m_key = "";
00097   m_storePassBar.setHost(m_host);
00098 }
00099 
00100 void StorePass::slotStoreClicked()
00101 {
00102   m_part->saveToWallet(m_key, m_walletMap);
00103   removeBar();
00104 }
00105 
00106 void StorePass::slotNeverForThisSiteClicked()
00107 {
00108   m_part->view()->addNonPasswordStorableSite(m_host);
00109   removeBar();
00110 }
00111     
00112 void StorePass::slotDoNotStoreClicked()
00113 {
00114   removeBar();
00115 }

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal