00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef YQPkgConflictList_h
00023 #define YQPkgConflictList_h
00024
00025
00026 #include <stdio.h>
00027 #include <qmap.h>
00028 #include <y2pm/PkgDep.h>
00029 #include <y2pm/PMSelectable.h>
00030 #include "QY2ListView.h"
00031
00032
00033 class QAction;
00034 class YQPkgConflict;
00035 class YQPkgConflictAlternative;
00036 class YQPkgConflictResolution;
00037 class YQPkgConflictDialog;
00038
00039
00043 typedef enum YQPkgConflictResolutionType
00044 {
00045 YQPkgConflictUndo,
00046 YQPkgConflictIgnore,
00047 YQPkgConflictDeleteConflictors,
00048 YQPkgConflictDeleteReferers,
00049 YQPkgConflictAlternative
00050 };
00051
00052
00057 class YQPkgConflictList : public QY2ListView
00058 {
00059 Q_OBJECT
00060
00061 public:
00065 YQPkgConflictList( QWidget * parent );
00066
00070 virtual ~YQPkgConflictList();
00071
00075 void fill( PkgDep::ErrorResultList & badList );
00076
00080 bool choicesComplete();
00081
00085 bool isEmpty() const { return childCount() == 0; }
00086
00090 int count() const { return childCount(); }
00091
00092
00093 public slots:
00094
00098 void applyResolutions();
00099
00103 void ignoreAll();
00104
00108 void askSaveToFile() const;
00109
00110
00111 public:
00112
00121 void saveToFile( const QString filename, bool interactive ) const;
00122
00123
00124 protected:
00125
00129 void saveItemToFile( FILE * file, const QListViewItem * item ) const;
00130
00131
00132 signals:
00133
00137 void updatePackages();
00138 };
00139
00140
00141
00145 class YQPkgConflict: public QY2ListViewItem
00146 {
00147 public:
00148
00152 YQPkgConflict( YQPkgConflictList * parentList,
00153 const PkgDep::ErrorResult & errorResult );
00154
00158 virtual ~YQPkgConflict() {}
00159
00163 PkgDep::ErrorResult & errorResult() { return _conflict; }
00164
00168 bool needAlternative() { return ! _conflict.alternatives.empty(); }
00169
00173 bool hasCollisions() { return ! _conflict.conflicts_with.empty(); }
00174
00178 bool hasOpenRequirements() { return ! _conflict.unresolvable.empty(); }
00179
00183 void applyResolution();
00184
00185
00189 bool isIgnored();
00190
00194 void ignore();
00195
00200 static bool isIgnored( const QString & conflictHeader );
00201
00206 static void ignore( const QString & conflictHeader );
00207
00212 static void resetIgnoredConflicts();
00213
00217 static void saveIgnoredConflicts();
00218
00222 static void loadIgnoredConflicts();
00223
00227 static bool haveIgnoredConflicts();
00228
00235 static QAction * actionResetIgnoredConflicts( YQPkgConflictDialog * dialog = 0 );
00236
00241 static void updateActions();
00242
00243
00244 protected:
00245
00249 void formatHeading();
00250
00255 void dumpLists();
00256
00265 void dumpList( QListViewItem * parent,
00266 PkgDep::RelInfoList & list,
00267 int splitThreshold = -1,
00268 const QString & header = QString::null );
00269
00273 void addResolutionSuggestions();
00274
00279 void addUndoResolution( QY2CheckListItem * parent );
00280
00284 void addAlternativesList( QY2CheckListItem * parent );
00285
00289 void addDeleteConflictsResolution( QY2CheckListItem * parent );
00290
00294 void addDeleteReferersResolution( QY2CheckListItem * parent );
00295
00299 void addIgnoreResolution( QY2CheckListItem * parent );
00300
00305 void dumpDeleteList( QListViewItem * parent, PkgDep::SolvableList& solvablelist );
00306
00310 void bruteForceDelete(PkgDep::SolvableList& solvablelist);
00311
00318 virtual void paintCell( QPainter * painter,
00319 const QColorGroup & colorGroup,
00320 int column,
00321 int width,
00322 int alignment );
00323
00324
00325
00326
00327 PMObjectPtr _pmObj;
00328 bool _isPkg;
00329 QString _shortName;
00330 QString _fullName;
00331 PMSelectable::UI_Status _status;
00332 PMSelectable::UI_Status _undo_status;
00333 bool _canIgnore;
00334
00335 QListViewItem * _resolutionsHeader;
00336 PkgDep::ErrorResult _conflict;
00337 YQPkgConflictList * _parentList;
00338
00339
00343 static QMap<QString, bool> _ignore;
00344
00345 static QAction * _actionResetIgnoredConflicts;
00346 };
00347
00348
00349
00350 class YQPkgConflictResolution: public QY2CheckListItem
00351 {
00352 public:
00353
00357 YQPkgConflictResolution( QY2CheckListItem * parent,
00358 const QString & text,
00359 YQPkgConflictResolutionType type );
00360
00364 YQPkgConflictResolution( QY2CheckListItem * parent,
00365 PMObjectPtr pmObj );
00366
00370 PMObjectPtr pmObj() const { return _pmObj; }
00371
00375 YQPkgConflictResolutionType type() const { return _type; }
00376
00377
00381 const char * typeString() const;
00382
00383 protected:
00384
00385
00386
00387 YQPkgConflictResolutionType _type;
00388 PMObjectPtr _pmObj;
00389 };
00390
00391
00392 #endif // ifndef YQPkgConflictList_h