Commit 4da778df authored by Laurent Montel's avatar Laurent Montel 😁

Coding style

parent 66fba87b
This diff is collapsed.
/******************************************************************* /*******************************************************************
* kfinddlg.h * kfinddlg.h
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version. * the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
******************************************************************/ ******************************************************************/
#ifndef KFINDDLG_H #ifndef KFINDDLG_H
...@@ -35,49 +35,49 @@ class KfindTabWidget; ...@@ -35,49 +35,49 @@ class KfindTabWidget;
class KFindTreeView; class KFindTreeView;
class KStatusBar; class KStatusBar;
class KfindDlg: public KDialog class KfindDlg : public KDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit KfindDlg(const QUrl & url, QWidget * parent = 0); explicit KfindDlg(const QUrl &url, QWidget *parent = 0);
~KfindDlg(); ~KfindDlg();
void copySelection(); void copySelection();
void setStatusMsg(const QString &); void setStatusMsg(const QString &);
void setProgressMsg(const QString &); void setProgressMsg(const QString &);
private: private:
/*Return a QStringList of all subdirs of d*/ /*Return a QStringList of all subdirs of d*/
QStringList getAllSubdirs(QDir d); QStringList getAllSubdirs(QDir d);
public Q_SLOTS: public Q_SLOTS:
void startSearch(); void startSearch();
void stopSearch(); void stopSearch();
void newSearch(); void newSearch();
void addFiles( const QList< QPair<KFileItem,QString> > & ); void addFiles(const QList< QPair<KFileItem, QString> > &);
void setFocus(); void setFocus();
void slotResult(int); void slotResult(int);
// void slotSearchDone(); // void slotSearchDone();
void about (); void about();
void slotDeleteItem(const QString&); void slotDeleteItem(const QString &);
void slotNewItems( const QString& ); void slotNewItems(const QString &);
void finishAndClose(); void finishAndClose();
Q_SIGNALS: Q_SIGNALS:
void haveResults(bool); void haveResults(bool);
void resultSelected(bool); void resultSelected(bool);
private: private:
KfindTabWidget *tabWidget; KfindTabWidget *tabWidget;
KFindTreeView * win; KFindTreeView *win;
bool isResultReported; bool isResultReported;
KQuery *query; KQuery *query;
KStatusBar *mStatusBar; KStatusBar *mStatusBar;
KDirLister *dirlister; KDirLister *dirlister;
KDirWatch *dirwatch; KDirWatch *dirwatch;
}; };
#endif #endif
This diff is collapsed.
/******************************************************************* /*******************************************************************
* kfindtreeview.h * kfindtreeview.h
* Copyright 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com> * Copyright 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version. * the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
******************************************************************/ ******************************************************************/
#ifndef KFINDTREEVIEW__H #ifndef KFINDTREEVIEW__H
...@@ -38,122 +38,151 @@ class KfindDlg; ...@@ -38,122 +38,151 @@ class KfindDlg;
class KFindItem class KFindItem
{ {
public: public:
explicit KFindItem( const KFileItem & = KFileItem(), const QString & subDir = QString(), const QString & matchingLine = QString() ); explicit KFindItem(const KFileItem & = KFileItem(), const QString &subDir = QString(), const QString &matchingLine = QString());
QVariant data(int column, int role) const; QVariant data(int column, int role) const;
KFileItem getFileItem() const { return m_fileItem; } KFileItem getFileItem() const
bool isValid() const { return !m_fileItem.isNull(); } {
return m_fileItem;
private: }
KFileItem m_fileItem;
QString m_matchingLine; bool isValid() const
QString m_subDir; {
QString m_permission; return !m_fileItem.isNull();
QIcon m_icon; }
private:
KFileItem m_fileItem;
QString m_matchingLine;
QString m_subDir;
QString m_permission;
QIcon m_icon;
}; };
class KFindItemModel: public QAbstractTableModel class KFindItemModel : public QAbstractTableModel
{ {
public: public:
KFindItemModel( KFindTreeView* parent); KFindItemModel(KFindTreeView *parent);
void insertFileItems( const QList< QPair<KFileItem,QString> > &); void insertFileItems(const QList< QPair<KFileItem, QString> > &);
void removeItem(const QUrl &); void removeItem(const QUrl &);
bool isInserted(const QUrl &); bool isInserted(const QUrl &);
void clear(); void clear();
Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE { return Qt::CopyAction | Qt::MoveAction; } Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE
{
Qt::ItemFlags flags(const QModelIndex &) const Q_DECL_OVERRIDE; return Qt::CopyAction | Qt::MoveAction;
QMimeData * mimeData(const QModelIndexList &) const Q_DECL_OVERRIDE; }
int columnCount ( const QModelIndex & parent = QModelIndex() ) const Q_DECL_OVERRIDE { Q_UNUSED(parent); return 6; } Qt::ItemFlags flags(const QModelIndex &) const Q_DECL_OVERRIDE;
int rowCount ( const QModelIndex & parent = QModelIndex() ) const Q_DECL_OVERRIDE; QMimeData *mimeData(const QModelIndexList &) const Q_DECL_OVERRIDE;
QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const Q_DECL_OVERRIDE;
QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE; int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE
{
KFindItem itemAtIndex( const QModelIndex & index ) const; Q_UNUSED(parent);
return 6;
QList<KFindItem> getItemList() const { return m_itemList; } }
private: int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
QList<KFindItem> m_itemList; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
KFindTreeView* m_view; QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
KFindItem itemAtIndex(const QModelIndex &index) const;
QList<KFindItem> getItemList() const
{
return m_itemList;
}
private:
QList<KFindItem> m_itemList;
KFindTreeView *m_view;
}; };
class KFindSortFilterProxyModel: public QSortFilterProxyModel class KFindSortFilterProxyModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public:
KFindSortFilterProxyModel(QObject * parent = 0):
QSortFilterProxyModel(parent){}
protected: public:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE; KFindSortFilterProxyModel(QObject *parent = 0)
: QSortFilterProxyModel(parent)
{
}
protected:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
}; };
class KFindTreeView: public QTreeView class KFindTreeView : public QTreeView
{ {
Q_OBJECT Q_OBJECT
public: public:
KFindTreeView( QWidget * parent, KfindDlg * findDialog); KFindTreeView(QWidget *parent, KfindDlg *findDialog);
~KFindTreeView(); ~KFindTreeView();
void beginSearch(const QUrl& baseUrl); void beginSearch(const QUrl &baseUrl);
void endSearch(); void endSearch();
void insertItems(const QList< QPair<KFileItem,QString> > &); void insertItems(const QList< QPair<KFileItem, QString> > &);
void removeItem(const QUrl & url); void removeItem(const QUrl &url);
bool isInserted(const QUrl & url) { return m_model->isInserted( url ); } bool isInserted(const QUrl &url)
{
QString reducedDir(const QString& fullDir); return m_model->isInserted(url);
}
int itemCount() { return m_model->rowCount(); }
QList<QUrl> selectedUrls(); QString reducedDir(const QString &fullDir);
public Q_SLOTS: int itemCount()
void copySelection(); {
void contextMenuRequested( const QPoint & p ); return m_model->rowCount();
}
private Q_SLOTS:
void deleteSelectedFiles(); QList<QUrl> selectedUrls();
void moveToTrashSelectedFiles();
public Q_SLOTS:
void slotExecute( const QModelIndex & index ); void copySelection();
void slotExecuteSelected(); void contextMenuRequested(const QPoint &p);
void openContainingFolder(); private Q_SLOTS:
void saveResults(); void deleteSelectedFiles();
void moveToTrashSelectedFiles();
void reconfigureMouseSettings();
void updateMouseButtons(); void slotExecute(const QModelIndex &index);
void slotExecuteSelected();
protected:
void dragMoveEvent( QDragMoveEvent *e ) Q_DECL_OVERRIDE { e->accept(); } void openContainingFolder();
void saveResults();
Q_SIGNALS:
void resultSelected(bool); void reconfigureMouseSettings();
void updateMouseButtons();
private:
void resizeToContents(); protected:
void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE
QDir m_baseDir; {
e->accept();
KFindItemModel * m_model; }
KFindSortFilterProxyModel * m_proxyModel;
KActionCollection * m_actionCollection; Q_SIGNALS:
QMenu * m_contextMenu; void resultSelected(bool);
Qt::MouseButtons m_mouseButtons; private:
void resizeToContents();
KfindDlg * m_kfindDialog;
QDir m_baseDir;
KFindItemModel *m_model;
KFindSortFilterProxyModel *m_proxyModel;
KActionCollection *m_actionCollection;
QMenu *m_contextMenu;
Qt::MouseButtons m_mouseButtons;
KfindDlg *m_kfindDialog;
}; };
#endif #endif
This diff is collapsed.
/******************************************************************* /*******************************************************************
* kftabdlg.h * kftabdlg.h
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version. * the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
******************************************************************/ ******************************************************************/
#ifndef KFTABDLG_H #ifndef KFTABDLG_H
...@@ -42,112 +42,112 @@ class QLabel; ...@@ -42,112 +42,112 @@ class QLabel;
class KfDirDialog; class KfDirDialog;
class KfindTabWidget: public KTabWidget class KfindTabWidget : public KTabWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
KfindTabWidget(QWidget * parent = 0); KfindTabWidget(QWidget *parent = 0);
virtual ~KfindTabWidget(); virtual ~KfindTabWidget();
void initMimeTypes(); void initMimeTypes();
void initSpecialMimeTypes(); void initSpecialMimeTypes();
void setQuery(class KQuery * query); void setQuery(class KQuery *query);
void setDefaults(); void setDefaults();
void beginSearch(); void beginSearch();
void endSearch(); void endSearch();
void loadHistory(); void loadHistory();
void saveHistory(); void saveHistory();
bool isSearchRecursive(); bool isSearchRecursive();
void setURL( const QUrl & url ); void setURL(const QUrl &url);
QSize sizeHint() const Q_DECL_OVERRIDE; QSize sizeHint() const Q_DECL_OVERRIDE;
public Q_SLOTS: public Q_SLOTS:
void setFocus(); void setFocus();
void slotUpdateDateLabelsForNumber(int value); void slotUpdateDateLabelsForNumber(int value);
void slotUpdateDateLabelsForType(int index); void slotUpdateDateLabelsForType(int index);
void slotUpdateByteComboBox(int value); void slotUpdateByteComboBox(int value);
private Q_SLOTS: private Q_SLOTS:
void getDirectory(); void getDirectory();
void fixLayout(); void fixLayout();
void slotSizeBoxChanged(int); void slotSizeBoxChanged(int);
void slotEditRegExp(); void slotEditRegExp();
Q_SIGNALS: Q_SIGNALS:
void startSearch(); void startSearch();
protected: protected:
public: public:
KComboBox *nameBox; KComboBox *nameBox;
KUrlComboBox *dirBox; KUrlComboBox *dirBox;
// for first page // for first page
QCheckBox *subdirsCb; QCheckBox *subdirsCb;
QCheckBox *useLocateCb; QCheckBox *useLocateCb;
QCheckBox *hiddenFilesCb; QCheckBox *hiddenFilesCb;
// for third page // for third page
KComboBox *typeBox; KComboBox *typeBox;
KLineEdit * textEdit; KLineEdit *textEdit;
QCheckBox *caseSensCb; QCheckBox *caseSensCb;
KComboBox *m_usernameBox; KComboBox *m_usernameBox;
KComboBox *m_groupBox; KComboBox *m_groupBox;
//for fourth page //for fourth page
KLineEdit *metainfoEdit; KLineEdit *metainfoEdit;
KLineEdit *metainfokeyEdit; KLineEdit *metainfokeyEdit;
private: private:
bool isDateValid(); bool isDateValid();
void updateDateLabels(int type, int value); void updateDateLabels(int type, int value);
QWidget *pages[3]; QWidget *pages[3];
//1st page //1st page
QPushButton *browseB; QPushButton *browseB;
KfDirDialog *dirselector; KfDirDialog *dirselector;
//2nd page //2nd page
QCheckBox *findCreated; QCheckBox *findCreated;
KComboBox *betweenType; KComboBox *betweenType;
QLabel *andL; QLabel *andL;
QButtonGroup *bg; QButtonGroup *bg;
QRadioButton *rb[2]; QRadioButton *rb[2];
KDateComboBox * fromDate; KDateComboBox *fromDate;
KDateComboBox * toDate; KDateComboBox *toDate;
KIntSpinBox *timeBox; KIntSpinBox *timeBox;
//3rd page //3rd page
KComboBox *sizeBox; KComboBox *sizeBox;
KComboBox *sizeUnitBox; KComboBox *sizeUnitBox;
KIntSpinBox *sizeEdit; KIntSpinBox *sizeEdit;
QCheckBox *caseContextCb; QCheckBox *caseContextCb;
QCheckBox *binaryContextCb; QCheckBox *binaryContextCb;
QCheckBox *regexpContentCb; QCheckBox *regexpContentCb;
KDialog *regExpDialog; KDialog *regExpDialog;
QUrl m_url; QUrl m_url;
KMimeType::List m_types; KMimeType::List m_types;
QStringList m_ImageTypes; QStringList m_ImageTypes;
QStringList m_VideoTypes; QStringList m_VideoTypes;
QStringList m_AudioTypes; QStringList m_AudioTypes;
}; };
class KDigitValidator : public QValidator class KDigitValidator : public QValidator
{ {
Q_OBJECT Q_OBJECT
public: public:
KDigitValidator(QWidget * parent); KDigitValidator(QWidget *parent);
~KDigitValidator(); ~KDigitValidator();
QValidator::State validate(QString & input, int &) const Q_DECL_OVERRIDE; QValidator::State validate(QString &input, int &) const Q_DECL_OVERRIDE;
private: private:
QRegExp *r; QRegExp *r;
}; };
#endif #endif
This diff is collapsed.
/*******************************************************************