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

Coding style

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