1 /***************************************************************************
2     The configuration page for the authentication settings of Smb4K
3                              -------------------
4     begin                : Sa Nov 15 2003
5     copyright            : (C) 2003-2019 by Alexander Reinholdt
6     email                : alexander.reinholdt@kdemail.net
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *   This program is free software; you can redistribute it and/or modify  *
11  *   it under the terms of the GNU General Public License as published by  *
12  *   the Free Software Foundation; either version 2 of the License, or     *
13  *   (at your option) any later version.                                   *
14  *                                                                         *
15  *   This program is distributed in the hope that it will be useful, but   *
16  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
17  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
18  *   General Public License for more details.                              *
19  *                                                                         *
20  *   You should have received a copy of the GNU General Public License     *
21  *   along with this program; if not, write to the                         *
22  *   Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,*
23  *   MA 02110-1335, USA                                                    *
24  ***************************************************************************/
25 
26 // application specific includes
27 #include "smb4kconfigpageauthentication.h"
28 #include "core/smb4ksettings.h"
29 
30 // Qt includes
31 #include <QMouseEvent>
32 #include <QHeaderView>
33 #include <QListWidgetItem>
34 #include <QCheckBox>
35 #include <QGroupBox>
36 #include <QGridLayout>
37 #include <QPushButton>
38 #include <QTableWidget>
39 #include <QAction>
40 
41 // KDE includes
42 #include <KI18n/KLocalizedString>
43 #include <KIconThemes/KIconLoader>
44 #include <KWidgetsAddons/KCollapsibleGroupBox>
45 
46 
Smb4KConfigPageAuthentication(QWidget * parent)47 Smb4KConfigPageAuthentication::Smb4KConfigPageAuthentication(QWidget *parent) : QWidget(parent)
48 {
49   m_entries_displayed = false;
50   m_maybe_changed = false;
51 
52   //
53   // Layout
54   //
55   QVBoxLayout *layout = new QVBoxLayout(this);
56 
57   //
58   // Settings group box
59   //
60   QGroupBox *settingsBox = new QGroupBox(i18n("Settings"), this);
61   QVBoxLayout *settingsBoxLayout = new QVBoxLayout(settingsBox);
62 
63   // Wallet usage
64   QCheckBox *useWallet = new QCheckBox(Smb4KSettings::self()->useWalletItem()->label(), settingsBox);
65   useWallet->setObjectName("kcfg_UseWallet");
66 
67   connect(useWallet, SIGNAL(toggled(bool)), this, SLOT(slotKWalletButtonToggled(bool)));
68 
69   settingsBoxLayout->addWidget(useWallet, 0);
70 
71   // Default login
72   QCheckBox *defaultAuth  = new QCheckBox(Smb4KSettings::self()->useDefaultLoginItem()->label(), settingsBox);
73   defaultAuth->setObjectName("kcfg_UseDefaultLogin");
74 
75   connect(defaultAuth, SIGNAL(toggled(bool)), this, SLOT(slotDefaultLoginToggled(bool)));
76 
77   settingsBoxLayout->addWidget(defaultAuth, 0);
78 
79   layout->addWidget(settingsBox, 0);
80 
81   //
82   // Wallet Entries group box
83   //
84   QGroupBox *walletEntriesBox = new QGroupBox(i18n("Wallet Entries"), this);
85   QVBoxLayout *walletEntriesBoxLayout = new QVBoxLayout(walletEntriesBox);
86   walletEntriesBoxLayout->setContentsMargins(0, 0, 0, 0);
87 
88   //
89   // Wallet Entries editor
90   //
91   QWidget *walletEntriesEditor = new QWidget(walletEntriesBox);
92   walletEntriesEditor->setObjectName("WalletEntriesEditor");
93   QGridLayout *walletEntriesEditorLayout= new QGridLayout(walletEntriesEditor);
94 
95   //
96   // The list view
97   //
98   QListWidget *walletEntriesWidget = new QListWidget(walletEntriesEditor);
99   walletEntriesWidget->setObjectName("WalletEntriesWidget");
100   walletEntriesWidget->setDragDropMode(QListWidget::NoDragDrop);
101   walletEntriesWidget->setSelectionMode(QListWidget::SingleSelection);
102   walletEntriesWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
103   walletEntriesWidget->viewport()->installEventFilter(this);
104 
105   // Edit action
106   QAction *editAction = new QAction(KDE::icon("edit-rename"), i18n("Edit"), walletEntriesWidget);
107   editAction->setObjectName("EditAction");
108   editAction->setEnabled(false);
109   connect(editAction, SIGNAL(triggered(bool)), this, SLOT(slotEditClicked()));
110   walletEntriesWidget->addAction(editAction);
111 
112   // Remove action
113   QAction *removeAction = new QAction(KDE::icon("edit-delete"), i18n("Remove"), walletEntriesWidget);
114   removeAction->setObjectName("RemoveAction");
115   removeAction->setEnabled(false);
116   connect(removeAction, SIGNAL(triggered(bool)), this, SLOT(slotRemoveClicked()));
117   walletEntriesWidget->addAction(removeAction);
118 
119   // Clear action
120   QAction *clearAction = new QAction(KDE::icon("edit-clear-list"), i18n("Clear"), walletEntriesWidget);
121   clearAction->setObjectName("ClearAction");
122   clearAction->setEnabled(false);
123   connect(clearAction, SIGNAL(triggered(bool)), this, SLOT(slotClearClicked()));
124   walletEntriesWidget->addAction(clearAction);
125 
126   connect(walletEntriesWidget, SIGNAL(itemSelectionChanged()), this, SLOT(slotItemSelectionChanged()));
127 
128   walletEntriesEditorLayout->addWidget(walletEntriesWidget, 0, 0, 7, 1);
129 
130   //
131   // Load button
132   //
133   QPushButton *loadButton = new QPushButton(walletEntriesEditor);
134   loadButton->setObjectName("LoadButton");
135   loadButton->setText(i18n("Load"));
136   loadButton->setIcon(KDE::icon("document-open"));
137   loadButton->setWhatsThis(i18n("The login information that was stored by Smb4K will be loaded from the wallet."));
138 
139   connect(loadButton, SIGNAL(clicked(bool)), this, SIGNAL(loadWalletEntries()));
140 
141   walletEntriesEditorLayout->addWidget(loadButton, 0, 1);
142 
143   //
144   // Save button
145   //
146   QPushButton *saveButton = new QPushButton(walletEntriesEditor);
147   saveButton->setObjectName("SaveButton");
148   saveButton->setText(i18n("Save"));
149   saveButton->setIcon(KDE::icon("document-save-all"));
150   saveButton->setWhatsThis(i18n("All modifications you applied are saved to the wallet."));
151   saveButton->setEnabled(false);
152 
153   connect(saveButton, SIGNAL(clicked(bool)), this, SIGNAL(saveWalletEntries()));
154   connect(saveButton, SIGNAL(clicked(bool)), this, SLOT(slotSaveClicked(bool)));
155 
156   walletEntriesEditorLayout->addWidget(saveButton, 1, 1);
157   walletEntriesEditorLayout->addItem(new QSpacerItem(0, 10, QSizePolicy::Fixed, QSizePolicy::Fixed), 2, 1);
158 
159   //
160   // The details widget
161   //
162   KCollapsibleGroupBox *detailsBox = new KCollapsibleGroupBox(walletEntriesEditor);
163   detailsBox->setObjectName("DetailsBox");
164   detailsBox->setTitle(i18n("Details"));
165   detailsBox->setEnabled(false);
166   QVBoxLayout *detailsBoxLayout = new QVBoxLayout(detailsBox);
167 
168   QTableWidget *detailsWidget = new QTableWidget(detailsBox);
169   detailsWidget->setObjectName("DetailsWidget");
170   detailsWidget->horizontalHeader()->setVisible(false);
171   detailsWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
172   detailsWidget->verticalHeader()->setVisible(false);
173   detailsWidget->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
174   detailsWidget->viewport()->installEventFilter(this);
175 
176   detailsBoxLayout->addWidget(detailsWidget, 0);
177 
178   walletEntriesEditorLayout->addWidget(detailsBox, 5, 1);
179   walletEntriesEditorLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding), 6, 1);
180 
181   walletEntriesBoxLayout->addWidget(walletEntriesEditor, 0);
182 
183   layout->addWidget(walletEntriesBox, 0);
184 
185   //
186   // Adjustments
187   //
188   slotKWalletButtonToggled(useWallet->isChecked());
189   slotDefaultLoginToggled(defaultAuth->isChecked());
190 
191   //
192   // Set focus
193   //
194   loadButton->setFocus();
195 }
196 
197 
~Smb4KConfigPageAuthentication()198 Smb4KConfigPageAuthentication::~Smb4KConfigPageAuthentication()
199 {
200 }
201 
202 
insertWalletEntries(const QList<Smb4KAuthInfo * > & list)203 void Smb4KConfigPageAuthentication::insertWalletEntries(const QList<Smb4KAuthInfo *> &list)
204 {
205   //
206   // Insert the list of authentication information
207   //
208   m_entriesList = list;
209 
210   //
211   // Reset the changed flag, since we are (re)loading the information
212   //
213   m_maybe_changed = false;
214   emit walletEntriesModified();
215 
216   //
217   // Get the list wirdget
218   //
219   QListWidget *walletEntriesWidget = findChild<QListWidget *>("WalletEntriesWidget");
220 
221 
222   //
223   // Clear the list widget
224   //
225   walletEntriesWidget->clear();
226 
227   //
228   // Insert the authentication information entries into the
229   // list widget
230   //
231   for (Smb4KAuthInfo *authInfo : m_entriesList)
232   {
233     switch (authInfo->type())
234     {
235       case UnknownNetworkItem:
236       {
237         (void) new QListWidgetItem(KDE::icon("dialog-password"), i18n("Default Login"), walletEntriesWidget);
238         break;
239       }
240       default:
241       {
242         (void) new QListWidgetItem(KDE::icon("dialog-password"), authInfo->displayString(), walletEntriesWidget);
243         break;
244       }
245     }
246   }
247 
248   //
249   // Sort the entries
250   //
251   walletEntriesWidget->sortItems();
252 
253   //
254   // Set the display flag to true
255   //
256   m_entries_displayed = true;
257 
258   //
259   // Enable buttons and actions
260   //
261   findChild<QPushButton *>("SaveButton")->setEnabled(walletEntriesWidget->count() != 0);
262   findChild<QAction *>("ClearAction")->setEnabled(walletEntriesWidget->count() != 0);
263 }
264 
265 
eventFilter(QObject * object,QEvent * e)266 bool Smb4KConfigPageAuthentication::eventFilter(QObject *object, QEvent *e)
267 {
268   //
269   // Get the list widget
270   //
271   QListWidget *walletEntriesWidget = findChild<QListWidget *>("WalletEntriesWidget");
272 
273   //
274   // Process the events in the list widget
275   //
276   if (object == walletEntriesWidget->viewport())
277   {
278     // If the user clicked on the viewport of the entries view, clear
279     // the details widget and the "Details" button, if no item
280     // is under the mouse.
281     if (e->type() == QEvent::MouseButtonPress)
282     {
283       QMouseEvent *event = static_cast<QMouseEvent *>(e);
284       QPoint pos = walletEntriesWidget->mapFromGlobal(event->globalPos());
285 
286       if (!walletEntriesWidget->itemAt(pos))
287       {
288         clearDetails();
289         walletEntriesWidget->clearSelection();
290         findChild<QAction *>("EditAction")->setEnabled(false);
291         findChild<QAction *>("RemoveAction")->setEnabled(false);
292       }
293     }
294 
295     return walletEntriesWidget->viewport()->eventFilter(object, e);
296   }
297 
298   return QWidget::eventFilter(object, e);
299 }
300 
301 
loadDetails(Smb4KAuthInfo * authInfo)302 void Smb4KConfigPageAuthentication::loadDetails(Smb4KAuthInfo *authInfo)
303 {
304   //
305   // Get the widgets
306   //
307   QTableWidget *detailsWidget = findChild<QTableWidget *>("DetailsWidget");
308   KCollapsibleGroupBox *detailsGroupBox = findChild<KCollapsibleGroupBox *>("DetailsBox");
309   QListWidget *walletEntriesWidget = findChild<QListWidget *>("WalletEntriesWidget");
310 
311   //
312   // Fill the details table widget with the information
313   //
314   switch (authInfo->type())
315   {
316     case Host:
317     case Share:
318     {
319       detailsWidget->setColumnCount(2);
320       detailsWidget->setRowCount(4);
321 
322       QTableWidgetItem *entry_label = new QTableWidgetItem(i18n("Entry"));
323       entry_label->setFlags(entry_label->flags() & Qt::ItemIsEditable);
324       entry_label->setForeground(palette().text());
325 
326       QTableWidgetItem *entry = new QTableWidgetItem(authInfo->displayString());
327       entry->setFlags(entry->flags() & Qt::ItemIsEditable);
328       entry->setForeground(palette().text());
329 
330       QTableWidgetItem *workgroup_label = new QTableWidgetItem(i18n("Workgroup"));
331       workgroup_label->setFlags(workgroup_label->flags() & Qt::ItemIsEditable);
332       workgroup_label->setForeground(palette().text());
333 
334       QTableWidgetItem *login_label = new QTableWidgetItem(i18n("Login"));
335       login_label->setFlags(login_label->flags() & Qt::ItemIsEditable);
336       login_label->setForeground(palette().text());
337 
338       QTableWidgetItem *password_label = new QTableWidgetItem(i18n("Password"));
339       password_label->setFlags(password_label->flags() & Qt::ItemIsEditable);
340       password_label->setForeground(palette().text());
341 
342       detailsWidget->setItem(0, 0, entry_label);
343       detailsWidget->setItem(0, 1, entry);
344       detailsWidget->setItem(1, 0, workgroup_label);
345       detailsWidget->setItem(1, 1, new QTableWidgetItem(authInfo->workgroupName()));
346       detailsWidget->setItem(2, 0, login_label);
347       detailsWidget->setItem(2, 1, new QTableWidgetItem(authInfo->userName()));
348       detailsWidget->setItem(3, 0, password_label);
349       detailsWidget->setItem(3, 1, new QTableWidgetItem(authInfo->password()));
350 
351       break;
352     }
353     default:
354     {
355       detailsWidget->setColumnCount(2);
356       detailsWidget->setRowCount(3);
357 
358       QTableWidgetItem *entry_label = new QTableWidgetItem(i18n("Entry"));
359       entry_label->setFlags(entry_label->flags() & Qt::ItemIsEditable);
360       entry_label->setForeground(palette().text());
361 
362       QTableWidgetItem *entry = new QTableWidgetItem(i18n("Default Login"));
363       entry->setFlags(entry->flags() & Qt::ItemIsEditable);
364       entry->setForeground(palette().text());
365 
366       QTableWidgetItem *login_label = new QTableWidgetItem(i18n("Login"));
367       login_label->setFlags(login_label->flags() & Qt::ItemIsEditable);
368       login_label->setForeground(palette().text());
369 
370       QTableWidgetItem *password_label = new QTableWidgetItem(i18n("Password"));
371       password_label->setFlags(password_label->flags() & Qt::ItemIsEditable);
372       password_label->setForeground(palette().text());
373 
374       detailsWidget->setItem(0, 0, entry_label);
375       detailsWidget->setItem(0, 1, entry);
376       detailsWidget->setItem(1, 0, login_label);
377       detailsWidget->setItem(1, 1, new QTableWidgetItem(authInfo->userName()));
378       detailsWidget->setItem(2, 0, password_label);
379       detailsWidget->setItem(2, 1, new QTableWidgetItem(authInfo->password()));
380 
381       break;
382     }
383   }
384 
385   //
386   // Connect signals
387   //
388   connect(detailsWidget, SIGNAL(cellChanged(int,int)), this, SLOT(slotDetailsChanged(int,int)));
389 
390   //
391   // Enable the details box
392   //
393   detailsGroupBox->setEnabled(!walletEntriesWidget->selectedItems().isEmpty());
394 }
395 
396 
clearDetails()397 void Smb4KConfigPageAuthentication::clearDetails()
398 {
399   //
400   // Get the widgets
401   //
402   QTableWidget *detailsWidget = findChild<QTableWidget *>("DetailsWidget");
403   KCollapsibleGroupBox *detailsGroupBox = findChild<KCollapsibleGroupBox *>("DetailsBox");
404   QListWidget *walletEntriesWidget = findChild<QListWidget *>("WalletEntriesWidget");
405 
406   //
407   // Disconnect signals
408   //
409   disconnect(detailsWidget, SIGNAL(cellChanged(int,int)), this, SLOT(slotDetailsChanged(int,int)));
410 
411   //
412   // Collapse the details box and disable it.
413   //
414   detailsGroupBox->setExpanded(false);
415   detailsGroupBox->setEnabled(!walletEntriesWidget->selectedItems().isEmpty());
416 
417   //
418   // Clear the table widget
419   //
420   if (detailsWidget->rowCount() != 0 && detailsWidget->columnCount() != 0)
421   {
422     detailsWidget->clear();
423     detailsWidget->setRowCount(0);
424     detailsWidget->setColumnCount(0);
425   }
426 }
427 
428 
429 /////////////////////////////////////////////////////////////////////////////
430 // SLOT IMPLEMENTATIONS
431 /////////////////////////////////////////////////////////////////////////////
432 
slotKWalletButtonToggled(bool checked)433 void Smb4KConfigPageAuthentication::slotKWalletButtonToggled(bool checked)
434 {
435   findChild<QCheckBox *>("kcfg_UseDefaultLogin")->setEnabled(checked);
436   findChild<QWidget *>("WalletEntriesEditor")->setEnabled(checked);
437 }
438 
439 
slotDefaultLoginToggled(bool checked)440 void Smb4KConfigPageAuthentication::slotDefaultLoginToggled(bool checked)
441 {
442   if (checked && !Smb4KSettings::useDefaultLogin())
443   {
444     emit setDefaultLogin();
445   }
446 }
447 
448 
slotItemSelectionChanged()449 void Smb4KConfigPageAuthentication::slotItemSelectionChanged()
450 {
451   //
452   // Get the list widget
453   //
454   QListWidget *walletEntriesWidget = findChild<QListWidget *>("WalletEntriesWidget");
455 
456   //
457   // Clear details widget
458   //
459   clearDetails();
460 
461   //
462   // Get the authentication information and load its
463   // details into the details widget
464   //
465   if (walletEntriesWidget->currentItem())
466   {
467     for (Smb4KAuthInfo *authInfo : m_entriesList)
468     {
469       if (walletEntriesWidget->currentItem()->text() == authInfo->displayString() ||
470           (walletEntriesWidget->currentItem()->text() == i18n("Default Login") && authInfo->type() == UnknownNetworkItem))
471       {
472         loadDetails(authInfo);
473         break;
474       }
475     }
476 
477     // Enable actions
478     findChild<QAction *>("EditAction")->setEnabled(true);
479     findChild<QAction *>("RemoveAction")->setEnabled(true);
480   }
481 }
482 
483 
slotDetailsChanged(int row,int column)484 void Smb4KConfigPageAuthentication::slotDetailsChanged(int row, int column)
485 {
486   //
487   // Get the widget
488   //
489   QTableWidget *detailsWidget = findChild<QTableWidget *>("DetailsWidget");
490 
491   //
492   // Find the right authentication information and pass the modifications
493   //
494   for (Smb4KAuthInfo *authInfo : m_entriesList)
495   {
496     if (QString::compare(detailsWidget->item(0, 1)->text(), authInfo->displayString()) == 0 ||
497         (QString::compare(detailsWidget->item(0, 1)->text(), i18n("Default Login")) == 0 && authInfo->type() == UnknownNetworkItem))
498     {
499       switch (authInfo->type())
500       {
501         case Host:
502         case Share:
503         {
504           if (column == 1)
505           {
506             switch (row)
507             {
508               case 1: // Workgroup
509               {
510                 authInfo->setWorkgroupName(detailsWidget->item(row, column)->text());
511                 break;
512               }
513               case 2: // Login
514               {
515                 authInfo->setUserName(detailsWidget->item(row, column)->text());
516                 break;
517               }
518               case 3: // Password
519               {
520                 authInfo->setPassword(detailsWidget->item(row, column)->text());
521                 break;
522               }
523               default:
524               {
525                 break;
526               }
527             }
528           }
529 
530           break;
531         }
532         default:
533         {
534           if (column == 1)
535           {
536             switch (row)
537             {
538               case 1: // Login
539               {
540                 authInfo->setUserName(detailsWidget->item(row, column)->text());
541                 break;
542               }
543               case 2: // Password
544               {
545                 authInfo->setPassword(detailsWidget->item(row, column)->text());
546                 break;
547               }
548               default:
549               {
550                 break;
551               }
552             }
553           }
554 
555           break;
556         }
557       }
558 
559       break;
560     }
561   }
562 
563   //
564   // Tell the program that the authentication information may be changed
565   // and emit the appropriate signal
566   //
567   m_maybe_changed = true;
568   emit walletEntriesModified();
569 }
570 
571 
slotEditClicked()572 void Smb4KConfigPageAuthentication::slotEditClicked()
573 {
574   //
575   // Get the widgets
576   //
577   KCollapsibleGroupBox *detailsGroupBox = findChild<KCollapsibleGroupBox *>("DetailsBox");
578   QListWidget *walletEntriesWidget = findChild<QListWidget *>("WalletEntriesWidget");
579 
580   if (walletEntriesWidget->currentItem())
581   {
582     //
583     // Since the details have been loaded to the details widget already
584     // by slotItemSelectionChanged(), only open the details widget here.
585     //
586     if (!detailsGroupBox->isExpanded())
587     {
588       detailsGroupBox->setExpanded(true);
589     }
590   }
591 }
592 
593 
594 
slotRemoveClicked()595 void Smb4KConfigPageAuthentication::slotRemoveClicked()
596 {
597   //
598   // Get the list widget
599   //
600   QListWidget *walletEntriesWidget = findChild<QListWidget *>("WalletEntriesWidget");
601 
602   //
603   // Clear the details widget
604   //
605   clearDetails();
606 
607   //
608   // Remove the appropriate entry from the list of authentication information
609   //
610   for (int i = 0; i < m_entriesList.size(); ++i)
611   {
612     if (QString::compare(walletEntriesWidget->currentItem()->text(), m_entriesList.at(i)->displayString()) == 0 ||
613         (QString::compare(walletEntriesWidget->currentItem()->text(), i18n("Default Login")) == 0 && m_entriesList.at(i)->type() == UnknownNetworkItem))
614     {
615       switch (m_entriesList.at(i)->type())
616       {
617         case UnknownNetworkItem:
618         {
619           QCheckBox *default_login = findChild<QCheckBox *>("kcfg_UseDefaultLogin");
620           default_login->setChecked(false);
621           break;
622         }
623         default:
624         {
625           break;
626         }
627       }
628 
629       delete m_entriesList.takeAt(i);
630       break;
631     }
632     else
633     {
634       continue;
635     }
636   }
637 
638   //
639   // Remove the current item
640   //
641   delete walletEntriesWidget->currentItem();
642 
643   //
644   // Enable actions
645   //
646   findChild<QAction *>("ClearAction")->setEnabled((walletEntriesWidget->count() != 0));
647 
648   //
649   // Tell the program that the authentication information may be changed
650   // and emit the appropriate signal
651   //
652   m_maybe_changed = true;
653   emit walletEntriesModified();
654 }
655 
656 
slotClearClicked()657 void Smb4KConfigPageAuthentication::slotClearClicked()
658 {
659   //
660   // Get the list widget
661   //
662   QListWidget *walletEntriesWidget = findChild<QListWidget *>("WalletEntriesWidget");
663 
664   //
665   // Clear the details widget
666   //
667   clearDetails();
668 
669   //
670   // Remove all entries from the view
671   //
672   while (walletEntriesWidget->count() != 0)
673   {
674     delete walletEntriesWidget->item(0);
675   }
676 
677   //
678   // Remove all entries from the list off authentication information
679   //
680   while(!m_entriesList.isEmpty())
681   {
682     delete m_entriesList.takeFirst();
683   }
684 
685   //
686   // Enabled widgets
687   //
688   findChild<QAction *>("ClearAction")->setEnabled(false);
689 
690   //
691   // Uncheck the Default Login checkbox
692   //
693   findChild<QCheckBox *>("kcfg_UseDefaultLogin")->setChecked(false);
694 
695   //
696   // Tell the program that the authentication information may be changed
697   // and emit the appropriate signal
698   //
699   m_maybe_changed = true;
700   emit walletEntriesModified();
701 }
702 
703 
slotSaveClicked(bool)704 void Smb4KConfigPageAuthentication::slotSaveClicked(bool /*checked*/)
705 {
706   //
707   // Get the list widget
708   //
709   QListWidget *walletEntriesWidget = findChild<QListWidget *>("WalletEntriesWidget");
710 
711   //
712   // Disable buttons
713   //
714   findChild<QAction *>("EditAction")->setEnabled(false);
715   findChild<QAction *>("RemoveAction")->setEnabled(false);
716   findChild<QAction *>("ClearAction")->setEnabled((walletEntriesWidget->count() != 0));
717 
718   //
719   // Clear the selection in the list view
720   //
721   walletEntriesWidget->clearSelection();
722 
723   //
724   // Tell the program that the authentication information may be changed
725   // and emit the appropriate signal
726   //
727   m_maybe_changed = false;
728   emit walletEntriesModified();
729 }
730 
731