File indexing completed on 2024-04-28 17:05:52

0001 /*
0002     SPDX-FileCopyrightText: 2002 Shie Erlich <erlich@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2002 Rafi Yanai <yanai@users.sourceforge.net>
0004     SPDX-FileCopyrightText: 2004-2022 Krusader Krew <https://krusader.org>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef KRADDBOOKMARKDLG_H
0010 #define KRADDBOOKMARKDLG_H
0011 
0012 #include "../GUI/krtreewidget.h"
0013 #include "krbookmark.h"
0014 
0015 // QtCore
0016 #include <QMap>
0017 #include <QUrl>
0018 // QtWidgets
0019 #include <QDialog>
0020 #include <QToolButton>
0021 
0022 #include <KCompletion/KLineEdit>
0023 
0024 class KrAddBookmarkDlg : public QDialog
0025 {
0026     Q_OBJECT
0027 public:
0028     explicit KrAddBookmarkDlg(QWidget *parent, const QUrl &url = QUrl());
0029     QUrl url() const
0030     {
0031         return QUrl::fromUserInput(_url->text(), QString(), QUrl::AssumeLocalFile);
0032     }
0033     QString name() const
0034     {
0035         return _name->text();
0036     }
0037     KrBookmark *folder() const;
0038 
0039 protected:
0040     QWidget *createInWidget();
0041     void populateCreateInWidget(KrBookmark *root, QTreeWidgetItem *parent);
0042 
0043 protected slots:
0044     void toggleCreateIn(bool show);
0045     void slotSelectionChanged();
0046     void newFolder();
0047 
0048 private:
0049     KLineEdit *_name;
0050     KLineEdit *_url;
0051     KLineEdit *_folder;
0052     KrTreeWidget *_createIn;
0053     QMap<QTreeWidgetItem *, KrBookmark *> _xr;
0054     QToolButton *_createInBtn;
0055     QPushButton *newFolderButton;
0056     QWidget *detailsWidget;
0057 };
0058 
0059 #endif // KRADDBOOKMARKDLG_H