~kubuntu-packagers/kcm-gtk/0.5.x

« back to all changes in this revision

Viewing changes to searchpaths.cpp

  • Committer: Jonathan Thomas (The man)
  • Date: 2009-06-17 13:00:14 UTC
  • Revision ID: echidnaman@gmail.com-20090617130014-zdnc4hurctqurr7i
* Krazy2 fixes:
  - Fix FSF address in license headers
  - QString efficency changes
  - QDialog -> KDialog for SearchPAths
* Add myself to the authors in the about dialog
* Give the SearchPaths dialog icons
* Retool the SearchPath dialog's text to fit our needs
* Give the SearchPaths dialog a minimum size

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 *   You should have received a copy of the GNU General Public License     *
16
16
 *   along with this program; if not, write to the                         *
17
17
 *   Free Software Foundation, Inc.,                                       *
18
 
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 
18
 *   51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.              *
19
19
 ***************************************************************************/
20
20
 
21
21
#include "searchpaths.h"
24
24
#include <QDir>
25
25
 
26
26
SearchPaths::SearchPaths(QWidget* parent)
27
 
        : QDialog(parent)
 
27
        : KDialog(parent)
28
28
{
29
 
        m_ui.setupUi(this);
 
29
        QWidget *widget = new QWidget(this);
 
30
        setMainWidget(widget);
 
31
        m_ui.setupUi(widget);
30
32
        
31
33
        m_settings = new QSettings("gtk-qt-engine", "kcmgtk", this);
32
34
        
38
40
        m_paths = new QStringListModel(m_settings->value("GtkSearchPaths", gtkSearchPathsDefault).toStringList(), this);
39
41
        
40
42
        m_ui.searchPaths->setModel(m_paths);
 
43
 
 
44
        // Load icons
 
45
        m_ui.addButton->setIcon(KIcon("list-add"));
 
46
        m_ui.removeButton->setIcon(KIcon("list-remove"));
41
47
        
42
48
        connect(m_ui.pathBox, SIGNAL(textEdited(const QString&)), SLOT(textChanged(const QString&)));
43
49
        connect(m_ui.pathBox, SIGNAL(returnPressed()), SLOT(add()));
49
55
int SearchPaths::exec()
50
56
{
51
57
        QStringList rollback(m_paths->stringList());
52
 
        int ret = QDialog::exec();
53
 
        if (ret == QDialog::Rejected)
 
58
        int ret = KDialog::exec();
 
59
        if (ret == KDialog::Rejected)
54
60
                m_paths->setStringList(rollback);
55
61
        else
56
62
                m_settings->setValue("GtkSearchPaths", m_paths->stringList());